-
AS3 : Targeting another movie clip to animate
Hi All,
I'm very new to flash.
Can someone tell me how to target to the another movie clip to animate?
I was using code as below but the output is not really correct.
It seemed something is duplicating (I just suppected)
PHP Code:
import flash.display.MovieClip;
var mc_Ripple:MovieClip = new Ripple_Text() ;
mc_Ripple.x = 315;
mc_Ripple.y = 40;
addChild(mc_Ripple);
mc_Ripple.gotoAndPlay(2);
I'm attaching the swf because the fla is too big.
CIA.zip
Thanks
-
newb of many sorts
Assuming Ripple_Text is a class that extends MovieClip, nothing is wrong with the code you posted.
What error message are you receiving?
Search first, asked questions later.
-
Thanks Ralgoth for your reply and help^^
If you downloaded my swf and see you would see the text became weird after 1st jumping and the movie became more and more slow. What was caused this problem?
Last edited by zhixuen; 12-16-2009 at 08:07 PM.
-
newb of many sorts
I can't download your swf from this location (company regulations). I can look at it if you publish it and give a url...
but from your description it sounds like you have this in a loop, and are creating a new instance of the Ripple_Text class each pass.
it looks like your code is in the timeline. If the timeline is playing, and looping, then that would be the cause. You'll need to make sure that the script is only run once. add a trace('new Ripple_Text()'); to the code above and see if it fires more than once.
Search first, asked questions later.
-
If you're in right way. How could I solve this problem?
I was thinking same way as you but I couldn't find the solution to overcome it.
My movie execute the animation in timeline. So It is repeating until I stop the movie.
That's the reason the movie clip keep duplicating in a loop.
Is any web host can publish flash file because I won't publish the flash to internet.
The flash is using for our company carnival presentation.
Thanks :-)
-
newb of many sorts
what you could do, is in the first frame of the timeline, place the code from above. then, instead of letting it loop, add gotoAndPlay(2); on the last frame. that way it won't run the script a 2nd time.
Search first, asked questions later.
-
In fact the AS was placed at the last frame in a classic tween timeline.
The last frame will redirect the animation to another movie clip and execute the animation on targeted movie clip.
I wanted the action above to be repeated.
In AS2 and below we could use TellTarget to achieve it.
Howabout in AS3?
-
Thanks Ralgoth,
I had found the solution by just added a checking for movieclip existance.
That's worked for me.
PHP Code:
import flash.display.MovieClip;
if (mc_Ripple == null ) {
var mc_Ripple:Ripple_Text = new Ripple_Text() ;
mc_Ripple.x = 315;
mc_Ripple.y = 40;
addChild(mc_Ripple);
}
mc_Ripple.gotoAndPlay(2);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|