-
Help ... dynamic text in MC
So I'm duplicating movie clips and giving a dynamic text field inside a value based on some XML input. So the following code works:
mcParentClip.duplicateMovieClip("mcChild1", 1);
mcChild1.txtField = "blah blah";
However, I cannot make the following code work:
function myDuplicateClip(num){
varName = "mcChild"+num;
mcParentClip.duplicateMovieClip(varName,num);
eval(varName).txtField = "blah blah";
}
I've tried a few different variations, but nothing's worked... and I've spent 3 hours trying different solutions and researching, etc.. Help would be greatly appreciated!!
-
the code looks ok but you didn't include how you call the function.
eg:
myDuplicateClip(5)
aside from that it could be a path problem depending on which timeline the function is declared.
hope that helps
-
Originally posted by gaz_b
the code looks ok but you didn't include how you call the function.
eg:
myDuplicateClip(5)
aside from that it could be a path problem depending on which timeline the function is declared.
hope that helps
Yeah, you got the calling syntax right. My timelines are straight... I think I'm using the eval function wrong.
-
well eval works differently in MX so maybe that is the problem.
your eval statement :
eval(varName).txtField = "blah blah";
can also be written as:
relative eg:
this[varName].txtField = "blah blah";
or absolute eg:
_root[varName].txtField = "blah blah";
hope that helps
-
Hey thanks a ton. It was really hard to find that information in any reference or tutorials. Thanks for helping me out, even though I'm ot a regular member of this community!
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
|