A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Animated Buttons..

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Posts
    2

    Animated Buttons..

    Having some issues with this animated button. I know there are other threads with the same issue but the issue isn't resolved..

    I think I did this correctly.. BUT it still seems to be a bit buggy..
    As with others the original issue was that the animation wouldnt come back to the original state when it was roller over and off quickly..

    I got it to come back but not if you roll over and off it quickly it jumps to the rollover state and animates back to the home state, which causes a jerking..

    I want it to be a smooth transition...
    when you rollover the button it animates from the home state to the rollover state, then if the mouse has been rolled off then it animates back. without skipping any frames..

    PLEASE HELP.. Im running out of hair to pull out!!!
    THANKS!
    k
    Attached Files Attached Files

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    Here you are

    It takes a bit of calculating and trial&error, but I've been using this script in all of my button actions for a while now, and they're all smooth
    Last edited by florianvanthuyn; 07-23-2009 at 07:44 AM.
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Nottingham, England
    Posts
    263
    neat - math makes no sense to me though...?

  4. #4
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    Well, it's always the same principle:

    1st frame: rest-state, just a stop() action
    2nd frame: a label (I always use "over"), a keyframe with the rest-state
    (here comes a tween)
    xth frame: the end-state of the button, stop() action

    Then the same thing, but reversed (so starting with a "out" label), be careful to make the tweens over an equal amount of keyframes!

    then it's always
    Code:
    // Checking if it isn't playing
    if(btn.currentFrame == 1){btn.gotoAndPlay("over");}
    //
    // If it is, then start playing a certain number of frames further
    // equal to the frames that have not been played in the "out" animation
    //
    // The 2 represents the start of the "over" animation, the xx the last keyframe
    // in your btn mc + 1 or 2 (try both of these)
    else{btn.gotoAndPlay(2 + (xx - btn.currentFrame));}
    for the over, and
    Code:
    btn.gotoAndPlay(xx - btn.currentFrame);
    for the out

    (I think I've already removed you're fla ..)
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Nottingham, England
    Posts
    263
    brillant!

    took me a while to get it because in my head, the playhead was reversing. (stress the point "in my head" therefore i know it's not actually doing that!)

    it's just jumping to the equivalent frame in the out section.

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