Share Posted December 2, 2010 Hi I've got a movie clip on stage with alpha set to 0 (in Flash CS5) and I want to tween it to 0: TweenLite.to(mc, 1, {alpha: 0, onComplete: showMC}); and my problem is that tween is running for 1s (traceing mc.alpha in onUpdate function results always 0) instead of fire onComplete imediatley. Is this a bug or intended action? Link to comment Share on other sites More sharing options...
Share Posted December 3, 2010 That is the intended behavior. If you tell a tween to last 1 second, it will honor that. If it immediately stopped itself and fired its "onComplete" when the start and end values of every property were identical, many people would consider that to be a bug because they may write code that depends on the duration being honored. No tweening engine I know of stops a tween immediately if the start and end values are the same (maybe there are some that I just don't know of). In any case, yes, to answer your question that is the intended behavior. Link to comment Share on other sites More sharing options...
Author Share Posted December 3, 2010 Thanks for the reply. I've made a workaround by setting the code like this: TweenLite.to(mc, (mc.alpha == 0 ? 0 : 1) , {alpha: 0, onComplete: showMC}); maybe it will help someone. It worked in my case. Link to comment Share on other sites More sharing options...
Share Posted December 3, 2010 Hi, I have one movie clip called "mc" (Instance name also "mc")on my form. But I am getting the following error: 1120: Access of undefined property showMC. The following is the code: import com.greensock.*; import com.greensock.easing.*; TweenLite.to(mc, (mc.alpha == 0 ? 0 : 1) , {alpha: 0, onComplete: showMC}); Thanks. Link to comment Share on other sites More sharing options...
Share Posted December 3, 2010 You must have forgotten to write a showMC() function. Your onComplete is pointing to a showMC method, but the error says you don't have one. Link to comment Share on other sites More sharing options...
Share Posted December 3, 2010 Thanks. Just I am watching other users code and trying to see the effect on my demo projects. What code should be there on complete handler to get the effect which he mentioned here? I thought it might be the full working code example without adding any more code. So I tried the same and got error. Thanks. Link to comment Share on other sites More sharing options...
Author Share Posted December 3, 2010 The sample code I've posted above was part o a larger project. There was no need to paste the showMC function . Greensock rocks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now