PDA

View Full Version : Duplicating Movie Question Again!


icebluedesigns
03-26-2003, 11:50 PM
I am trying to dynamically create a number of movie clips depending on the variable "wLength". I want to create the movies inside of another empty movie so that when the creation is complete then I can animate the whole "empty" clip after its "full". ;) THe only part of the following code that I am kinda of worried about because of the fact that the whole code isnt complete and I cant really test it is the attachMovie portion and the dynamically created MCs. If "i" equaled 1 then would the attachMovie function attach a movie clip called "letter1" to cClip_mc and call it "obj1"? I hope that I worded this right so everyone can follow what I am asking. Thanks for your help guys!

FontClass.prototype.creatMovies = function(){
_root.createEmptyMovieClip("cClip_mc",1);
setProperty(_root.cClip_mc, _visible, false);
for(i=0;i<myVars.wLength;i++){
duplicateMovieClip(letters_mc, "letter" add i, 1);
cClip_mc.attachMovie("letter" add i, "obj" add i, 1);
setProperty(cClip_mc.obj add i, _x, (myVars.startPos+(myVars.space*i)));
}
_root.animate();
};

xxlm
03-27-2003, 08:42 AM
There is some problem in your code...
You dupplicate a mc and then want to attach it...
Ok, dupplicate is to dupplicate an existing mc,
attach is to take one from the library and attach it to the scene.

Second, you attach the mc at the same depth. So you will only see the last one, because when attaching at the same depth it remove the older one... In the code i use you "i" var for the depth.

Last, use cClip_mc["letter" add i] to refers the mc letter1 (eg) in the cClip_mc.

So,
Try this:

FontClass.prototype.creatMovies = function(){
_root.createEmptyMovieClip("cClip_mc",1);
setProperty(_root.cClip_mc, _visible, false);
for(i=0;i<myVars.wLength;i++){
cClip_mc.attachMovie(letters_mc, "letter" add i, i);
setProperty(cClip_mc["letter" add i], _x, (myVars.startPos+(myVars.space*i)));
}
_root.animate();
};


Should work (i don't test it).

Hope it helps... Cu ;)