Jump to content
Search Community

Easing stops after first time

darngooddesign test
Moderator Tag

Recommended Posts

I know this is just down to the way the new software works, I do have the latest version, but what I used to do was.

 

This just sets the initial state of the mc

var initialSetup5:Array = [pullout]
for (var e:uint = 0; e < initialSetup5.length; e++) {
initialSetup5[e].scaleX = .25;
initialSetup5[e].scaleY = .25;
initialSetup5[e].alpha = 0;
initialSetup5[e].visible = false;

 

This does a nice bounce scale up of the mc

btn.addEventListener(MouseEvent.CLICK, onBtn);
function onBtn(evt:MouseEvent):void {
TweenLite.to(pullout, 1, {scaleX:1, scaleY:1, alpha:1, ease:Back.easeOut});
}

 

The close button inside "pullout" scales and hides it.

closeBox.addEventListener(MouseEvent.CLICK, onCloseBox);
function onCloseBox(evt:MouseEvent):void {
TweenLite.to(MovieClip(this), .25, {scaleX:0, scaleY:0, alpha:0});
}

 

The next time I click on the button the scale tweening doesn't display. It waits the 1 second and just jumps to the final state of the tween. This happens to other kinds of tweening, not just scale. So to reiterate, the tweening works the first time only. I was always able to use alpha:0 + visible:false or alpha:1 + visible:true together to control my mcs in the past.

Link to comment
Share on other sites

Could you post a sample FLA that demonstrates the issue? I cannot seem to replicate the problem - it works perfectly for me and I can't imagine why it wouldn't work for you unless there's something else going on in your code. Maybe try creating a separate SUPER simple FLA that just has one button with those actions - see if you can reproduce it that way. If not, there's probably some other problem in your code.

 

Also, you might want to consider using autoAlpha because it'll automatically toggle visible to false when alpha hits 0 and to true when alpha isn't 0. If you're using TweenLite, don't forget to activate the AutoAlphaPlugin first (or just use TweenMax because it's automatically activated internally there).

Link to comment
Share on other sites

The problem is that you're setting visible to false after the first tween. So the alpha is working just fine, but remember that when you define visible:true in a tween, that means it will set the visible property to true at the END of the tween, so you just weren't able to see the alpha fading in because the object's visible property was false. It appeared to pop into existence when visible was set back to true at the end. The simple fix: either set visible to true right before the tween or use autoAlpha which automatically handles that stuff for you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...