How to access MC inside movieclip added from library?
I have the following code and I followed the answer from this question, but it doesn't seem to be working for me. I'm not getting an error or getting a trace response.
Basically I need to access this test_mc
inside the added child. Am I doing something wrong?
for (var i:int=0; i<30; i++) {
var mc:pa开发者_运维问答nelClass = new panelClass();
all_mc.addChild(mc);
mc.x = allWidth * i;
// Accessing the test mc
mc.test_mc.addEventListener(MouseEvent.CLICK, ctaOnClickHandler);
}
function ctaOnClickHandler(e:MouseEvent) {
trace("Clicked");
}
Kind of hard to answer this without know what panelClass is and how it is built. I'm assuming test_mc is a movieclip that's using all it's default properties and is on the display list of panelClass and since there are no errors it's been instantiated. The only think I can think of is there anything being displayed on top of test_mc inside panelClass?
精彩评论