package gpslab.com.facers{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import gpslab.com.facers.resource.ApplicationConst;
import gpslab.com.facers.resource.ApplicationDTO;
import gpslab.com.facers.resource.EventConst;
import gpslab.com.facers.xmlLoader.XMLDispatcher;
import br.com.stimuli.loading.BulkLoader;
import br.com.stimuli.loading.BulkProgressEvent;
public class Main extends Sprite {
protected var xmlDespatch:XMLDispatcher;
protected var uiEnvironment:UIEnvironment;
protected var bulkInstance:BulkLoader;
private var imageArray:Array;
public function Main() {
trace("START APPLICATION");
ApplicationDTO.ApplicationHeight=stage.stageHeight;
ApplicationDTO.ApplicationWidth=stage.stageWidth;
ApplicationDTO.ApplicationStage=stage;
xmlDespatch=XMLDispatcher.getinstance();
xmlDespatch.configDispatcher(ApplicationConst.XML_FILE_PATH);
xmlDespatch.addEventListener(EventConst.COMPLETE, onXMLReady);
}
protected function onXMLReady(event:Event):void {
ApplicationDTO.BackDrop = xmlDespatch.Backdrop;
ApplicationDTO.Style = xmlDespatch.Style;
ApplicationDTO.TeamArray = xmlDespatch.TeamArray;
ApplicationDTO.StaffArray = xmlDespatch.StaffArray;
uiEnvironment = UIEnvironment.getinstance();
/*imageArray = new Array();
bulkInstance = new BulkLoader("bulkInstance");
bulkInstance.addEventListener(EventConst.COMPLETE, onImagesReady);
bulkInstance.addEventListener(EventConst.PROGRESS, onImageProgress);
bulkInstance.start();
for (var n:int=0; n<xmlDespatch.StaffArray.length; n++) {
bulkInstance.add(ApplicationConst.STAFF_IMAGE_THUMB_FOLDER_PATH + xmlDespatch.StaffArray[n][6]);
imageArray.push(ApplicationConst.STAFF_IMAGE_THUMB_FOLDER_PATH + xmlDespatch.StaffArray[n][6]);
}*/
}
/*protected function onImagesReady(event:Event):void {
for (var i:int=0; i<imageArray.length; i++) {
//trace(imageArray[i]+" : "+i);
var newBitmap:Bitmap = new Bitmap(bulkInstance.getBitmapData(imageArray[i]));
newBitmap.x=stage.stageWidth/2;
newBitmap.y=stage.stageHeight/2;
addChild(newBitmap);
}
}
protected function onImageProgress(event:Event):void {
//trace(event.target.bytesLoaded);
}*/
}
}
package gpslab.com.facers{
import flash.display.*;
import flash.events.*;
import gpslab.com.facers.resource.ApplicationDTO;
public class UIEnvironment extends Sprite {
private static var instance:UIEnvironment;
public static function getinstance() {
if (instance!=null) {
return instance;
} else {
instance = new UIEnvironment();
return instance;
}
}
public function UIEnvironment() {
trace(ApplicationDTO.StaffArray.length);
}
}
}
package gpslab.com.facers.resource{
public class EventConst {
public static const PROGRESS:String = "progress";
public static const COMPLETE:String = "complete";
}
}
package gpslab.com.facers.resource{
public class ApplicationConst {
public static const XML_FILE_PATH:String = "xmlData/staff_profiles.xml";
public static const APPLICATION_IMAGE_FOLDER_PATH:String = "images/appImages/";
public static const STAFF_IMAGE_THUMB_FOLDER_PATH:String = "images/staff/thumb/";
public static const STAFF_PROFILE_IMAGE_FOLDER_PATH:String = "images/staff/profile/";
}
}
package gpslab.com.facers.resource{
public class ApplicationDTO {
public static var ApplicationHeight:Number;
public static var ApplicationWidth:Number;
public static var ApplicationStage:*;
public static var BackDrop:String;
public static var Style:String;
public static var StaffArray:Array;
public static var TeamArray:Array;
}
}