duplicateMovieClip inside another

is it in any way possible to duplicate a movieClip inside another movieClip ?

eg. _root.mClip1.duplicateMovieClip("_root.mClip2.newClip",100);

where mClip1 and mClip2 are already existing movieclips.

and another thing.
for some reason the onData event won’t work in the following piece of code. anyone knows why ?

mClip1.duplicateMovieClip(“mClip2”,100);

eval(“mClip2”).onData = function(){
trace(“blablabla”);
}

John

Hi John,

Assuming you’ve got that code in a movie clip, and that movie clip is loading variables or an external movie, it should work okay if you write:

this.onData = function() {
trace(“blahblahblah”);
}

On the main timeline, you could write:

_root.movieClip.onData = function() {
trace(“blahblahblah”);
}

-Karen

thanx… =)

anyone got a solution to the other problem ? is it possible at all ?

i was trying to do this and was unable to find a solution except that a duplicated clip will be created in the same timeline as the original.

if you can put your original in the same timeline you want the duplicates to appear, you should be all right.

if you find a way to change the timelines, let us know! ; )

if attachmovie will serve your purpose, i think you’ll find it’s a little more flexible.

btw, duplicating a clip won’t fire an onData event, there’s no loading going on, just processing. did you want that code to run after duplication, or are you loading variables into it later on?

yup that’s rite, the onData event is supposed to fire later when i load some
data to the Clip.

but now im confused… the onData event fires properly on my office comp. but for some reason nothing happens at my comp at home. at home i’m runnin XPpro, at the office win98. tough i haven’t tested the same piece of code on both comps. but will do that today. betta not be sum compatibility prob.

last nite i found yet another prob with flash.

scenario:
mClip1 and mClip1.imageClip are existing movieClips where
imageClip are .is a child of mClip1

so lets say i do a

for (i=1; i<=5; i++){
mClip1.imageClip.duplicateMovieClip(“imageClip” add i,i);
eval(“mClip1.imageClip” add i).loadMovie(“whatever.swf”);
}

which would give the following structure

mClip1.imageClip - empty
mClip1.imageClip1 - loaded whatever.swf
mClip1.imageClip2 - loaded whatever.swf
mClip1.imageClip3 - loaded whatever.swf
mClip1.imageClip4 - loaded whatever.swf
mClip1.imageClip5 - loaded whatever.swf

and then later do a
mClip1.duplicateMovieClip(“newClip”,100);

noting gets duplicated… well atleast not the data i just loaded.

now the structure is:
mClip1.imageClip - empty
mClip1.imageClip1 - loaded whatever.swf
mClip1.imageClip2 - loaded whatever.swf
mClip1.imageClip3 - loaded whatever.swf
mClip1.imageClip4 - loaded whatever.swf
mClip1.imageClip5 - loaded whatever.swf
newClip.imageClip - empty

what i’m trying to accomplish is a image “preloader” that
loads all the data i will be using at the beginning.

does anyone know if Flash stores loadMovie data in the cache ?
so the next time i use loadMovie with the same parameters
it will read from the cache instead.

thanx for your comment sbeener, i’ll see what that
attachMovie command can do…

John