This content has been marked as final. Show 13 replies
tempPath3 can't possibly be a movieclip reference. it doesn't even look like a movieclip reference. if you used:
tempPath3 = [this + "._clicked"];
that would, at least, look like a movieclip reference, though it's not.
if the movieclip has instance name _clicked and it's on the timeline that contains your code use:
Thanks for your responce. I added some more code for you to look at. Let explain what it is that I am trying to do a little more. I basically want a dynamically created button, that when clicked shows an image, until another button of it heirarchy is clicked. The way I figured I would do this is to create two movie clips. The first would have rollover and on release functionality, and the second's visibility would be controlled by the first. I hope that makes sense. That may be a wonky way of trying to accomplish the effect, but it was all I could think of. What are your thoughts? Thanks for replying!
what is the relationship between _root.main["submenu"+X] and mainmenuX and or mainmenuX_clicked?
mainmenuX is the parent of _root.main["submenu"+X].
mainmenuX_clicked is a sibling of mainmenu and exists on a lower level to appear behind mainmenuX.
Three things happen when mainmenuX is released.
1. A loop statement assigns false to the visibility for all "submenu" and "mainmenuX_clicked" clips.
2. _root.main["submenu"+X] becomes visible.
3. mainmenuX_clicked becomes visible.
That the basic jist of it.
mainmenuX is not the parent of _root.main["submenu"+X].
does menuItemMC contain a child movieclip name "submenu"? does it contain several submenu movieclips like submenu1, submenu2 etc?
does menuRolloverItemMC contain any child movieclips that are relevant?
My apologies, yes you are correct, mainmenuX is not the parent of _root.main["submenu"+X]. It is a sibling as well. In the XML structure (which I am using to populate the menus), it is a parent, but not the flash structure.
menuItemMC does not contain any child movie clips. It is basically a colored rectangle, with a dynamic text field. The way the actionscript works, an empty clip is created and instances of menuRolloverItemMC is placed in that empty clip dynamically populating the menu items.
menuRolloverItemMC does not contain any children either, it is basically a twin of menuItemMC, with a background image at 0% opacity.
I hope that helps. I'm feeling like a nitwit.
menuItemMC is the sibling of _root.main["submenu"+X]? so, clip=main?
I beleive so, yes.
Oh my lord, that works like a dream! Thank you so much! Let me see if I understand what it is here that is going on. Basically you created an object for the two clips called ".ivar" that is re- assigned the for loop is iterated. So this is actually stored in the clip object, and not as an external variable, so when this.ivar is called later, it knows the variable can be called.
What I don't get is why _root.main cannot be stored in the variable, but that is obviously where the rub is, and this technique you did circumvents that issue.
Thank you very much for your help. I appreciate it greatly!
a little more precisely: ivar is property assigned to each of your mainmenu movieclips that makes it easy for those movieclips to determine their own "i" value.
you could also use their _name property and the flash string methods to extract that i value, but it's easier to just assign a property to each movieclip.
this property can be retrieved any time. in particular, when one of your mainmenu movieclips are clicked, it's now easy to make _visible the appropriate mainmenuX_clicked and submenuX movieclips.