Hello,
I’m pretty new to AS so sorry if it’s a bit of a newbie question! - I’m using the MC tween method to do all my animations and buttons but am having problems with the example text I have been given:
#include “mc_tween2.as”
var myButtons = [this.myButton_1, this.myButton_2, this.myButton_3, this.myButton_4];
for (var i=0; i<myButtons.length; i++) {
myButtons*.originalY = myButtons*._y;
myButtons*.onRollOver = function() {
this.tween("_y", this.originalY + 10, 1);
};
myButtons*.onRollout = myButtons*.onReleaseOutside = function() {
this.tween("_y", this.originalY, 0.5);
};
[COLOR=Red]
myButtons*.onRelease = function() {
this._parent.activateItem (this);
trace ("Hey, button "+this+" was clicked.");
};[/COLOR]
}
this.activateItem = function(item) {
if (this.currentItem != false) this.deActivateItem();
this.currentItem = item;
this.currentItem.alphaTo (50, 1);
this.currentItem.enabled = false;
};
this.deActivateItem = function() {
this.currentItem.enabled = true;
this.currentItem.alphaTo (100, 0.5);
this.currentItem.tween("_y", this.currentItem.originalY, 0.5)
this.currentItem = undefined;
};
this.stop();
What I am having trouble getting to grips with is in red. How do I give different actions to each button (one open window one and the other opens window 2 for example)? When I try this code, each button does the same thing and I can’t figure out what I’m meant to be doing to change that!
Thanks