Hey there, this should be a pretty simple one. I am trying to dynamically generate a movie clip, attach a movie clip from the library and then animate a tween but for some reason, even though the name is being generated dynamically to be different every time and each new MC is put on a different depth, the first movie clip disappears once a new one is generated.
if someone could help me figure this out I would be very grateful!
Here’s my code:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]**function**[/COLOR] moveBall[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]createEmptyMovieClip[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"ball"[/COLOR]+counter, [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]getNextHighestDepth[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR][COLOR=#ff0000]"ball"[/COLOR]+counter[COLOR=#000000]][/COLOR].[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"ball"[/COLOR], [COLOR=#ff0000]"ball"[/COLOR]+counter, [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]getNextHighestDepth[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] myTween:Tween = [COLOR=#000000]**new**[/COLOR] Tween[COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR][COLOR=#ff0000]"ball"[/COLOR]+counter[COLOR=#000000]][/COLOR], [COLOR=#ff0000]"_x"[/COLOR], None.[COLOR=#000080]easeNone[/COLOR], ballStartX, ballDestX, [COLOR=#000080]1[/COLOR], [COLOR=#000000]**true**[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] myTween:Tween = [COLOR=#000000]**new**[/COLOR] Tween[COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR][COLOR=#ff0000]"ball"[/COLOR]+counter[COLOR=#000000]][/COLOR], [COLOR=#ff0000]"_y"[/COLOR], None.[COLOR=#000080]easeNone[/COLOR], ballStartY, ballDestY, [COLOR=#000080]1[/COLOR], [COLOR=#000000]**true**[/COLOR][COLOR=#000000])[/COLOR];
counter++
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
Schm