Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On release action... 1

Status
Not open for further replies.

brutteforcce

Technical User
Jun 23, 2006
105
RO
I have this code...
for (i=1; i<6; i++) {
this["buton"+i].onRollOver = function() {
var n = this._name.substring(5);
this._parent["txt_"+n].gotoAndPlay("txt_init");
this._parent["disp_"+n].gotoAndStop("disp_init");
};
this["buton"+i].onRollOut = function() {
var n = this._name.substring(5);
this._parent["txt_"+n].gotoAndPlay("trans_txt");
this._parent["disp_"+n].gotoAndPlay("trans_disp");
};
this["buton"+i].onRelease = function() {
var n = this._name.substring(5);
this._parent["txt_"+n].gotoAndStop("trans_txt");
this._parent["disp_"+n].gotoAndStop("trans_disp");
};
}
If I release the buton it should remain like that until I release another button and when I release another button the action from the on roll over should play for the button that it is pressed...

So if I release button2 it should stay in that way until I release another button... If I release after button3, the actions from the on roll over should start for button2...

How can I make this for all buttons just with a function or something that should work for any 2 buttons ( the button that was released first and the button released second, after the second was released it becomes the first)...

Please help!!!

stop();
 
I translated into the script: I hope you get the idea.
[tt]//
for (var i = 1; i<=5; i++) {
var buton = this["buton"+i];
buton.id = i;
buton.released = false;
buton.onRollOver = function() {
if (!this.released) {
rolloverAction(this.id);
}
};
buton.onRollOut = function() {
if (!this.released) {
rolloutAction(this.id);
}
};
buton.onRelease = function() {
releaseAction(this.id);
for (var j = 1; j<=5; j++) {
var buton = this._parent["buton"+j];
if (buton.released) {
buton.released = false;
rolloutAction(buton.id);
}
}
this.released = true;
};
}
function rolloverAction(n) {
this["txt_"+n].gotoAndPlay("txt_init");
this["disp_"+n].gotoAndStop("disp_init");
}
function rolloutAction(n) {
this["txt_"+n].gotoAndPlay("trans_txt");
this["disp_"+n].gotoAndPlay("trans_disp");
}
function releaseAction(n) {
this["txt_"+n].gotoAndStop("trans_txt");
this["disp_"+n].gotoAndStop("trans_disp");
}
stop();
//[/tt]

Kenneth Kawamoto
 
You are the best!!! You don't know how happy you made me!!!
Thanks a lot!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top