Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
package{ import flash.display.*; import flash.events.*; import flash.text.*; import flash.net.*; import flash.system.Capabilities; dynamic public class preloader extends MovieClip { public var ApplicationLoader:Loader; public var AssetLoader:Loader; public var status_clip:MovieClip; public var bg_clip:MovieClip; public var assets:MovieClip; public var application:MovieClip; public function preloader() { stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; bg_clip = new bg_asset();//located in preloaded fla has anim bg_clip.init(Capabilities.screenResolutionX,Capabilities.screenResolutionY, {"animateOut":true, "onCompleteOut":transistionComplete} ); addChild(bg_clip); status_clip = new status_asset(); //located in preloaded fla status_clip.x =(stage.stageWidth/2)-(status_clip.width/2); status_clip.y =(stage.stageHeight/2)-(status_clip.height/2);; addChild(status_clip); } public function progressHandler(param1:ProgressEvent) : void { var percent:int; percent = Math.round(100 * (param1.bytesLoaded / param1.bytesTotal)); var status_txt:String = "Percent " + percent + "%"; status_clip.drawText(status_txt); } public function transistionComplete() : void { status_clip.drawText("LOADING STYLES"); AssetLoader = new Loader(); AssetLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandlerAsset); AssetLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler); AssetLoader.load(new URLRequest("niceassets.swf") ); } public function completeHandlerAsset(param1:Event) : void { assets = AssetLoader.content as MovieClip; addChildAt(assets ,0); AssetLoader = null; status_clip.drawText("LOADING APPLICATION"); ApplicationLoader = new Loader(); ApplicationLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandlerApp); ApplicationLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler); ApplicationLoader.load(new URLRequest("pureMPCapplication.swf") ); } public function completeHandlerApp(param1:Event) : void { removeChild(status_clip); status_clip=null; application = ApplicationLoader.content as MovieClip; addChildAt(application ,0); ApplicationLoader = null; //at this point pass prams to application including assets //application.init(assets); } }//class}//package
public function load(queryType) :void { this.search(queryType);}
remoteProxy.queryType = "customerQuery";....register proxy with monitor..blah..blah...public function load() :void { this.search();}public function search() :void { query(this.queryType);}
package { import flash.display.MovieClip; import fl.controls.ProgressBar; import fl.controls.ProgressBarMode; import fl.controls.Label; import fl.controls.Button; import flash.display.MovieClip; import fl.controls.List; import fl.data.DataProvider; import app.startupasordered.ApplicationFacade; //test directory location public class startupasordered extends MovieClip //main stage Clip { //private var Assets:MovieClip; static public const NAME:String = "Application"; public var facade:ApplicationFacade; public static const RETRY :String = "retry"; public var watchers:Array; public var notifications:Array = new Array(); public var customerStatus :String = ""; public var productStatus :String = ""; public var salesOrderStatus :String = ""; public var debtorAccountStatus :String = ""; public var invoiceStatus :String = ""; public var overallStatus :String = "..."; public var retryIsVisible :Boolean = false; public var retryIsEnabled :Boolean = false; public var customerStatusLabel :Label; public var productStatusLabel :Label; public var salesOrderStatusLabel :Label; public var debtorAccountStatusLabel :Label; public var invoiceStatusLabel :Label; public var overallStatusLabel :Label; public var retryIsVisibleLabel :Boolean; private var pb:ProgressBar; private var retryBtn:Button; public var notificationsList:List; public function startupasordered() { facade = ApplicationFacade.getInstance(); notifications = new Array(); retryIsVisibleLabel = false; createChildren(); creationComplete(); } private function sendEvent( eventName :String ) :void { dispatchEvent( new Event( eventName )); } public function creationComplete(param1:Event) : void { facade.startup(this); return; } private function createChildren( ) :void { notificationsList = new List(); notificationsList.dataProvider = new DataProvider(notifications); addChild(notificationsList); pb = new ProgressBar(); pb.move(10, 10); pb.mode = ProgressBarMode.MANUAL; addChild(pb); retryBtn = new Button(); retryBtn.move(10, 30); retryBtn.setSize(120, 20); retryBtn.label = RETRY; retryBtn.addEventListener(MouseEvent.CLICK, sendEvent); addChild(retryBtn); customerStatusLabel=new Label(); customerStatusLabel.move(10, 10); customerStatusLabel.text = "Customer Status: "; addChild(customerStatusLabel); productStatusLabel=new Label(); productStatusLabel.move(10, 10); productStatusLabel.text = "Product Status: "; addChild(productStatusLabel); salesOrderStatusLabel=new Label(); salesOrderStatusLabel.move(10, 10); salesOrderStatusLabel.text = "Sales Order Status: "; addChild(salesOrderStatusLabel); debtorAccountStatusLabel=new Label(); debtorAccountStatusLabel.move(10, 10); debtorAccountStatusLabel.text = "Debtor Account Status: "; addChild(debtorAccountStatusLabel); invoiceStatusLabel=new Label(); invoiceStatusLabel.move(10, 10); invoiceStatusLabel.text = "Invoice Status: "; addChild(invoiceStatusLabel); overallStatusLabel=new Label(); overallStatusLabel.move(10, 10); overallStatusLabel.text = "Overall Status: "; addChild(overallStatusLabel); }}//class}//package