package facers{ import flash.display.; import flash.events.; import flash.net.; import flash.xml.; import flash.filters.BitmapFilter; import flash.filters.BitmapFilterQuality; import flash.filters.BlurFilter; import facers.xmlUtil.XMLDispatcher; import facers.imageloader.imageLoad; import facers.resource.ResourceConstant; import facers.org.CoreEngine; import facers.typeface.TypeCollector; import facers.timer.TimerUtil; import facers.timer.BlurAnimation; import caurina.transitions.Tweener; import caurina.transitions.properties.FilterShortcuts;
public class Main extends Sprite {
private var xmlDespatch:XMLDispatcher;
private var xmlPath:String="xmldata/staff_profiles.xml";
private var core:CoreEngine;
private var typeSet:String="SEE > THINK > CREATE";
private var collectionSet:MovieClip;
private var w:int = 1;
private var faceTimer:TimerUtil;
private var removeClip:MovieClip;
public function Main() {
trace("start facers @ GPS");
xmlDespatch=XMLDispatcher.getinstance();
xmlDespatch.configDispatcher(xmlPath);
xmlDespatch.addEventListener("Finish0", XMLGUILoad);
FilterShortcuts.init();
}
public function XMLGUILoad(event:Event) {
trace("LOAD XML....");
/*trace(xmlDespatch.Backdrop);
trace(xmlDespatch.Style);
for (var i:int=0; i<xmlDespatch.TeamArray.length; i++) {
trace(xmlDespatch.TeamArray[i][1]);
}
for (var n:int=0; n<xmlDespatch.StaffArray.length; n++) {
trace(xmlDespatch.StaffArray[n][1]);
}*/
var backgroundPath:String=ResourceConstant.BACKGROUND_PATH+xmlDespatch.Backdrop;
CreateBackground(backgroundPath);
/*for (var n:int=0; n<xmlDespatch.StaffArray.length; n++) {
}*/
/*core = CoreEngine.getinstance(stage, xmlDespatch.StaffArray);
addChild(core);*/
trace("start typeface application");
collectionSet = new MovieClip();
for (var n:int = 0; n < typeSet.length; n++) {
var _x:int = 0 + (35 * n);
var _y:int = 0;
var Type:TypeCollector = new TypeCollector(_x, _y, stringToCharacter(typeSet, n), collectionSet);
Type.addEventListener("action", actionHandler);
}
var typeSetWidth:int = 35*(typeSet.length+1);
collectionSet.x = (stage.stageWidth / 2) - (typeSetWidth/2);
collectionSet.y = (stage.stageHeight / 2) - 50;
addChild(collectionSet);
}
private function actionHandler(event:Event):void {
if (w == 16) {
//collectionSet.filters = [new BlurFilter(30, 30, BitmapFilterQuality.HIGH)];
//removeChild(collectionSet);
faceTimer = new TimerUtil(2000);
faceTimer.addEventListener("TIME COMPLETED",RemoveTypeSet, false, 0, true);
}
w++;
}
private function RemoveTypeSet(event:Event):void {
Tweener.addTween(collectionSet,{_Blur_blurX:20,_Blur_blurY:20, alpha:0, time:1, onComplete:RemoveChild(collectionSet)});
}
public function stringToCharacter(str:String, n:int):String {
if (str.length == 1) {
return str;
}
return str.slice(n,n + 1);
}
public function RemoveChild(mClip:MovieClip) {
RemoveClip = mClip;
faceTimer = new TimerUtil(500);
faceTimer.addEventListener("TIME COMPLETED",ReCompleted, false, 0, true);
}
public function set RemoveClip(mClip:MovieClip):void {
removeClip=mClip;
}
public function get RemoveClip():MovieClip {
return removeClip;
}
public function ReCompleted(event:Event):void {
removeChild(RemoveClip);
}
public function CreateBackground(path:String) {
var backgroundImage:imageLoad = new imageLoad(path,1,stage.stageWidth,stage.stage.stageHeight,0,0);
addChild(backgroundImage);
}
}
}