Reputation: 2536
So I have this movievlip in my library, which is an instance of TestClass
. There are four other movieclips in the parent movieclip. This is TestClass
:
package {
import flash.display.MovieClip;
public class TestClass extends MovieClip{
public function TestClass() {
for(var i:int = 0; i < numChildren; i++){
trace(getChildAt(i));
}
}
}
}
However, this traces null
four times, while it should trace [object MovieClip]
right? Also, when I set the names of the movieclips under the accessibility tab and then use getChildByName('test')
, it still traces null
.
My question is: how can I get specific children from a movieclip in my library? For instance, when there are two children, I only want to get the child with the name test
Upvotes: 0
Views: 1054
Reputation: 6718
Firstly, I tried to reproduce your issue.
TestClass
.In the output tab I see four [object MovieClip]
lines. I don't know why you got null
. Can you provide FLA file?
Why you set a name of child in the accessibility tab? You should set name in the "instance name" of properties panel.
So you can address to child by its name: child_1
in my case. trace(child_1);
returns [object MovieClip]
.
Upvotes: 2