Reputation: 31254
I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error:
root.play();
"1061: Call to a possibly undefined method play through a reference with static type flash.display:DisplayObjectContainer."
Using the Stage class also doesn't work:
stage.play();
"1061: Call to a possibly undefined method play through a reference with static type flash.display:Stage."
Is there any way to do this?
Upvotes: 2
Views: 7242
Reputation: 16
Another way is separate your movieclip code into separate class while setting document class for your main fla.
Assume the document class of your main fla is Main.as and your movieclip's class file is Movie.as, you can add Main class pointer as parameter in the Movie class constructor
In Main.as
public class Main() {
var m = new Movie(this);
}
In Movie.as
public class Movie(m:Main) { m.gotoAndPlay("somewhere"); }
Upvotes: 0
Reputation: 1094
According to http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=665&threadid=1387264&enterthread=y,
try something like
MovieClip(root).gotoAndPlay("menu");
Good Luck,
Randy Stegbauer
Upvotes: 3