Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Junior Member flashjunky's Avatar
    Join Date
    Apr 2004
    Location
    Clearwater, Florida
    Posts
    23
    Member #
    5645
    Hi all. I have a question about animating buttons. I have two tweens with frame labels for a button, "over" and "restore" triggered by actionscript for the hit area. If I move the mouse to the hit area and keep the mouse there, the animation plays smoothly to the stop() for the "over" tween and when I rollOut of the hit area the "restore" tween plays smoothly to return the button to its original state. If I move the mouse quickly over the button and away before the "over" tween has had a chance to run through all of its frames, the animation is jerked immediately to the "restore" tween and makes the animation just that, jerky. How do I make the animation smooth no matter how fast or slow the mouse is moved in and out of the hit area?
    Thanks in advance for the help!

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You have to make the tween as a SmartClip and use actionScript for your "over" and "out" states that calls a function in the clip that tells it to go to the frame corresponding to the frame in the "over" or "out" part of the naimation relative to the current frame it's on. It's not as hard as it might sound.. if you have problems with it, let me know and I'll get you started.

  4. #3
    Junior Member flashjunky's Avatar
    Join Date
    Apr 2004
    Location
    Clearwater, Florida
    Posts
    23
    Member #
    5645
    Thanks for your generous offer to help Transio! I'm afraid I'm too new to actionscript and Flash to work this out on my own. I seem to remember reading somewhere that SmartClip does not work in Flash MX? I think it was on Macromedia's site. I would very much appreciate any help you can give. Is there a tutorial somewhere that illustrates your solution? Perhaps a source file would also help.
    Thanks again!

  5. #4
    Senior Member
    Join Date
    Mar 2004
    Posts
    241
    Member #
    5465

  6. #5
    Junior Member flashjunky's Avatar
    Join Date
    Apr 2004
    Location
    Clearwater, Florida
    Posts
    23
    Member #
    5645
    Thanks for the tip minger, but I can't follow that tutorial. It seems that the tutorial goes around in circles and the author uses the terms button and clip and movieclip interchangeably. Also it seems that there should be an easier way to do this rather than to create movieclips, copy and paste portions into other movieclips, create hit graphics and then hit buttons. Maybe I'm just dense. I understand the concept but I just can't get it to work by following this particular tutorial. Once I have had a chance to clear my head maybe I can figure it out. Regardless, I appreciate you taking the time to reply and if nothing else the tutorial got me going in a differnet direction. Would you create this type of button for me and post the source file? I'm not sure what it is worth in Turtle Dollars but let me know and I'll be glad to send them your way (I have 20 to work with).
    Thanks again,
    Steve

  7. #6
    Senior Member
    Join Date
    Mar 2004
    Posts
    241
    Member #
    5465
    I forgot to say, this only works if you want the rollOff animation to be the reverse of your rollOn animation, anyways, ill post a source file if I have time tonight (right in the middle of doing a report).
    OK, its kind of an in depth tutorial which is why it may seem to go around in circles. First, he talks about just creating it. Then, he talks about creating the button being the same size as the movie (which requires more work). I would think you just want the rollOn and rollOff animation which is quite easy to do. Just create a MOVIECLIP and tween it or give it whatever animation you want. Make sure to put a stop(); on the first frame. Now go back to your main scene and put the movieclip on the stage. Select the movieclip and add the following actions:
    onClipEvent (enterFrame) {
    if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
    this.nextFrame();
    } else {
    this.prevFrame();
    }
    }
    What this does is on Enter Frame (basically it executes the code at the frame rate of the movie) it checks to see if the mouse is over the movie clip. If it is, then it tells the movieclip to play the next frame. If you keep your mouse on, it will go all the way to the end, otherwise it will start going back towards the first frame...hopefully I'll get done soon and post a .fla

    edit:
    Heres what I came up with real quick:
    http://www.mime.eng.utoledo.edu/~mheminger/button.fla
    It's actually a pretty easy thing to do.
    Note: in order to use it as a button, you will have to put an invisible button over top of it. Hope it helps

  8. #7
    Junior Member flashjunky's Avatar
    Join Date
    Apr 2004
    Location
    Clearwater, Florida
    Posts
    23
    Member #
    5645
    Thanks minger! You're right, it was simple. It seems the tutorial went the long way around but I see the author's point about this code not working if the button is used outside of a Flash page, say in Dreamweaver web page for example. There is no room outside the hit area for the mouse to be detected and the button hangs in the over state. I think I saw something on Flashkit about a button that has code applied within the movieclip that would reverse the animation but I can't find it again. I'll keep searching and post the page once I locate it. Thanks for taking the time to help me with this. I really appreciate it. Would you like some TDs?

  9. #8
    Senior Member
    Join Date
    Mar 2004
    Posts
    241
    Member #
    5465
    TDs??? i don't even know what those are or what theyre used for.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:38 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com