What I want is a hint how to make a specific thing happen while clicking a specific button. Like “if I click button 1, do this”. Would like to use this script though I’m gonna add buttons over time and this is an easy way to have the functionality working.
Here’s the code:
Attach Code
function hitButton(btn) {
btn.onRollOver = function() {
this.colorTo (0xC4006A);
}
btn.onRollOut = function() {
this.colorTo (0x000000);
}
btn.onRelease = function() {
for (var i = 0; i<5; i++) {
_root["btn"+i].enabled = true;
}
flop(myPrevButton);
if (this._xscale>-50) {
this.enabled = false;
flip(this);
myPrevButton = this;
}
}
}
for (var i = 0; i<5; i++) {
_root.hitButton(_root[“btn”+i]);
}
function flip(who) {
who.colorTo (0xC4006A, 2);
var twflip:Tween = new Tween(who, “_xscale”, Bounce.easeOut, 100, -100, 1, true);
}
function flop(who) {
who.colorTo (0x000000, 2);
var twflop:Tween = new Tween(who, “_xscale”, Bounce.easeOut, -100, 100, 2, true);
}