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

How do I target an "unnamed" child movieclip inside a "named" parent movieclip?

New Here ,
May 03, 2024 May 03, 2024

Copy link to clipboard

Copied

I'm starting a new post about this to minimize hijacking the original post where I posed the subject question. (https://community.adobe.com/t5/animate-discussions/identify-an-instance-by-the-name/m-p/9319295)

 

My question/problem:

I have a series of "named" movieclips that each contain the same "unnamed" movieclip (on the second frame of the parent MC). I want to play the inner movieclip when a button (targeting the parent MC) is clicked.

 

@JoãoCésar  posted this reply:

You could do something like this:

 

function playInnerMC(e)
{
	e.currentTarget.gotoAndStop(1);
	e.currentTarget.children[0].gotoAndPlay(1);
}

this.parentMC.on("click", playInnerMC);

 

 

I think this is pointing me in the right direction, however I am getting an error in the console...

 

Uncaught TypeError: root[root.pageInstance][root.narrationMovieInstance].children[0].gotoAndPlay is not a function

 

root is a reference to "this" on my main timeline (var root = this;)

 

Could the error be occuring because the parent MC (narrationMovieIntance) contains a text layer "above" the movieclip I want to play?

Since the text is not a movieclip is this causing the "gotoAndPlay" error?

Views

74

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 03, 2024 May 03, 2024

Copy link to clipboard

Copied

my answer to your previous post is the same. you need more info about those movieclips, though we know more now (as3) than before.

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 ,
May 03, 2024 May 03, 2024

Copy link to clipboard

Copied

My current workaround is to give all the child movieclips the same instance name.
Not as nice as I would like but it functions:

root[root.pageInstance][root.narrationMovieInstance].i_text_highlight.gotoAndPlay(1);

 

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 ,
May 03, 2024 May 03, 2024

Copy link to clipboard

Copied

LATEST

glad you have it resolved.

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