PDA

View Full Version : [FMX] duplicateMovieClip within a loaded SWF



jahndi
September 15th, 2003, 12:51 PM
Basically, I have an SWF that works fine standalone. However, when I load it into the main movie, it appears that my duplicateMovieClip within the loaded SWF isn't functioning because I only see the first movieclip and not the duplicates. Am I being specific enough? Any help would be appreciated.

~jahndi

Voetsjoeba
September 15th, 2003, 01:06 PM
Can you post the actionscript you used :) ?

jahndi
September 15th, 2003, 04:15 PM
Sure. in the main SWF the movie is called simply by this:

_root.clouds.loadMovie("clouds.swf");

where clouds is the local movieClip that clouds.swf is loaded into.
In clouds.swf, there are two movieclips which are each duplicated several times with this:

for (k = 0; k < 25; k++){
duplicateMovieClip(_root.pCloud, "pCloud" + k, k);

}

for (i = 26; i < 50; i++){
duplicateMovieClip(_root.pCloudB, "pCloudB" + i, i);
}

clouds.swf runs perfect standalone, but when loaded into the main, only the first two cloud movie clips are there (pCloud and pCloudB), none of their duplicates.

Thanks V

Voetsjoeba
September 16th, 2003, 11:44 AM
You used _root.pCloud. Since _root will refer to to the main timeline of the host movie when this swf is loaded into it, it will try to target pCloud in the main movie and not in this movie. So to solve this, use relative addressing :)

Like this for example:



for (k = 0; k < 25; k++){
this._parent.duplicateMovieClip("pCloud"+k, k);
}

=)

dizknee
September 16th, 2003, 12:07 PM
yea .. using _root.whatever in a loaded .swf file will look at the main movie, not in the one u just loaded. just like Voet said, you have to change all _root.whatevers in that .swf that u load into the main swf. Otherwise, it looks to the main swf, instead of the loaded.

VOET .. i sent u a PM .. y no reply .. im still havin trouble with my movieClip problem