Skip to main content
Inspiring
August 10, 2011
Question

AS3 Tween doesn't work proprly

  • August 10, 2011
  • 2 replies
  • 641 views

Hi All,

I have a MovieClip with two buttons inside of it (bottom portion)

When I mouse over the MovieClip - it rises up, to revewl the buttons. My problem is, when I mouse over the buttons, the movie clip drops back down. The buttons don't have any actions upplied to them... It acts as though buttons were standing between the cursor and the movie clip...

The idea is to hower over the movie clip > reveal the buttons > either move mouse away or click on one of the buttons. However, the movie clip closes when I touch either one of the buttons.. Any help would be super appreciated! Below is the code and thnks a bunch ahead of time:

import fl.transitions.Tween;
import fl.transitions.easing.*;

var breatheOpenY:Tween;
var breatheCloseY:Tween;


breathe_mc.addEventListener(MouseEvent.MOUSE_OVER, breatheOpen);
breathe_mc.addEventListener(MouseEvent.MOUSE_OUT, breatheClose);

function breatheOpen(event:MouseEvent):void
{
    breatheOpenY = new Tween(breathe_mc,"y",None.easeNone,117,77,.5,true);
   
    breathe_mc.learn_btn.visible = true;
    breathe_mc.video_btn.visible = true;
}

function breatheClose(event:MouseEvent):void
{
    breatheCloseY = new Tween(breathe_mc,"y",None.easeNone,77,117,.5,true);
   
    breathe_mc.learn_btn.visible = false;
    breathe_mc.video_btn.visible = false;
}

This topic has been closed for replies.

2 replies

Participant
August 11, 2011

I wonder whether adding "breathe_mc.mouseChildren = false;" can help or not.

Inspiring
August 10, 2011

Although I don't know what the problem was, I was able to fix it by using TweenLite instead of Flash native Tween Class;

import com.greensock.*;
import com.greensock.easing.*;


breathe_mc.addEventListener(MouseEvent.MOUSE_OVER, breatheOpen);
breathe_mc.addEventListener(MouseEvent.MOUSE_OUT, breatheClose);

function breatheOpen(event:MouseEvent):void
{
    TweenLite.to(breathe_mc, .5, {y:77});
   
    breathe_mc.learn_btn.visible = true;
    breathe_mc.video_btn.visible = true;
}

function breatheClose(event:MouseEvent):void
{
    TweenLite.to(breathe_mc, .5, {y:117});
   
    breathe_mc.learn_btn.visible = false;
    breathe_mc.video_btn.visible = false;
}

Thanks!!

Lana