Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jun 26, 2014 Jun 26, 2014

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.

TOPICS
ActionScript
425
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 27, 2014 Jun 27, 2014

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?

Translate
Community Expert ,
Jun 26, 2014 Jun 26, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2014 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2014 Jun 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 26, 2014 Jun 26, 2014

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

Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2014 Jun 27, 2014

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2014 Jun 27, 2014
LATEST
Hong Li (to Hong Li) Less than a minute ago

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 27, 2014 Jun 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2014 Jun 27, 2014

you're welcome.

p.s. please mark helpful/correct responses.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines