A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Tween Class with Button mouseover/mouseout

  1. #1
    Junior Member
    Join Date
    Feb 2009

    Exclamation Tween Class with Button mouseover/mouseout

    Hi guys, I've got the following movie online to look at:
    (disregard background, temporary image)

    I have 3 icons (will be 4, the photos at the bottom of the movie).
    When hovering over a button, it should rise up around 50px, and on mouse out, it should drop back down to its original position.

    If you look at the movie, it does that, however, if you move around the images a bit you'll see that at some points it picks up 2 photos/buttons at a time (since they're overlapping a bit I imagine), but the BIG problem is that sometimes, when picking up both images, they do not return to their original position when mousing OUT as they should, they remain suspended as if they are stuck at the end of the onmouseover function and can't come back down.

    Here is the code I'm using:

    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    var HoverOverWinter:Tween = new Tween
    (WinterBtn, "y", Regular.easeOut, 190, 150, 1, true);
    var HoverOverSpring:Tween = new Tween
    (SpringBtn, "y", Regular.easeOut, 190, 150, 1, true);
    var HoverOverSummer:Tween = new Tween
    (SummerBtn, "y", Regular.easeOut, 190, 150, 1, true);
    WinterBtn.addEventListener(MouseEvent.MOUSE_OVER, OverWinter);
    function OverWinter(e:MouseEvent):void{
    WinterBtn.addEventListener(MouseEvent.MOUSE_OUT, onClickWinter);
    function onClickWinter(e:MouseEvent){
    SpringBtn.addEventListener(MouseEvent.MOUSE_OVER, OverSpring);
    function OverSpring(e:MouseEvent):void{
    SpringBtn.addEventListener(MouseEvent.MOUSE_OUT, onClickSpring);
    function onClickSpring(e:MouseEvent){
    SummerBtn.addEventListener(MouseEvent.MOUSE_OVER, OverSummer);
    function OverSummer(e:MouseEvent):void{
    SummerBtn.addEventListener(MouseEvent.MOUSE_OUT, onClickSummer);
    function onClickSummer(e:MouseEvent){
    Anyone give me an idea how this anomoly is happening and what I can do to fix it?

    Thanks in advance for any help you can give me!

    Last edited by SRQ; 04-03-2009 at 11:15 AM.

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    St. Louis
    While I'm only 90% sure that this will solve all of your headaches (and several thousand more in the future), it's worth a try and will surely help you in the future.

    Go download the TweenMax library (only because it contains everything you could need, including Tweenlite) from Greensock at tweenmax.com.

    Never again use the Adobe tween classes. Not only do the Tweenlite/max classes perform faster than any other tween classes available, they don't have the problem that Adobe is well aware of, yet doesn't seem to want to fix. Every once in awhile, Adobe tweens are mistakenly garbage collected (like when they are still running), and you are left with a halfway-finished tween, and frustrated as hell because the last thing you think is going to actually break are the packaged classes that were actually built with your software.

    I had the same problem 2 years ago, found Tweenlite online, and I've been using them literally everyday since.

  3. #3
    Junior Member
    Join Date
    Feb 2009

    Thumbs up

    Many thanks! I'll go download this and post back if it solves the problem!

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