Hello coders,


I've been having mixed results with dynamic movieclip naming. For some reason, using the same code doesn't work each time and I don't know why.

I used to use "eval", but since it's going to be phased out I've been trying more accepted approaches using "this" (instead of "_root").



For example:

// myImageString: usually "image0" or "image"
// myCounter:     to loop through a series

var myMC:String             = (myImageString + myCounter + "_mc");
var myImageHolder:MovieClip = this[myMC];




I'll use the above pair a few different times in my movie. The first time it works fine.


trace(myImageHolder._name+ " width is " +myImageHolder._width);
trace(myImageHolder._name+ " height is " +myImageHolder._height);


image01_mc width is 514
image01_mc height is 120




Later on I reuse the same code, and get different results:


trace ("myImageHolder name is " +myImageHolder._name);
trace ("myImageHolder width is " +myImageHolder._width);


myImageHolder name is image01_mc
myImageHolder width is 0



Help please. What am I doing wrong?

thnx =)

-radley


PS: If there's a typo, it's prolly from a bad copy/paste into this email.


------------------------------------------------------------------------ ------
Radley Marx
[EMAIL PROTECTED]
310.220.4088
http://www.radleymarx.com
------------------------------------------------------------------------ ------




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to