I’m trying to assign basically the same actions to a bunch of button MC’s. I’m trying to store all the names in an array then looping through and giving them all actions rather than writing the same actions out over and over for each button MC. Here’s my attempt:
var aWorksArray:Array = new Array();
aWorksArray.push("downpour");
aWorksArray.push("algonquin");
aWorksArray.push("colliers");
aWorksArray.push("frannet");
aWorksArray.push("threeride");
aWorksArray.push("hookandgo");
aWorksArray.push("fallwater");
aWorksArray.push("tbell");
aWorksArray.push("pivotech");
aWorksArray.push("happytails");
aWorksArray.push("truffini");
aWorksArray.push("pemco");
aWorksArray.push("brockmanns");
aWorksArray.push("joule");
aWorksArray.push("assorted");
aWorksArray.push("logoz");
for (var i:Number = 0; i<aWorksArray.length; i++) {
this.aWorksArray*.endAlpha = 100;
//
this.aWorksArray*.onEnterFrame = function() {
this.aWorksArray*.labelMC._x += (this.aWorksArray*.labelMC.endX-this.aWorksArray*.labelMC._x)/3;
//ALPHA FADER
_alpha += (endAlpha-_alpha)/5;
};
//BUTTON ANIMATION
this.aWorksArray*.onRollOver = function() {
this.labelMC.endX = indent;
this.anim.endalpha = 100;
};
this.aWorksArray*.onRollOut = function() {
this.labelMC.endX = 0;
this.anim.endalpha = 0;
delete this.onEnterFrame;
};
this.aWorksArray*.onRelease = function() {
//LOAD SELECTED MOVIE
loadMovieNum("aWorksArray*.swf", 2);
//DISABLE BUTTONS
this._parent.gotoAndStop(2);
this.anim.endalpha = 0;
this.labelMC.endX = 0;
delete this.onEnterFrame;
};
}
SO where you see “[FONT=Courier New]aWorksArray[/FONT]”, that was the instance name of the button MC’s and by the number I have you can see I don’t want to write it all out over and over…
Any ideas of how to make this work, or know a method that would work??
Thnx