variable as an instance name
- Started
- Last post
- 3 Responses
- heavyarms
If I set a variable for use in a DuplicateMovieClip loop like clipname+count that would give each a unique name of say clipname1, clipname2 and so on. Why can't I use that variable in the path to change a property on that MC.
like if:
newclip = "clipname"+copy;
why can't I set a property on that new MC using the variable as an instance name for example:
_root.photos.newclip._alpha = 50;
Maybe you can and I'm just making a mistake. Sorry I don't have the code with me.
- unfittoprint0
newclip = "clipname"+copy;
_root.photos[newclip] ._alpha = 50;
- heavyarms0
Thanks a lot. I had never used brackets before. What do they do? Tell Flash it's supposed to be an instance name and not a variable?
- heavyarms0
Something I found:
Using the square brackets tells flash to read the variable as if it were an object.