Copy link to clipboard
Copied
Can anybody guide me on how to control the main root timeline from within a movieclip with HMTL5? I remember doing this years ago with actionscript and I think all I needed to do was add ".root" somewhere and it worked but I'm not sure how to go about it now with HMTL5.
Here's my specific scenario. I have a movieclip on my root timeline. That movieclip has a bunch of frames inside of it that you can flip through by clicking a next button which is also inside that movieclip. When you get to the final frame of the movieclip I want that next button to now take the use to a different point of the main root timeline.
I imagine the code would not be that different from basic timeline navigation but with some addition to specify which timeline I'm referring to but I dunno.
What do you guys think?
Thanks in advance.
Hi.
Animate automatically creates a global variable that refers to the root Movie Clip (main timeline) called exportRoot.
So, for example, you can write...
exportRoot.gotoAndStop(1);
... to send the root Movie Clip to the second frame.
I hope it helps.
Regards,
JC
Copy link to clipboard
Copied
Hi.
Animate automatically creates a global variable that refers to the root Movie Clip (main timeline) called exportRoot.
So, for example, you can write...
exportRoot.gotoAndStop(1);
... to send the root Movie Clip to the second frame.
I hope it helps.
Regards,
JC
Copy link to clipboard
Copied
Oh great! I bet that will work! I'll give it a try. Sorry or the slow response, I never got any notifications of the replies so I didnt' think I'd gotten any answers at first./
Thanks!!!
Copy link to clipboard
Copied
No worries and you're welcome!
Copy link to clipboard
Copied
Thanks so much mate - I love ya x
Copy link to clipboard
Copied
Or you can also store a reference yourself in the main timeline like this:
window.root = this;
Or just:
root = this;
In this way, you are creating a property in the window object that stores a reference to the root Movie Clip (main timeline) called root, that you can access from anywhere in the same window.
Regards,
JC