views:

344

answers:

3

getChildByName('name') will work as long as that child is in the first frame.

+1  A: 

don't use frames, use external files and classes.

jonathanasdf
Thanks, but I have to use frames.
Uzi
what is your reason? I cannot think of any reason whatsoever that would require you to use frames.
jonathanasdf
He didn't ask about frame scripts, but about objects declared in frames..
fenomas
I never was talking about frame scripts.
jonathanasdf
A: 

You cannot access children from frames ahead of the playhead.

But jonathanasdf is right; don't use frame scripts. Ever. (Well, except for maybe the occasional stop()).

Cory Petosky
+1  A: 

Display objects in other frames haven't been instantiated yet, so it's not so much that you can't access them; they aren't there to be accessed. When the playhead passes into a keyframe with a certain object, that object is created and added to the stage, and when the playhead passes into a new keyframe that doesn't have that object, the object is destroyed. So the only way to access the object is to gotoAndStop() to a frame where the object exists on the timeline.

If this causes problems - that is, if you have an object that only appears on the stage at frame 5, and you need to access it in frame 1, try changing your timeline so that the object exists on frame 1 but is offstage or otherwise hidden from view. As long as it exists, you can access it normally, and you can just move it onto the stage in frame 5 or wherever.

fenomas