Search  

MULTIPLE FUNCTIONS ON ONRELEASE AS2.0 (IS THIS GOOD?)

HomeForumsFlash Discussionmultiple functions on onRelease AS2.0 (is this good?)
47816 detapa
34 posts
Referred at least one person Sold between 1 and 100 dollars Bought between 1 and 9 items

so i looked everywhere for a chunk of code on the net and couldn’t find how to add multple function to onRelease cases of MovieCLips or buttons. than i wrote this. it works. is this any good or there are lots of it’s likes and i’m wastin time?

http://pastie.org/pastes/262669

Posted 2 months ago
38635 flasher3015
382 posts
Exclusive author Author was featured Referred at least one person Sold between 5 000 and 10 000 dollars Bought between 10 and 49 items

Why wouldn’t you just do it like this?

btn.onRelease = function() { myThing(); yourThing(); hisThing(); }

:-/

Posted 2 months ago
47816 detapa
34 posts
Referred at least one person Sold between 1 and 100 dollars Bought between 1 and 9 items

i’m adding and removing functions to the onRelease state dynamically, on run time..? how to do that with that ?

Posted 2 months ago
47816 detapa
34 posts
Referred at least one person Sold between 1 and 100 dollars Bought between 1 and 9 items

////at a place in myCode i came across this…

http://pastie.org/262678

///later i needed to remove the function called canIPlay()..

that’s why…what u think? is t here an easier way?

Posted 2 months ago
38635 flasher3015
382 posts
Exclusive author Author was featured Referred at least one person Sold between 5 000 and 10 000 dollars Bought between 10 and 49 items

btn.onRelease = function() { myThing(); yourThing(); hisThing(); }
When you press the button, those three functions will get executed. If you want to change what functions get executed at runtime, just repeat that sentence above. So if you have something like :
btn.onRelease = function() { myThing(); yourThing(); hisThing(); }
setTimeout(changeFunctions,5000);
function changeFunctions(){
btn.onRelease = function() { myThing(); yourThing(); }
}
When you press the button, three functions get executed. After five seconds, if you press the button again only two of those functions get executed. I think you got my point.

I really like what you did in that script, but i always choose the “easiest” way :D

Posted 2 months ago
47816 detapa
34 posts
Referred at least one person Sold between 1 and 100 dollars Bought between 1 and 9 items

that’s cool:) thnx

Posted 2 months ago
38635 flasher3015
382 posts
Exclusive author Author was featured Referred at least one person Sold between 5 000 and 10 000 dollars Bought between 10 and 49 items

You’re welcome ;) Always remember..when you try to do something new: Think at the most simple things first :D

Posted 2 months ago
47816 detapa
34 posts
Referred at least one person Sold between 1 and 100 dollars Bought between 1 and 9 items

true true…

Posted 2 months ago