/*** ...* @author nGFX* @version 1.0*/package { // skipped imports public class Preloader extends Sprite { public function Preloader() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.showDefaultContextMenu = false; stage.quality = StageQuality.HIGH; trace("init preloader"); this.loaderInfo.addEventListener(Event.INIT, this.initDisplay); this.loaderInfo.addEventListener(Event.COMPLETE, this.initApplication); this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, this.showProgress); } private function initDisplay(e:Event):void { trace("init display"); } private function showProgress (eProgress:ProgressEvent):void { var fPercent:Number = Math.round((eProgress.bytesLoaded / eProgress.bytesTotal ) * 100 ); trace("Loading: " + fPercent.toString()); } private function initApplication (e:Event):void { trace("init application"); this.loaderInfo.removeEventListener(Event.INIT, this.initDisplay); this.loaderInfo.removeEventListener(Event.COMPLETE, this.initApplication); this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, showProgress); trace("loading language") Locale.loadLanguageXML("de", onLanguageFileLoaded); } private function onLanguageFileLoaded (bLoaded:Boolean):void { trace("language done") this.initMenu(); } private function initMenu ():void { // some code here } } }
Disclaimer The opinions expressed herein are our own personal opinions and do not represent our client's views in any way.