A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Open and close message box using addEventListener

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    26

    Exclamation 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;		
    	}

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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.

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    26
    Quote Originally Posted by 5TonsOfFlax View Post
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center