ActionScript 3.0 – Global Variable & On Mouse Click Event

I got to do a little ActionScript 3.0 work today. I can’t help but wonder what type of things I could create using Flash and ActionScript. Seems like it could be pretty fun. Do ActionScript programmers make good rates compared to .Net programmers?

Anyways. Here’s a few examples of some really basic ActionScript 3.0 stuff.

Here’s an example of how to create and use a global variable in ActionScript 3.0.

var intClicks:int = 0;

function showDoves():void {
	++intClicks;
	if(intClicks >= 5){
		_movieDoves.visible = true;
	}
}

And here is an example of how to add an “on click” mouse event listener function in ActionScript 3.0.

_btnFact1.addEventListener(MouseEvent.CLICK, onClickBtnFact1);

function onClickBtnFact1(evt:MouseEvent):void {
	_fact1.visible = true;
}

That’s all I got. I just wanted to document this so I can reference it later. I hope it’s helpful to you. 🙂

This entry was posted in Web & Software Development and tagged , , . Bookmark the permalink.

One Response to ActionScript 3.0 – Global Variable & On Mouse Click Event

  1. hey a live demo would make it alot more interesting but what you got right now helped anyways. Thanks alot

Leave a Reply

Your email address will not be published. Required fields are marked *