PDA

View Full Version : duplicateMovieClip & attachMovie


JohnZ
10-17-2003, 06:13 PM
I'm trying to use attachMovie to assign movie clips to clips I'm making with duplicateMovieClip.

-"ani" is a movie clip which contains a clip called "letters." In the script, ani is incremented by the variable "i".

-"myLetter" is a variable which holds a letter from the variable "text".

-I'm trying to use the variable "myLetter"+i to reference a movie clip of the same letter. For instance, if "myLetter"+i contains the letter "a," I want to use attachMovie to attach movie clip "a" to "ani/letters." (The reason I'm using individual clips for every letter is that the text looks better when its broken apart)

-"letters" is a simple graphic, designated as a movie clip, which is intended to be a placeholder for the attached movie clip.

-"letterInst"+i doesn't exist as a library member; I think it doesn't need to because its an instance name.

_root.ani.duplicateMovieClip("ani"+i, i);
_root["myLetter"+i] = substring(text, i, 1);

ClipID= _root["myLetter"+i];
ContainerID = "_root/ani"+i+"/letters";
ContainerID.attachMovie(ClipID,"letterInst"+i,10);

//When I trace Clip ID I get: a (the letter I'm looking for)
//When I trace ContainerID I get: _root/ani2/letters (incremented correctly)

Is my logic correct here? Right now, the clips I'm creating don't show the movies I'm trying to attach. Please help if you can.

thank you SO MUCH for any help,

JohnZ

pixelwit
10-18-2003, 07:33 PM
Not exactly sure what you're trying to do but since you've gone a while without an answer, I thought I'd post this link to an animated text tutorial (http://www.actionscripts.org/tutorials/intermediate/animating_text_with_actionscript/index.shtml) for you.

If you still need help after looking through the tutorial you might get better results if you post your FLA file.

-PiXELWiT
http://www.pixelwit.com

JohnZ
10-19-2003, 04:56 PM
Thanks for your response. I looked looked at the text animation tutorial, and some of my code is based on it. The difference is that the tutorial uses a text field. I want to use broken apart text, with one movie clip per letter. This would go in the Anim clip, where the clip "letters" is now. (broken apart text looks a little better)

I've included 2 movies. In movetext.fla I attempt to use attachMovie to swap the clip "letters" out of the newly duplicated clip Anim+i. The crucial code is in frame 10.

I realize that I could make a separate "anim" clip for each letter (i.e. anima, animb, etc.) and call these, but this would be difficult to modify if I need to; I would have 26 anim clips rather than one. I've also included a movie which does this, called "alternate.fla"

thanks for any help.

-John