PDA

View Full Version : Moving through frames using Document class



manojanand
October 5th, 2008, 12:36 PM
Hi guys,

I have a flash file with a couple of frames.

I want to move between them using the Document class.

eg. I have a button on Frame1. When that button is clicked, I want to go to Frame2.

I can do this using the built in ActionScript editor using gotoAndStop (), but if I try to do this using a Document class, I'm unable to do it.

I have searched the Net in vain. Can one of you pros help me?

Thanks!

Smee
October 5th, 2008, 01:30 PM
I am able to do it with a simple document class like:


package
{
import flash.display.MovieClip;

public class Main extends MovieClip
{
public function Main():void
{
gotoAndStop(15);
}
}
}

Are you getting an error, or does it just not work?

If your error is ...


1180: Call to a possibly undefined method gotoAndStop.

... then you need to make sure you're extending MovieClip and not Sprite, as a Sprite only has one frame.

manojanand
October 5th, 2008, 02:44 PM
Thanks a lot!

That worked!