Share Posted February 9, 2011 Hi, I was trying to make some effect but it doesn't seem to be working that function rect2 wasn't executed. There's an array(rectangle[1], rectangle[2], ...)... this.stage.addEventListener(Event.ENTER_FRAME, rect1); function rect1(e.Event):void { rectangle[1].x = 0; TweenMax.to(rectangle[1], 1, {rotationZ:-180, onComplete:rect2}); } function rect2() { rectangle[2].x = 50; TweenMax.to(rectangle[2], 1, {rotationZ:-180}); } If I replace onComplete with onUpdate, the rectangle[2] will be displayed, but what I wanted was rectangle[2] was created after rectangle[1] finished rotating. Is there any conflict between Tweenmax's onComplete and event listener? Link to comment Share on other sites More sharing options...
Share Posted February 9, 2011 hmm, I don't know what the larger scope of your project is but this is not a good use of ENTER_FRAME. ENTER_FRAME events fire at the rate of your swf's frames per second. Assuming your frame rate is 30fps, what you are doing is is creating a new Tween on the same object rectangle[1] 30 times every second. This is likely to cause many problems and should be rectified before trying to address any other issues. There is no problem using ENTER_FRAME in a project with TweenLite at all, but if you combine the 2 in this manner it is counter productive. if you pull the ENTER_FRAME stuff out and just do: function rect1():void { rectangle[1].x = 0; TweenMax.to(rectangle[1], 1, {rotationZ:-180, onComplete:rect2}); } function rect2() { rectangle[2].x = 50; TweenMax.to(rectangle[2], 1, {rotationZ:-180}); } rectangle[1] will tween and then rectangle[2] will tween as expected. Carl Link to comment Share on other sites More sharing options...
Author Share Posted February 9, 2011 It works! Thanks for help! 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