A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [CS3] button over/out (again)

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    16

    [CS3] button over/out (again)

    i know this gets asked a lot of times but i haven't been able to find a solution for my problem using search.

    my button in the 'over' state is a .swf animaton i imported to my stage.
    i'm trying of course to get half of the animation to play while 'over' and half to play when 'out' (not over anymore).
    is this something i will have to code?

  2. #2
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    I'm assuming the imported SWF is in a movieclip. There are two ways of doing this, but I'll recommend this one: Put a stop action in the MC where you want the rollover animation to stop and the rollout animation to start. Also put a stop action on the first frame of the MC. Give the button an instance name of "btn1." Make sure the MC has its own layer inside the button. Make sure the MC's layer only has 1 keyframe: the first frame, and leave it blank for the "hit" frame. Give the MC an instance name of "animation." Now, put these actions on the button:

    on (rollOver) {
    btn1.animation.play();
    }

    on (rollOut) {
    btn1.animation.play();
    }
    If you're still having trouble and have tried what I suggested above, please attach your FLA.

    -Sportzguy933

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    16
    the swf is not a movieclip. i'll try you're method.
    thanks for the help.

  4. #4
    Junior Member
    Join Date
    Nov 2005
    Posts
    16
    oh nevermind, it is a movieclip.
    nice.

  5. #5
    Junior Member
    Join Date
    Nov 2005
    Posts
    16
    Quote Originally Posted by sportzguy933
    Make sure the MC's layer only has 1 keyframe: the first frame, and leave it blank for the "hit" frame.

    -Sportzguy933
    when i open the MC it shows me all of the frames of the animation (its 20 frames).
    based on this i'm now confused and am not sure how these instructions apply.
    Last edited by flashbangdevice; 08-13-2008 at 04:39 PM.

  6. #6
    Junior Member
    Join Date
    Nov 2005
    Posts
    16
    so if i understand this correctly.
    i put a stop in the 1st frame and one in the frame i want to animation to stop (6th frame). this is done inside the MC that is in reality a 20 frame animation.

    the problem i'm having is understanding how my MC only has one keyframe. is this supposed to be an MC within and MC? should one MC have only one keyframe of which contains the other MC?

  7. #7
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    No I meant one keyframe inside of the button.maybe you should try a slightly different method, though:

    Put a stop() action on the tenth frame of the MC. Put the MC on its own layer inside the button, on the "over" state. Then use the code from before.

    Please post your FLA so I can better show you what I mean.

    -Sportzguy933

  8. #8
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    Here's the fixed file (the "pigs" button is fixed). Just let me know if you need help on how to fix the other buttons .

    -Sportzguy933

    Link: http://www.ardesigns.net/fixed file.fla

  9. #9
    Junior Member
    Join Date
    Nov 2005
    Posts
    16
    hey thanks man.
    other than the extra button layers are the two stop()s and giving the button an instance name the only changes you made?
    i can't find any other code.

  10. #10
    Flasher
    Join Date
    Jun 2005
    Posts
    1,365
    One of the stop()'s was because the scenes were looping. But I also added some code on the invisible button.

    -Sportzguy933

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