package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import launcher.background.Background_Main;
    import flash.display.StageAlign;
    import flash.display.StageDisplayState;
    import flash.display.StageQuality;
    import flash.display.StageScaleMode;
    import flash.display.NativeWindow;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.display.Screen;
	import zip.ZIPResourceLoader;
	import dishonestprogressbar.DishonestProgressBar;
	
	/**
	 * ...
	 * @author alekskart
	 */
	public class Main extends Sprite 
	{
		private var guiLayer:Sprite;
		public var background:Background_Main = new Background_Main();
		private var _dishonestProgressBar:DishonestProgressBar;
		private static const ENTRANCE_MODEL_OBJECT_LOADED_EVENT:String = "EntranceModel.objectLoaded";
		
		public function Main() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
			var ziploader:ZIPResourceLoader = new ZIPResourceLoader();
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			this.configureStage();
			this.createGUI();
			this.createDishonestProgressBar();
		}
		
        private function createDishonestProgressBar():void
        {
            this._dishonestProgressBar = new DishonestProgressBar(this.progressBarFinished);
            stage.addChild(this._dishonestProgressBar);
            this._dishonestProgressBar.start();
        }

        private function progressBarFinished():void
        {
            this.removeFromStageDishonestProgressBar();
        }
		
        private function removeFromStageDishonestProgressBar():void
        {
            if (stage.contains(this._dishonestProgressBar))
            {
                stage.removeChild(this._dishonestProgressBar);
            };
        }
		
        private function setCenterPosition() : void
       {
            var appBounds:Rectangle = stage.nativeWindow.bounds;
            var screen:Screen = Screen.getScreensForRectangle(appBounds)[0];
            stage.stageWidth = 1024;
            stage.stageHeight = 670;
            stage.nativeWindow.maxSize = new Point(stage.nativeWindow.width,stage.nativeWindow.height);
            stage.nativeWindow.minSize = new Point(stage.nativeWindow.width,stage.nativeWindow.height);
            stage.nativeWindow.x = (screen.bounds.width - stage.nativeWindow.width) / 2;
            stage.nativeWindow.y = (screen.bounds.height - stage.nativeWindow.height) / 2;
        }
		
        private function configureStage() : void
        {
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.quality = StageQuality.BEST;
            stage.displayState = StageDisplayState.NORMAL;
            stage.stageWidth = 1024;
            stage.stageHeight = 670;
            this.setCenterPosition();
			stage.addEventListener(ENTRANCE_MODEL_OBJECT_LOADED_EVENT, this.onEntranceModelObjectLoaded);
        }
      
		
        private function onEntranceModelObjectLoaded(event:Event):void
        {
            trace("entrance model obj loaded");
            stage.removeEventListener(ENTRANCE_MODEL_OBJECT_LOADED_EVENT, this.onEntranceModelObjectLoaded);
            this._dishonestProgressBar.forciblyFinish();
        }
		
		private function createGUI() : void
		{
			this.guiLayer = new Sprite();
		//this.guiLayer.addChild(this.background);
			addChild(this.guiLayer);
			stage.addEventListener(Event.RESIZE, onResize);
		}
		
        private function onResize(event:Event):void
        {

        }
	}
	
} почему _dishonestProgressBar не появился в сцене