A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Button - play on rollover

  1. #1
    Junior Member
    Join Date
    Feb 2002
    Posts
    1
    hay

    i have a button (cool huh?)
    in the over frame i have a mc, which has ofcourse an animation.

    now, when i test the button and rollover, the anim plays. np. but when i rollout the anim stops and the state is up
    but i dont want that, cause that is ugly
    so how can i make a button which plays the whole anim in the over state, no matter how long or short you rollover, just play it full and the stops

    there is probably a very logic solution but i didnt found it...

    tia

  2. #2
    Senior Member
    Join Date
    Jun 2001
    Posts
    2,943
    One way is to have a movie clip with an invisible button in it.

    An invisible button just has a hit state - so it responds to the mouse but you can't see it when the movie runs.

    Create a movie clip with your animation in it.

    Make the first frame of your movie equivalent to your up state, but have a stop() action in it to stop the animation from running.

    In the last frame of your animation, put
    Code:
    gotoAndStop(1);
    .
    In a separate layer (this keeps things neat), place your invisible button and size/position it so it covers the whole animation.

    Put this code on the button:
    Code:
    on(rollover){
    gotoAndPlay(2);
    }
    Now drag an instance of your movie on to the stage and test it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center