Why Won't Flash Read My AS?
Alright well I've been trying for days now to put a preloader in my code. Right now, this is what I am trying:
This is the preloader template that adobe gives you. I have it in frame one on three layers.
stop();
import flash.events.ProgressEvent;
import flash.events.Event;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoading);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onLoading(evt:ProgressEvent):void {
var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
percent_txt.text = (loaded*100).toFixed(0) + "%";
};
function onComplete(event:Event):void {
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoading);
this.loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
gotoAndStop(2);
};
This is my Main class:
//Contructor method in which I can initiate the menu
public function Main()
{
menuLoop();
trace("why hello there!");
}
/*Here I can add buttons. The Play button will pull
the script out of the menu loop and into the game loop*/
public function menuLoop()
{
trace("And how are you today?")
menu.x = 200;
menu.y = 240;
stage.addChild(menu);
playBttn.x = 175;
playBttn.y = 300;
stage.addChild(playBttn);
playBttn.addEventListener(MouseEvent.CLICK, initGame)
}
unfortunately, none of my children actually get added to the screen even though the output displays the friendly conversation I traced.
I have my "Export on frame:" at 2. I have "Default Linkage" set to "merged into code."
I added a second AS frame to the timeline and added "stop();" to the actions. All that did was leave me with a blank screen.
I am so desperate to make this work! Any advice is appreciated





