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 {
	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. 🙂