See pics attached: I have a button(expnd_btn) inside a movieClip(bannerContent), and trying to add a listener to it so it can call code on the main timeline frame2. frame1 has no clips.
bannerContent.expnd_btn.addEventListener(MouseEvent.CLICK,ShowPanel);
It doesn't work inside the MC... but code works if I remove the button and place it on the main stage and ref like below.
expnd_btn.addEventListener(MouseEvent.CLICK,ShowPanel);
Code entirely(main stage):
bannerContent.expnd_btn.addEventListener(MouseEvent.CLICK,ShowPanel);
function ShowPanel(event:MouseEvent){
//do something
}
I dont get an error indicating the listener cant attach to the btn inside the MC... however the btn isnt finding the function outside.
So question: 1. How do you write this differently so it is somewhat FORCED to work. I tried below but it gives errors
function get Expndbtn():MovieClip{return this.getChildByName("expnd_btn") as MovieClip;}
bannerContent.Expndbtn.addEventListener(MouseEvent.CLICK,ClosePanel);
3. Also how do you write _root.callFuction() or say _global.callFunction() in as3.