1

I'm trying to play a movie clip of a circle expanding and fading away every time a user clicks. I make the movie clip, then I convert it to a movie clip again and create a motion tween making the circle get larger and fade away. But, when I call on the clip it just keeps playing over and over in the last place you click. If I set a stop at the last frame of the tween the next time you click it, it won't play.

fs15secTapBtn.addEventListener(MouseEvent.MOUSE_DOWN, fs15secdownHandler);

function fs15secdownHandler(event:MouseEvent):void
{
circletouch.x = mouseX;
circletouch.y = mouseY;
}

Thanks!

Cory
  • 13
  • 3
  • do you have more of the code to post? what starts/stops the animation? how is the animation run (tween code / timeline / other?) – mfa Jul 15 '13 at 03:40
  • That's all of the code there is pertaining to the movie clip. There is no tween code, I made the movie clip so it has a 15 frame tween inside it. The code I posted above starts it in the location of the mouse just fine. However, it never stops playing the clip unles you put a stop(); at the end of the tween, but then it won't play again the next time you click. fs15secTapBtn is just a movie clip that takes up the whole frame of the stage if that matters. – Cory Jul 15 '13 at 04:02

1 Answers1

0

You need to start/stop the movieclip every time you click. Right now, when you click the first time the clip would be put on stage and playing. Then when you click again, all you're doing is modifying the x and y positions of the clip, which moves the clip to the mouse coords...but the clip itself would still be continuing to be in whatever state it is in during the click (playing on it's own at whatever frame).

Within your click handler add in a circletouch.gotoAndPlay(1); to restart the playing at frame 1. Also, you may want to re-add that stop(); back in so that it'll only play once.

mitim
  • 3,169
  • 5
  • 21
  • 25
  • Is there any way to have the movie clip keep playing if they click again before the clip was done playing? – Cory Jul 15 '13 at 05:27
  • sure, on each click instead of just a straight circletouch.gotoAndPlay(1); you could add in an if statement that checks if the circletouch clip is at the last frame or not, before restarting. Would look like: if(circletouch.currentFrame == circletouch.totalFrmes){ circletouch.gotoAndPlay(1); } This would be assuming you have a stop(); at the end that makes the circletouch clip stay on it's last frame when it is done playing. – mitim Jul 15 '13 at 05:48
  • I tried that out mitim but the movie clip stopped appearing on clicks. I do have the stop(); at the end of the movie clip.I also worded that follow up question poorly. I mean, if you click once and then click again before the end of the first instance playing the clip, it stops playing the clip at the first click location to play it at the new click location. Is there anyway to have the clip play out till the end while a new instance is started on a second click. – Cory Jul 15 '13 at 07:10
  • oh that's what you mean. Yes, you would need to create a new instance of the movieclip within the mouse click handler. Right now you would see only 1 as "circletouch" is referring to the same clip all the time. But also you will most likely want to add something to clean up the previous spawned movieclips as well (-adding an ENTER_FRAME handler on those spawned clips that checks when it is done and removes it from the stage would work for that). – mitim Jul 15 '13 at 07:24