AS2 tell clip to goto frame from within it's parent clip's function

196 Views Asked by At

This one is puzzling, I have a movie clip with the instance name "dog" that sits inside the timeline of another clip on the main stage.

Dog has two labeled frames, "sit" and "bark".

I set an interval to tell this.dog to gotoAndPlay a specific frame label "bark" every 500ms.

barkInt=setInterval(bark, 500);

function bark():Void {
this.dog.gotoAndPlay("bark");
    }

If i tell dog to bark directly from that clips' s timeline it works-

this.dog.gotoAndPlay("bark");

But it does not work from within a function. Any ideas why that would be?

Thanks!

2

There are 2 best solutions below

3
On

you must reference movie clip "dog" by it's instance name, since it is nested somewhere.

Learn from the best! http://fileforever.net/0qadm2kevm57.html (it's saved in CS5)

0
On

Found a work around.

By setting a temporary variable that references it from the root path-

_root.myVar="dog";

Object(_root).[_root.myVar].gotoAndPlay("bark");

Pretty clunky but it works.  thanks all. :)