/**
* SekatiPreloader
* @version 1.1.1
* @author jason m horwitz | sekati.com
* Copyright (C) 2009 jason m horwitz, Sekat LLC. All Rights Reserved.
* Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
package {
import caurina.transitions.Tweener;
import caurina.transitions.properties.DisplayShortcuts;
import sekati.display.CoreSprite;
import sekati.display.DocumentPreloader;
import sekati.draw.Rect;
import flash.events.Event;
import flash.events.ProgressEvent;
[SWF(width="1075", height="500", frameRate="31", backgroundColor="#FFFFFF")]
/**
* SekatiPreloader
provides an example implementation of DocumentPreloader
for SEKATI API.
* @see sekati.display.DocumentPreloader
*/
public class SekatiPreloader extends DocumentPreloader {
public var container : CoreSprite;
public var bg : Rect;
public var bar : Rect;
/**
* SekatiPreloader Constructor
*/
public function SekatiPreloader() {
super( );
}
/**
* Modify our implementation to add some sequenced UI elements.
*
* @inheritDoc
*/
override protected function initUIIntro() : void {
DisplayShortcuts.init( );
container = new CoreSprite( );
bg = new Rect( 100, 100, 0, 0, 0, 0, 1 );
bar = new Rect( 500, 5, 0, 0, 0, 0xff00ff );
bar.scaleX = 0;
container.alpha = 0;
container.addChildren( bg, bar );
addChild( container );
resize( );
var cb : Function = function():void {
introComplete = true;
};
Tweener.addTween( container, { alpha:1, transition:"easeOutExpo", time:1, onComplete:cb } );
}
/**
* Modify our implementation to remove the UI elements before application handoff.
*
* @inheritDoc
*/
override protected function initUIOutro() : void {
var cb : Function = function() : void {
trace( "The API Application SWF loaded & initialized successfully: Goodbye World!" );
removeChild( container );
outroComplete = true;
};
Tweener.addTween( container, { alpha:0, transition:"easeOutExpo", time:1, onComplete:cb } );
}
/**
* @inheritDoc
*/
override protected function progress(e : ProgressEvent) : void {
super.progress( e );
bar.scaleX = percent;
}
/**
* @inheritDoc
*/
override protected function resize(e : Event = null) : void {
bg.width = stage.stageWidth;
bg.height = stage.stageHeight;
bar.x = int( stage.stageWidth / 2 - 500 / 2 );
bar.y = int( stage.stageHeight / 2 - bar.height / 2 );
}
}
}