Not real children mind you, that seems easy in comparison.
I’m adding movie clips to my stage using addChild. Each movie clip has 15 frames with a stop() on the first and last frame, frame 2 is labeled “play”.
The goal is that the movie clips “animate” when they show up (they appear to dissolve in by playing from frame 2 to 15). Here’s the code I used to make them appear and to play them
ActionScript Code:
[LEFT][COLOR=#808080]//imgPos is a sprite[/COLOR]
imgPos.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];
imgPos.[COLOR=#000080]getChildAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]name[/COLOR] = [COLOR=#ff0000]“childName”[/COLOR];
[COLOR=#0000ff]MovieClip[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
[/LEFT]
That works great for the first movie clip. When I attempt to add more later with the same method the movie clips show up but only the very first movie clip I added animates.
ActionScript Code:
[LEFT][COLOR=#808080]*//adding two more movie clips*[/COLOR]
imgPos.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];
imgPos.[COLOR=#000080]getChildAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]name[/COLOR] = [COLOR=#ff0000]“childName”[/COLOR];
[COLOR=#0000ff]MovieClip[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
imgPos.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];
imgPos.[COLOR=#000080]getChildAt[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]name[/COLOR] = [COLOR=#ff0000]“childName”[/COLOR];
[COLOR=#0000ff]MovieClip[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000ff]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
[/LEFT]
I assume there must be a problem with me trying to name different children the same thing? What is the proper solution if I want to only animate the NEW movie clips?