-
Open and close message box using addEventListener
I trying to close a message box with a okay button inside its movieclip but i keep getting "1119: Access of possibly undefined property btnOk through a reference with static type flash.display:SimpleButton." error message when testing. I not sure whats wrong. Below is my code. anyone please help.
Code:
//open message box
btnPassport.addEventListener(MouseEvent.MOUSE_DOWN, btnPassportClicked);
function btnPassportClicked(event:MouseEvent):void {
mcPassport.visible=true;
}
//close message box wiht okay button within the movieclip.
mcPassport.btnOk.addEventListener(MouseEvent.MOUSE_DOWN, mcPassportOkClicked);
function mcPassportOkClicked(event:MouseEvent):void {
mcPassport.visible=false;
}
-
SimpleButton does not have a btnOk property. It looks like mcPassport is a SimpleButton. Are you trying to access a child of mcPassport? If so, you can use getChildbyName. Or, you could change mcPassport to a MovieClip, which is dynamic and flash will create the property corresponding to the child, as you seem to expect.
-
Originally Posted by 5TonsOfFlax
SimpleButton does not have a btnOk property. It looks like mcPassport is a SimpleButton. Are you trying to access a child of mcPassport? If so, you can use getChildbyName. Or, you could change mcPassport to a MovieClip, which is dynamic and flash will create the property corresponding to the child, as you seem to expect.
Oh I see. I'll get what you mean. Thanks!! =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|