i am migrating a project from AS2 to AS3 and had a dynamically built menu and submenus like:
item1 | item2 | item3 subitem1-1 | subitem1-2 | subitem1-3 and i used the attachmovie to generate it and to get the main movieclip from the library... for (var i:Number=0; i < menuRecordSet.length; i++) { attachMovie('mc_text', nomeMenu+i, this.getNextHighestDepth(),{_x:mcXleft, _y:mcY}); } i allready managed to make the items using the getDefinitionByName() function, like this: for (var j:Number = 1; j <=5; j++) { var classRef:Class = getDefinitionByName("FlashClasses.MenuItem") as Class; var instance:Object = new classRef(); addChild(instance) instance.x = 100 + (j*12); instance.y = 200; } and this works OK to create the submenuitems, but then i have to remove them when i click on another menuitem and create the new submenuitems. then how do i reference to those instances of the class MenuItem if they are automatically generated? with attachmovie i had a different reference to each one of the subitems and used that reference to remove them from stage and insert them again.