-
MovieClip names in variables
Flash MX 2004 Professional
GOAL:
I'm loading a list of filenames from an external file into a variable, then splitting the variable into an array (fileArray) with one filename in each array element.
For each element in the array (fileArray[n]), I need to duplicate a movieClip and load an external JPG (from the array of filenames) into the new movieClip.
PROBLEM:
This is where things start to break. On each iteration, the dynamically generated instance name (jpg1, jpg2, etc.) of the newly duplicated movieClip is stored in a variable (clipName).
I have no problems setting properties on the new movieClip using the variable (clipName._x = 120) instead of the literal movieClip name (jpg1, jpg2, etc.).
However, I cannot assign variables within the new movieClip (clipName.varName = fileArray[n]) or load a JPG into the new movieClip using the variable (clipName.LoadMovie(fileArray[n]) OR loadMovie(fileArray[n],clipName))
SOLUTION:
Any guidance you fine folks can give me on how to solve this problem would be greatly appreciated. I've been tearing my hair out and am now completely bald.
-
Senior Member
Since clipName is a variable referring to the name of the actual movieclip, you'll need to use either eval() or array-style notation (I prefer the latter).
Assuming clipName refers to a movieclip attached to _root, you would use:
_root[clipName]._x = ??;
-
Hey, that worked!
Too bad the online help is so vague about that usage.
Is there someplace in the online documentation that I might have found this information? I searched and searched to no avail.
Thank you so much.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|