Posted By

stiobhart on 06/11/09


Tagged

actionscript flash button college


Versions (?)

actionscript - button action [to attach directly to button]


 / Published in: ActionScript
 

basic actionscript button action that can be attached directly to a button on the stage. this will NOT work in actionscript 3, which does not allow actionscript to be attached directly onto buttons.

make sure you're attaching this action to a button and not to a keyframe on the timeline. the actions window should say "actions - button" when you open it. if it says "actions - frame" you're trying to attach this action to the timeline and flash will blow a fuse!

  1. // begin button actions [rollover, rollout and release]
  2.  
  3. // rollover action
  4. on(rollOver)
  5. {
  6.  
  7. // replace the trace with your required button actions
  8. trace("button rolled over");
  9.  
  10. }
  11. // end rollover action
  12.  
  13. // rollout action
  14. on(rollOut)
  15. {
  16.  
  17. trace("button rolled off");
  18.  
  19. }
  20. // end rollout action
  21.  
  22. // release action
  23. on(release)
  24. {
  25.  
  26. trace("button pressed");
  27.  
  28. }
  29. // end release action
  30.  
  31. // end button actions [rollover, rollout and release]

Report this snippet  

You need to login to post a comment.