Can this be done… ?
when could you?
thanks for a solution.
M
Can this be done… ?
when could you?
thanks for a solution.
M
Of course it can be done, it is just like duplicating any other movie clip
But keep in mind your clip will be empty so it won’t do you much good unless you plan on doing something with those clips.
Try this…
_root.createEmptyMovieClip("container", -1);
for (i=0; i<10; i++) {
_root.container.duplicateMovieClip("container"+i, i);
mc = _root["container"+i];
trace(mc);
}
the problem comes into the drawing within an empty movieclip and copying that (in case thats what you meant). I did an example of a kind of workaround for that… but I think it was at were-here so its lost forever
the basic idea, though, was to save the drawing actions within a function and have that function run when you you duplicate a clip. Actually I think I overrided the duplicate prototype and just included in it a check for a ‘creator’ function which was what was associated with a drawn movieclip… if that function existed, it drew the object in the empty clip duplicate so you had a match.
Thanks for the help!!
Actually I would like to populate them with .swf files from an array…
how would I write that;
clipsArray = new Array ();
clipsArray[0] = ???
traced name = example.swf; ???
And then where would it go…
Ermm, I am not sure but that might be CPU intensive.
Untested, but try this…
loadArray = ["clip1.swf", "clip2.swf", "clip3.swf", "clip4.swf"];
_root.createEmptyMovieClip("container", -1);
for (i=0; i<5; i++) {
_root.container.duplicateMovieClip("container"+i, i);
mc = _root["container"+i];
mc.loadMovie(_root.loadArray*);
mc._x = 25*i;
mc._y = 35*i;
trace(mc+": "+mc._x+", "+mc._y);
}
It duplicates the container, then uses loadMovie on the new clip and pulls which .swf file out of the array according to what “i” equals.
then it positions it on the x coordinates every 25 pixels for each clip and 35 pixels for each clip on the y coordinates.
The trace actions lets you see the x,y coordinates of each clip so you see what I mean by 25 pixels x and 35 pixels y
I have a question… why duplicate empty movieclips when you can just create another one? This will keep the confusion down a little since you are using one method consistently (createEmpty) instead of two (createEmpty and duplicate)
Makes sense.
So you mean like this…?
loadArray = ["clip1.swf", "clip2.swf", "clip3.swf", "clip4.swf"];
for (i=0; i<5; i++) {
_root.createEmptyMovieClip("container"+i, i);
mc = _root["container"+i];
mc.loadMovie(_root.loadArray*);
mc._x = 25*i;
mc._y = 35*i;
trace(mc+": "+mc._x+", "+mc._y);
}
yep, pretty much… but I dont know if there was a specific reason for wanting to duplicate or not? milestrap?
Well the reason for Duplicating… is to keep byte size to a minimum.
and then of coarse loading seperate .swf later into those empty clips…
hhmm give me some time to put this to use…
thanks you kids rock…
Well its an empty movie clip, I am pretty sure it won’t effect file size :-\
Keep in mind I am talking about if you are using Flash MX and create empty movie clips dynamically.
yup…
before I would load these .swf files into a holder_mc inside duplicated mc already on stage… but then you had no control over the .swf you just loaded. the _parent clip took presidence. ofcourse you couldn’t remove it cause your .swf would dissapear as well. And I couldn’t find work around. So this is why this question came up.
I’ll need more help…don’t go to far! :cowboy:
Refer to previous post (we posted at the same time)
I have to go now, but I am always around. This is my favorite hangout.
:: Copyright KIRUPA 2024 //--