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

how to control main timeline from within a movie clip using javaScript?

Community Beginner ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

Hello,

As background, I am an old AS3 coder and I have not touched code for a few years as I have been waiting for developers to integrate javaScript into Flash.  I do not know javaScript, however I am trying to get up and running with Animate CC using javaScript and HTML5.  My problem is that I want to target the main timeline from within a movie clip and I do not know the syntax to refer to it.  In AS3, the main timeline could be referred to as "root".  This way, if I wanted to control the timeline of an MC from within it, I could say this.gotoAndPlay and if I wanted to control the main timeline from within that MC, I could write root.gotoAndPlay.  I have no problem writing frame actions on either timeline, but how do I have an action on the timeline within an MC refer to the main timeline?

What I am trying to do seems so simple, yet I'm stumped even after searching the interwebs.  I would like to have a movie clip sit on frame one of the main timeline with a stop action on that frame.  When the movieclip's timeline runs its course, i would it to stop and tell the main timeline to move forward to frame two.

How do I refer to the main timeline using javaScript?  Is there an equivalent to root?

Views

2.6K

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

correct answers 1 Correct answer

LEGEND , Apr 20, 2017 Apr 20, 2017

exportRoot

Votes

Translate

Translate
LEGEND ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

exportRoot

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
Adobe Employee ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

In addition to what clayUUID said, see this discussion What is root when converting AS3.0 to Create js? where this topic has been discussed.

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 Beginner ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

LATEST

Thanks for these responses! 

I was successfully able to access the main Animate CC timeline from within an MC using either of these lines of code:

exportRoot.gotoAndPlay();

this.parent.gotoAndPlay();

I see that CreateJS lists all the methods, properties, and events for the Movie Clip Class, however not how to actually employ the code. Can you recommend a resource where I can learn more about incorporating javaScript in Animate CC?

Thanks!

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