basic actionscript button action that should be attached directly to a frame on the timeline - NOT to the button itself. this is a slightly more complex version of the 'standard' button action which attaches directly to the button itself. this version has the advantage of allowing you to keep all your actionscript code together in one place on the timeline, rather than having it scattered across all the various elements in your movie.
for this to work, your button must have an instance name. in the code here, my button instance name is "stupidbutton".
this action will NOT work in actionscript 3, which uses "addEventListener" to respond to button events.
make sure you're attaching this action to the timeline and not directly to the button. the actions window should say "actions - frame" when you open it. if it says "actions - button" you're trying to attach this action to the button itself and flash will blow a fuse!
// begin button actions [rollover, rollout and release] // rollover action this.stupidbutton.onRollOver = function() { // replace the trace with your required button actions trace("button rolled over"); }; // end rollover action // rollout action this.stupidbutton.onRollOut = function() { trace("button rolled off"); } // end rollout action // release action this.stupidbutton.onRelease = function() { trace("button pressed"); } // end release action // end button actions [rollover, rollout and release]
You need to login to post a comment.
