I am fairly in-experienced when it comes to Animate, so I am wondering if someone can please help me with an issue I am having.
I have setup a sequence of images and created a movie clip for them. I have then created a button that will play the movie clip symbol. All of this is working but when the clip is played it just loop and starts again. What I am trying to acheive is that once the clip is finished it will go to the next frame.
Is this possible and if so how can it be done?
Hopefully this all make sense, If not I have I have attached some images that will hopefully clarify this.
movieclips loop independently over and over. There are two ways to fix this.
One, is add a stop(); action at the last frame of the MovieClip, and then add a gotoAndPlay(); script under the stop action. But you might have to target the moveiclip or timeline that you are looking to play.
and easier way is to just the behavior type of the MovieClip to "Graphic" then change the looping mode to "play once" then your movieclip will only play once (make sure it is on the timeline for as many frames as in the movieclip, so if movieclip is 30 frames, that MovieClip will need to be displayed for 30 frames on the main timeline so it plays in its entirety), and then move on to play the next frame.
Hope this helps!
Thanks for that. I think I would prefer t ouse the first option as I think it would be more useful in the long term, however I am not sure how I go about targeting the movie clip. At this stage the movie clip symbol called bathroom_1, if I am on the last frame for the clip, what action would I use to then see the scene or frame (timeline)?
You are welcome, glad I was able to help. Both options are good to know. Getting something done quickly is surely important.
You can place a stop action on the last frame of the movieclip, extend it on the main timeline so it is equivalent to the frames within the MC, and then place your new movieclip or whatever in the next frame.
Or via coding (assuming HTML 5 Canvas)
Its a good idea to use a NEW layer and name it "A" or "ACTIONS" - create a new layer on the main timeline and place a stop action on frame 1 "this.stop();" The movieclip will ONLY be on frame 1, the main timeline will stop at Frame 1 and play thru the movieClip. In the movieclip timeline again add a new layer for Actions, and add a keyframe on the last frame of the animation and place this code:
this will stop the MovieClip, and then send the playhead to the Main Timeline(the root timeline) and then go to and Stop on the 3rd frame (frame numbers start at 0,1, 2,3). You can also use "gotoAndPlay(2);" so it plays the timeline, or it can just stop and in frame 3 you can have another animated Movieclip.
I created a small file for you to download and check out MY_EXAMPLE_HERE
Hope this helps!
Thanks again, I feel like I am so close, but missing something
I have attached a link of my file, would you mind having a look?
Basically when I click the button it skips the clip and goes to the 3rd frame.
Your first frame script is this: this.gotoAndStop(2);
it should be: this.gotoAndStop(1);
Something that will speed up testing is to turn off the Export document as texture option in publish settings. You can turn that on again for the final publish, or before uploading a version to your server, but for testing it just adds a lot of time.
without downloading the file I can see the problem. Above I wrote " (frame numbers start at 0,1, 2,3)"
so gotoAndStop(2) will be going to frame 3 (since the first frame is 0, second frame is 1, and third frame is 2... can be confusing. This is why its sometimes best to use labels. Create a new layer and call it "Labels" or "L" and add a keyframe on the frame where you want the playhead to go, click the empty keyframe and in the Properties panel on the left under "Label" you can enter a name for that keyframe.
then your script can be
Hope that helps!
Yusss!!! that worked. thanks so much Mark, those label are going to be handy.
Now I just have to getting it working on the actual final product 🙂
Woo Hoo! Happy to hear that it worked.... can be frustrating trying to work it out, but that's pretty normal for programming. And always feels great when its solved! You are so welcome... and Good work!