Help with timelines

i’m having problems grasping timelines within timelines, so here goes…

new project, i create a circle. i convert this circle to a movie clip. i double click the movie clip. then i edit the graphic (within the movie clip) as follows: i create a 10 frame shape tween. i hit enter and it changes shape nicely.

i go back to the main timeline. hit play, it plays nicely.

now i drag my keyframe on frame one to the third frame. now i have 2 empty frames, and a keyframe on the 3rd frame on the main timeline. hit play, it just flashes from a blank to the shape.
i add the line gotoandplay(3) to the first frame. it still does it. so i add 10 frames to the main timeline. now, it plays nicely.

question is, why did it play alright when the movie clip keyframe was on the first and only frame on the main timeline, whereas when it was on the third frame, it required the extra 10 frames on the main timeline?

thanks for any insight on this!

:slight_smile:
All movieclips in the same fla play at the same speed fps.
If there is only one frame in the main/_root timeline,
the movie just sits there, and any nested clips (ball tween)
keep on playing for as long as needed.
If you move this keyframe to frame 3 without adding a stop()
to that frame, the main timeline plays 123, loops back to 1, plays 123, etc…
But if you then add 10 frames, these 10 frames give the balltween, which is also 10 frames, enough time to finish playing before the main timeline loops back.
Instead of your gotoandPlay, try the stop() on frame 3/main instead, remove the other 10 frames…
Is this a bit clearer? It’s a weird concept at start, with all this nesting, that’s why it’s good to learn some basic AS commands at the same time.

Example: add stop() to frame 1 of ball: it does not play.
add button to the MAIN timeline/ frame 3 (which also has it’s stop() now!), instance name : button_btn.
how to get the ball to play by clicking on the button?
target the ball clip (let’s say instance name = ball_mc) and tell it to play:
[AS]button_btn.onRelease = function(){
ball_mc.play();
} //mx style, so in frame 3, not on the button![/AS]
Now, select the button, hit f8, select clip => you now have a clip with the button inside. first thing, as you’ll need to talk to the clip, select it on stage and give it an instance name, let’s say btnCont_mc.
How to get the AS in frame 3 for the button to work again?
Change the target to accomodate it’s new location: button is now in btnclip, so you get:
[AS]btnCont_mc.button_btn.onRelease = function(){
ball_mc.play();
} [/AS]
Ok, i changed the path to reflect the buttons new location, but the ball doesn’t play!?
Yes, but did you also change the path to ball? ball is NOT in btnCont_mc, where Flash looks for it coz that’s where the button calling the script is, so you have to use:
[AS]btnCont_mc.button_btn.onRelease = function(){
_parent.ball_mc.play(); //one level up
}
//or:
btnCont_mc.button_btn.onRelease = function(){
_root.ball_mc.play(); //ball is in the _root level
}
[/AS]
but you could just as well place this script instead inside btnCont.mc (bad practice!):
[AS] button_btn.onRelease = function(){ //notice “btnCont_mc.” is gone
_root.ball_mc.play(); //still need to go back to _root to get ball!
} [/AS]
Getting clearer? (or more confused… :slight_smile: )
###Bonus:###
Now, if by mistake, you placed button in frame 1 of the main timeline, what happens?
Nothing, coz frame 3 is a keyframe, that means new content from the previous frames, so button will be present in frames 1 and 2 (no keyframe in 2), but not in 3.
Flash elements (buttons, clips, textfields…) can only talk to any other elements present on the timeline at the same time (= in the same frame (not going into functions here…), and as ball exists only from frame 3, no way button, which then doesn’t exist anymore, can talk to it!
So: 1 frame: the clip stays there, nested content plays.
More than 1: need stop() 's where you want it to stop, and then target the stuff you want to play…

Hope this helps.

>Instead of your gotoandPlay, try the stop() on frame 3/main >instead, remove the other 10 frames…
>Is this a bit clearer?

thanks, definitely a bit more clearer now. just for a bit more clarity, does having just one frame on the main timeline incorporate a “built in” stop, or is it just one of those “special cases”?

>Flash elements (buttons, clips, textfields…) can only talk to any >other elements present on the timeline at the same time (= in >the same frame (not going into functions here…), and as ball >exists only from frame 3, no way button, which then doesn’t >exist anymore, can talk to it!

and the above definitely will help me out. does this mean if you put all layers of movie clips in a single frame on the main timeline, they should all be able to target/see eachother despite their having their own timeline framelengths?

thanks again.