Reference main wick from clip

Hi,

I’m trying to steer the main player from within a clip. If I have a normal button, in the main timeline, I can enter a command: gotoAndPlay(1) which wil reset the player head to frame 1. I don’t know how to reference the main player from within a clip. If i enter gotoAndPlay(1) it will move /within/ the clip (makes sense) but I want the main timeline to move… I tried project.gotoAndPlay(1), but that does not work…

regards,

Paul

From what I can understand you want to be able to do something like this,

Project with 2 frames, currently stopped on frame 2,
Clip1 is in the project and contains,
Clip2 which you want to have put the project at frame 1

I tested a few things and you can see if any of them are what you want to happen.
Try commenting out some of the lines of code in the clip on the first frame of the clip in the project.
clips2-17-2022_11-55-46.wick (2.4 KB)

1 Like

Yes! Thank you!

this.parent.parent.parent.parent.gotoAndStop(2);

This was exactly what I was looking for. I tried it with this.parent.gotoAndStop(), but that did not work.
Kinda strange that you would need to go to your great-grandparent to go back to your roots, but I’m glad you already made that journey :laughing:

Would you know why you need these extra steps? How did you find out?

regards,

Paul

1 Like

The reason why you need to use multiple .parent is because it references the direct parent of what you call it from. So when you use this.parent.gotoAndStop() in a clip that’s in a clip what it is referencing is the frame that its in, in the parent clip and this.parent.gotoAndStop() isn’t a function for a frame.

The reason why this.parent.parent.parent.parent.gotoAndStop(2); works is because Wick is
setup something like this
Project / Timeline / Layer / Frame / Clip / Timeline / Layer / Frame / _Clip_
_Clip_ is the clip you are calling the code from so it takes 4 .parent to reach the parent clip to call the gotoAndStop(); function (as far as I know it has to be a clip that you call the function from).

3 Likes

You can also simply use project.

Yes you should be able to if you wanted to change the projects current frame, but if you want to change the clip that’s in the project’s first frame you would need to add several .children[0] or ._children[0]

1 Like

project._children[0].gotoAndStop(2);

project._children[0] is the timeline.