action script button events
- Started
- Last post
- 9 Responses
- CyBrain
I have a button that I'd like to consolidate more than one condition. I have onRelease and onReleaseOutside. Here's my script:
scroll_mc.onRelease = function() {
stopDrag();
scrubbing = false;
leaveTime();
}
scroll_mc.onReleaseOutside = function() {
stopDrag();
scrubbing = false;
leaveTime();
}Is there a way to do write this as one block of code instead of two in a way that would list my conditions onRelease and onReleaseOutside in the first line of the function?
- blaw0
- CyBrain0
Interesting, but not only didn't it work, I couldn't find anything on it in Flash's application help.
- CyBrain0
...publishing Flash 8, as2
- StratusGD0
If you don't want to do :
on(release, releaseOutside) {...}, why not just make your code into a function ("pressed") and do:
btn.onRelease = pressed;
btn.onReleaseOutside = pressed;It's still 2 lines instead of 1, but it's at least not repeated code.
- blaw0
Works for me.
Download here:
http://www.brianlaw.org/nt/onrel…
http://www.brianlaw.org/nt/onrel…
- fyoucher10
An even shorter way..
btn1.onReleaseOutside =
btn1.onRelease = function():Void { doThis(); };
- Mishga0
to fyoucher1...you sic fuck!
i click on your website link...
i am still at work...
:SBTW: NSFW!!!
- fyoucher10
Muhahhaha. Gotta love meatspin.
- Mishga0
I thought, well...Fyouchet1 knows about flash...he must have a good portfolio...
and ..DANG!!! Meatspin..:S
* shakes head