DriftingSteps
54 posts
|
;Example – http://megaswf.com/s/2460407
In the above example, you can see a red square and a green circle.
They are placed on two separate layers and tweened inside their own movieclips.
On the root timeline, they span 100 frames.
Now, I want the green circle to stop frame 80, and so I inserted a keyframe on frame 80, and added stop(); but that didn’t stop the animation.
The images can explain better –
Main Timeline: http://prntscr.com/d6ijg
Inside the ‘red’ movieclip: http://prntscr.com/d7w4s
Inside the ‘green’ movieclip: http://prntscr.com/d7wg6
Since the animation inside the movieclip is only 40 frames long, I can’t add stop(); there.
So the question is, how do I stop the animation?
EDIT:
1. I’m using AS3 for the project.
2. Please note that this animation is just an example of something that I’m working on. I must say that the actual animation in which I want this to happen is a bit more complex one, spanning more than 700 frames on the timeline and only about 60 frames inside the movieclip. Thanks :)
|
|
|
Draco18s
6860 posts
|
You’re doing it wrong.
The main timeline should not have the stop command, that stops the main timeline not the circle.
Also, timeline code is layer agnostic. It doesn’t stop the playhead on one layer, it stops it on all layers.
|
|
|
DriftingSteps
54 posts
|
Then how do I stop the animation? It’s very important for the project I’m working for :C
|
|
|
dragon_of_celts
282 posts
|
I’m not really familiar with AS2 (nor do I want to be), so someone can correct me if I’m wrong:
Your movement code for the relevant thing (green circle) should check whether the frame number is below 80 and only move if that is true. Once the frame count increases to 80 or above, it will “automatically” stop, because the condition will be false.
Example:
if (currentframe < 80)
{
greenThing.x += stepsize;
// plus whatever other animation code
}
…something along those lines, anyway. Like I said, I’m not sadomasochistic enough to try AS2.
|
|
|
ErlendHL
1313 posts
|
You could have the two layers in two different MovieClips.
dragon_of_celt I don’t think he’s coding the movement.
|
|
|
Draco18s
6860 posts
|
Originally posted by ErlendHL:
You could have the two layers in two different MovieClips.
dragon_of_celt I don’t think he’s coding the movement.
That’s what he should be doing.
(at least, if he’s going to use frame based animation).
|
|
|
DriftingSteps
54 posts
|
A little more information has been added, if it helps.
The animation that I’m working doesn’t have very simple movements like I’ve shown, though it does loop.
|
|
|
dragon_of_celts
282 posts
|
Wait, you’re using AS3 and the timeline? Why would you do that? Isn’t one of the biggest reasons to move to AS3 from AS2 to get away from the timeline BS?
…At any rate, the idea should still be the same (since you’re still using the timeline), even if the syntax changes a bit…
Originally posted by ErlendHL:
dragon_of_celt I don’t think he’s coding the movement.
I don’t even know what that means. How would he be doing it?
|
|
|
ErlendHL
1313 posts
|
Originally posted by dragon_of_celts:
I don’t even know what that means. How would he be doing it?
Tweening, look it up, “flash tweening”. No code required.
|
|
|
TJEisemann
25 posts
|
If you want to stop it from the main timeline, just replace the animation movieclip with a static movieclip (not animated), when you need to (at frame 80).
|
|
|
dragon_of_celts
282 posts
|
Originally posted by ErlendHL:
Tweening, look it up, “flash tweening”. No code required.
Oh yeah, I read about that a bit some time ago. I thought tweening was coded as well.
|
|
|
Senekis93
4090 posts
|
Originally posted by dragon_of_celts:
Originally posted by ErlendHL:
Tweening, look it up, “flash tweening”. No code required.
Oh yeah, I read about that a bit some time ago. I thought tweening was coded as well.
It can and should in this case, since this is a programming forum.
|
|
|
feartehstickman
521 posts
|
You could use graphic symbols to synchonise all the frame changes.
If you don’t need intereaction with them that is.
|
|
|
DriftingSteps
54 posts
|
I could replace the animated movieclip with a static one when I need it, like TJEisemann said. But the motion has to be perfectly aligned such that there will be a smooth transition from the animated movieclip to the static one.
But I came up with another method without using script.
Thanks a lot everyone for your help :D
|
|
|
kratoskiller4
229 posts
|
Care to share your solution for future Googlers? :P
|