Skip to main content
Annine_lee
Participant
June 26, 2014
Answered

how to enable a button nested in a movieclip once the playhead enter and stop on a specific frame on the root timeline?

  • June 26, 2014
  • 2 replies
  • 484 views

The button nested in a movieclip has been set to false like this, and code is placed inside the movieclip.

The code on the main timeline:

stage.addEventListener(Event.ENTER_FRAME, enableBtn);

function enableBtn(event:Event):void{

if(currentFrame==21){

  nav_mov.theBtn.mouseEnabled = true;

}

}

The code to set the button to false which is placed in the movieClip

theBtn.mouseEnabled = false;

The movieClip is placed on the main time line.

Thank you very much for your help.

This topic has been closed for replies.
Correct answer kglad

the line of the error: nav_mov.theBtn.mouseEnabled = true;

Thank you!


that doesn't make sense.

create a new fla.  copy and paste your code to frame 1. add a keyframe at frame 21.  add a movieclip (nav_mov) on frame 21.  in frame 1 of nav_mov at a simple button (theBtn).

test.  any problems?

if not, in what relevant way is your original fla different from the one i suggested you create for testing purposes?

2 replies

Annine_lee
Participant
June 27, 2014

Thank you so much for the help!!! I finally found the problem. That's my mistake. I didn't give the instance name for the movie clip: nav_mov. Now the code works fine. Thank you! Have a wonderful weekend!

kglad
Community Expert
Community Expert
June 27, 2014

you're welcome.

p.s. please mark helpful/correct responses.

kglad
Community Expert
Community Expert
June 26, 2014

if the button exists when your code executes, what's the problem?

Annine_lee
Participant
June 26, 2014

Thank you for the reply!  When the swf is running, got the error message 1119: Access of possibly undefined property label through a reference with static type flash.display:SimpleButton.

kglad
Community Expert
Community Expert
June 26, 2014

click file>publish settings>swf and tick 'permit debugging'.  retest.

the line number/timeline/layer of the problematic code will be in the error message.  which line of code is triggering that error?