Cannot get ActionScript 3 to work

112 views Asked by At

I am sorry for posting such a question, but I have just started using Flash (CS5) and I can't seem to get a basic trace to work.

Here is the code:

package  {

    public class Main {

        public function Main() {

            trace("Hello");

        }
    }
}

I have created a new FLA file and saved it in a folder, then I listed Main as the actionscript file that should be linked to the flash file, I also put them in the same folder but when I do (Control -> Test movie -> Test) all i see is a white background without any text on it. Im not sure whats the problem here, is it something to do with including libraries or is there something wrong with the way the script is linked to the flash file.

Thanks in advance.

1

There are 1 answers

5
Bakapii On

Your main class, in this case called Main, needs to extend from flas.display.Sprite. Try changing your class to something like this:

package  {
    import flash.display.Sprite;

    public class Main extends Sprite{
        public function Main() {
            trace("Hello");
        }
    }
}