hazdog
hazdog

Reputation: 121

AS3: Call gotoAndStop() on MainTimeline, from document class

I feel like a total goose for having to ask this, it is the final piece of my project and it should be incredibly easy to solve :/ However, having visited many similar questions on here, I can report that no verified answers have solved my issues.

Basically, I want to gotoAndStop(3) on the Main Timeline from within my document class. However, I can't seem to do this.. I have tried both the following, and neither works (both throw different errors)..

var stageRef:Stage;
stageRef = stage;
stageRef.gotoAndStop(3)

Error:

Line 148    1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.

The second method:

var MainTimeline:MovieClip = this.parent as MovieClip;
MainTimeline.gotoAndStop(3);

Error:

Line 148    1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.

Both the solutions were marked as working / correct by other users, but I can't seem to get them to work.. I feel so silly. Any help would be greatly appreciated! Cheers.

Upvotes: 2

Views: 4911

Answers (1)

crooksy88
crooksy88

Reputation: 3851

MovieClip(root).gotoAndStop(3);

Upvotes: 3

Related Questions