(Flash ActionScript 3)  By Tony Pan

There were times that we’ll have to assign mouse event to number of buttons or movieclips on the stage, ie.  navigation elements.  It is perfectly fine to implement the addEventListener individually to each of these buttons and movieclips.   But what if there are a large number of these buttons, and needed to use on few different individual swf files.   Here is the example code for importing  the same class file and create an storage array for the buttons and movieclips.   Then called the class function passing the storage array.

Sample Screen: (Roll mouse cursor over and click on them)

Code on the FLA file (buttons.fla):

import com.buttonEvent;
var addButtonEvent:buttonEvent = new buttonEvent(this);
var buttonArray:Array = new Array();
buttonArray = [button1, button2, button3, button4, button5, button6];

Code on the package file (buttonEvnet.as):

Continue Reading »