Before posting this query here, I have spent some days searching this site and google. Can't find a solution so, posting it here,
My issue is:
I want to stop AS3 Tween Function.
AS3 Tween is animating a ball which is inside a movieClip. The nested movieClip have all the as3 code.
My Stop button as well as the as3 code to stop is on the main timeline.
AS3 Code on main timeline
ActionScript Code: stop_btn.addEventListener(MouseEvent.CLICK, stopthis);function stopthis(e:MouseEvent):void{ this.mc.stop();}
AS3 Code on nested MovieClip timeline
ActionScript Code: import fl.transitions.*;import fl.transitions.easing.*;import fl.transitions.TweenEvent;var tween:Tween;tween = new Tween(ball_mc, "x", Regular.easeOut, ball_mc.x, ball_mc.x + 100, 4, true);tween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);function onFinish(e:TweenEvent):void{ trace("You just can't stop the Tween"); tween.removeEventListener(TweenEvent.MOTION_FINISH, onFinish);}
Now, the stop_btn stops the nested movieClip from playing, but it doesn't stops the tween.
I know I can move the stop_btn inside the nested movieClip and have the tween.stop(); code added to the stopthis function, but for some reason I don't want to do that. I want to have that button on the main root timeline only.
Please help.
Attached Files issue.zip (10.4 KB)
Stopping a nested movieClip Tween function from root
Saturday, June 9, 2012
[Action Script] Stopping a nested movieClip Tween function from root June,2012
Posted by Bimo Hery Prabowo at 11:13 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment