0
votes

In an usual flash movie, the document has many scenes. I can add and create scenes as I need (Say I have startingScene, middleScene, and endingScene).

Then, I can assign a Document Class to my movie. The Document Class (say I declare a Main.as class and link it), since it inherits from MovieClip, has a scene attribute.

What's the actual relationship between the Main instance which would be the document, and the current scenes?

Is Main class owner of all scenes? Is a Main instance created for each scene? Who's the owner of the scene list?

1

1 Answers

0
votes

The Document Class is presenting everything you have in the stage so if you have your scene defined in the timeline you can call

this.gotoAndPlay(0, "Scene 2");

Where this is your Main Class Which is something like this

package
{
    import flash.display.MovieClip;
    public class Main extends MovieClip
    {
        // instance variables go here

        public function Main()
        {
             this.gotoAndPlay(0, "Scene 2");
        }  

        // other functions can go here
    }
}

So Main Class is owning the timeline and the stage you have defined in Adobe Flash professional for example if you have a button called myButton in the stage it is part of the Main Class so you can do

myButton.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler( event:MouseEvent ):void
{
//button clicked
}