all groups > flash actionscript > january 2004 >
You're in the

flash actionscript

group:

array question help


array question help duppdawg
1/22/2004 9:50:17 PM
flash actionscript:
i am new to arrays and have practiced some tutorials for instance aligning information in rows and columns then categorizing them numerically, alphabetically, etc...

however, can i put multiple mcs in an array and just call the array in function. i have long code like this that could be shortened...

//// notice how all mcs do the same thing
//// however it is not practical for this animation to create one big mc

axis_mc.next_btn.onRelease = function () {
globe_mc.onEnterFrame = this.myOnEnterFrame7;
axis_mc.onEnterFrame = this.myOnEnterFrame8;
mouseover_text.onEnterFrame = this.myOnEnterFrame9;
beta_btn_mc.enabled = false;
}

axis_mc.next_btn.myOnEnterFrame7 = function () {
this._alpha -= 6;
if (this._alpha <= 1) {
delete this.onEnterFrame;
gotoAndPlay (4);
}
}

axis_mc.next_btn.myOnEnterFrame8 = function () {
this._alpha -= 6;
if (this._alpha <= 1) {
delete this.onEnterFrame;
gotoAndPlay (4);
}
}

axis_mc.next_btn.myOnEnterFrame9 = function () {
this._alpha -= 6;
if (this._alpha <= 1) {
delete this.onEnterFrame;
gotoAndPlay (4);
}
}

Re:array question help juankpro
1/22/2004 10:05:51 PM
you can do it this way:

myClips = [globe_mc, axis_mc, mouseover_text];

axis_mc.next_btn.onRelease = function () {
for (var i in myClips)
myClips.onEnterFrame = this.myOnEnterFrame;

beta_btn_mc.enabled = false;
}

axis_mc.next_btn.myOnEnterFrame = function () {
this._alpha -= 6;
if (this._alpha <= 1) {
delete this.onEnterFrame;
gotoAndPlay (4);
}
}


AddThis Social Bookmark Button