The code below creates new instances of 2 MovieClips, seems all fine.
I have some code that should delete these new instances. It works well for the first created MovieClip. The second MovieClip is not removed.Code:var myOnStageClip:MovieClip = this.text_mc; var myLinkage:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip))); var myDuplicateClip:MovieClip = new myLinkage(); myDuplicateClip.name = "TextElement" + "_Dup"+i; MovieClip(root).container.addChild(myDuplicateClip); var myOnStageClip1:MovieClip = this.drag_mc; var myLinkage1:Class = Class(getDefinitionByName(getQualifiedClassName(myOnStageClip1))); var myDuplicateClip1:MovieClip = new myLinkage1(); myDuplicateClip1.name = "TextController" + "_Dup1"; myDuplicateClip1.drag_mc = myDuplicateClip; MovieClip(root).container.addChild(myDuplicateClip1);
In my example the first trace outputs 9, which is correct. But then there are only 6 outputs in the for statement! 3 are missing which are probably exactly the references to the MovieClip instances in the second part of the first code attachment whci8h are not deleted.Code:trace("childs: "+MovieClip(root).container.numChildren); for(var i:int = 0; i < MovieClip(root).container.numChildren; i++){ var child:DisplayObject = MovieClip(root).container.getChildAt(i); trace(child.name); }
I have no clue what is going on here, apparantly they are childs of the container mc as they are included in the numChildren output but they are not returned in the for statement, neither do I get error messages. Anyone has an idea what is going on here?
Thanks,
Raoul




Reply With Quote