Here’s my code:
package
{
import flash.display.MovieClip;
import flash.events.*;
import flash.text.TextField;
public class Main extends MovieClip
{
var bar:Bar=new Bar;
var outLine:Outline=new Outline;
var textField1:TextField=new TextField;
var cat:Cat=new Cat;
public function Main():void
{
bar.x=100;
bar.y=100;
outLine.x=300;
outLine.y=100;
textField1.x=300;
textField1.y=100;
addChild(bar);
addChild(outLine);
addChild(textField1);
this.addEventListener(Event.ENTER_FRAME, preload);
}
public function preload(e:Event):void
{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
bar.scaleX = loaded/total;
textField1.text = Math.floor((loaded/total)*100)+("%");
if (total == loaded)
{
this.removeEventListener(Event.ENTER_FRAME, preload)
playGame();
}
}
public function playGame():void
{
trace("playGame");
removeChild(bar);
removeChild(outLine);
removeChild(textField1);
cat.x=200;
cat.y=200;
addChild(cat);
}
}
}
it all works the progress bar,text and outline are removed but no cat and no error messages.
What could this be???