Hello World Actionscript not working

81 Views Asked by At

I started to learn action script. I followed in guide by here!

My code is:

Main.as

package {
import org.axgl.Ax;

[SWF(width = "400", height = "300", backgroundColor = "#000000")]

public class Main extends Ax {
    public function Main():void {
        super(GameState);
    }
    }
}

SuperGame.as

package
 {
    import org.axgl.Ax;
    import org.axgl.AxState;
    import org.axgl.render.AxColor;
    import org.axgl.text.AxText;

public class GameState extends AxState {
    override public function create():void {
        Ax.background = new AxColor(0, 0, 0);
        add(new AxText(10, 10, null, "Hello World!"));
    }

    }
}

And the message warning me is:

1120: Access of undefined property GameState. Main.as /Hello World FB/src line 8 Flex Problem

Something was wrong in my code? I'm using Flash Builder 4.6, adobe player debugger 15.0. Thanks for helping me.

1

There are 1 best solutions below

0
On BEST ANSWER

Your code works perfectly for me; I created a new Actionscript project, then copied your code into Main.as and GameState.as.

I notice that your post references "SuperGame.as" -- is your GameState class in that file? If so, either rename the file or change "GameState" into "SuperGame" in both files.