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

Access button inside of movieclip?

Explorer ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

I'm sure this has been asked and answered plenty of times, but I've been searching off and on for days and haven't found a solution that works.

I have a movieclip that loads inside of a scrollpane when the flash document is published.  Inside of that movieclip are buttons that I want to control the main timeline.  Here is the code that I am using for this:

PipeStr_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopFromFrame);

function fl_ClickToGoToAndStopFromFrame(event:MouseEvent):void

{

    myContent(root).gotoAndStop("PiperStretcher");

}

However, when I go to test everything, I get this error:

"

Scene 1, Layer 'Actions', Frame 1, Line 171120: Access of undefined property PipeStr_btn.

So I'm not sure how to proceed.  I thought about adding the code to the movieclip itself in an actionscript layer, but that's what you would do in AS2.  I like how in AS3, you just have the one layer of actions that control everything.  However, if I need to add AS inside my movieclip, I will.  I'm just not sure what is going on here.  I've been trying different things for days and nothing is working.

TOPICS
ActionScript

Views

1.4K

Translate

Translate

Report

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 ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

myContent(root) makes no sense.

if you're trying to direct the main timeline, use:

MovieClip(root).gotoAndStop(...

Votes

Translate

Translate

Report

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
Explorer ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

Thank you.  And 'my Content' is my movieclip's instance name.  I'm sorry, I should have said that.  I had found a previous post you had made awhile ago and was trying that, but it wasn't working.  But I had just mistyped something when I was trying to type out your code.  So I just copied and pasted, filled in my button's names and movie clip name, and everything worked great.  I should just stick to copying and pasting new code.  Here's what worked:

myContent(scrollPane.content).RetClip_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);

function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void

{

     gotoAndStop(7);

}

Votes

Translate

Translate

Report

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 ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

It helped a lot. Thanks so much 

 

Votes

Translate

Translate

Report

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 ,
Apr 25, 2021 Apr 25, 2021

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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