Hi All
I need help to find depth of one of the movie clips on the stage.
Movie clip exists in flash library and its associated with a class using linkage properties.Its instantiated as below
var atomSmall1:AtomSmall=new AtomSmall();
Mulitple duplicates are created on the screen. I need to find the depth of the movie clip when I click on it. Code given below is the handler for the movie clip.
Below is the code snippet I have used.
private function removeAtoms1(evt:Event):void {
var targetName:String=String(evt.target.name);
trace("Target Name is "+evt.target.name); ///instance120 or keeps changing
var target1:DisplayObject = getChildByName(targetName);
trace(target1) ////Prints NULL
trace("Depth of the atom "+ getChildIndex(target1));
}
Below is the output of trace and error message
Target Name is instance208
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/getChildIndex()
at ChemistryActivity1View/::removeAtoms1()