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?
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.
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);
Copy link to clipboard
Copied
glad you have it resolved.