Section 1
//BulkErrorEvent (br.com.stimuli.loading.BulkErrorEvent)
package br.com.stimuli.loading {
import flash.events.*;
public class BulkErrorEvent extends Event {
public var name:String;
public var errors:Array;
public static const ERROR:String = "error";
public function BulkErrorEvent(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
this.name = _arg1;
}
override public function toString():String{
return (super.toString());
}
override public function clone():Event{
var _local1:BulkErrorEvent = new BulkErrorEvent(name, bubbles, cancelable);
_local1.errors = (errors) ? errors.slice() : [];
return (_local1);
}
}
}//package br.com.stimuli.loading
Section 2
//BulkLoader (br.com.stimuli.loading.BulkLoader)
package br.com.stimuli.loading {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class BulkLoader extends EventDispatcher {
private var _itemsTotal:int;// = 0
public var speedAvg:Number;
private var _totalWeight:int;// = 0
private var _bytesTotalCurrent:int;// = 0
private var _itemsLoaded:int;// = 0
public var totalTime:Number;
private var lastSpeedCheck:int;
private var _bytesTotal:int;// = 0
private var speedTotal:Number;
private var _loadedRatio:Number;// = 0
private var endTime:int;
private var _speed:Number;
private var startTime:int;
private var _isFinished:Boolean;
private var _name:String;
private var _numConnectons:int;// = 7
private var _contents:Dictionary;
private var _logFunction:Function;
private var _bytesLoaded:int;// = 0
private var lastBytesCheck:int;
private var _connections:Array;
public var logLevel:int;// = 3
private var _percentLoaded:Number;// = 0
private var _weightPercent:Number;
private var _isRunning:Boolean;
private var _id:int;
private var _items:Array;
public var avgLatency:Number;
public static const LOG_INFO:int = 2;
public static const CONTEXT:String = "context";
public static const HTTP_STATUS:String = "httpStatus";
public static const TYPE_VIDEO:String = "video";
public static const CAN_BEGIN_PLAYING:String = "canBeginPlaying";
public static const TYPE_TEXT:String = "text";
public static const ID:String = "id";
public static const PREVENT_CACHING:String = "preventCache";
public static const PAUSED_AT_START:String = "pausedAtStart";
public static const PRIORITY:String = "priority";
public static const TYPE_SOUND:String = "sound";
public static const PROGRESS:String = "progress";
public static const VERSION:String = "rev 88 (0.9.3.1)";
public static const COMPLETE:String = "complete";
public static const MAX_TRIES:String = "maxTries";
public static const TYPE_LOADER:String = "loader";
private static const AVAILABLE_PROPS:Array = [PAUSED_AT_START, WEIGHT, MAX_TRIES, HEADERS, ID, PRIORITY, PREVENT_CACHING, CONTEXT, CAN_BEGIN_PLAYING, "type"];
public static const OPEN:String = "open";
public static const DEFAULT_NUM_CONNECTIONS:int = 7;
public static const LOG_VERBOSE:int = 0;
public static const LOG_SILENT:int = 10;
public static const TYPE_SWF:String = "loader";
public static const HEADERS:String = "headers";
public static const ERROR:String = "error";
public static const LOG_ERRORS:int = 3;
public static const TYPE_IMAGE:String = "loader";
public static const WEIGHT:String = "weight";
public static const TYPE_XML:String = "xml";
static var SOUND_TYPES:Array = ["mp3", "f4a", "f4b"];
static var XML_TYPES:Array = ["xml"];
static var LOADER_TYPES:Array = ["swf", "jpg", "jpeg", "gif", "png", "image"];
static var AVAILABLE_TYPES:Array = ["swf", "jpg", "jpeg", "gif", "png", "flv", "mp3", "xml", "txt", "js"];
static var TEXT_TYPES:Array = ["txt", "js", "xml", "php", "asp", "py"];
private static var allLoaders:Object = {};
private static var _instancesCreated:int = 0;
static var VIDEO_TYPES:Array = ["flv", "f4v", "f4p"];
public function BulkLoader(_arg1:String, _arg2:int=7, _arg3:int=3){
_items = [];
_contents = new Dictionary();
_logFunction = trace;
super();
if (Boolean(allLoaders[_arg1])){
throw (new Error((("BulkLoader with name'" + _arg1) + "' has already been created.")));
};
allLoaders[_arg1] = this;
if (_arg2 > 0){
this._numConnectons = _arg2;
};
this.logLevel = _arg3;
_name = _arg1;
_instancesCreated++;
_id = _instancesCreated;
}
public function get loadedRatio():Number{
return (_loadedRatio);
}
public function removePausedItems():Boolean{
var stoppedLoads:Array = _items.filter(function (_arg1:LoadingItem, ... _args):Boolean{
return ((_arg1.status == LoadingItem.STATUS_STOPPED));
});
stoppedLoads.forEach(function (_arg1:LoadingItem, ... _args):void{
remove(_arg1);
});
loadNext();
return ((stoppedLoads.length > 0));
}
public function loadNow(_arg1):Boolean{
var _local2:LoadingItem;
var _local3:LoadingItem;
if ((_arg1 is LoadingItem)){
_local2 = _arg1;
} else {
_local2 = get(_arg1);
};
if (!_local2){
return (false);
};
if ((((_local2.status == LoadingItem.STATUS_FINISHED)) || ((_local2.status == LoadingItem.STATUS_STARTED)))){
return (true);
};
if (_connections.length >= numConnectons){
_local3 = getLeastUrgentOpenedItem();
removeFromConnections(_local3);
_local3.status = null;
};
_local2._priority = highestPriority;
loadNext(_local2);
return (true);
}
private function removeFromItems(_arg1:LoadingItem):Boolean{
var _local2:int = _items.indexOf(_arg1);
if (_local2 > -1){
_items.splice(_local2, 1);
} else {
return (false);
};
if (_arg1._isLoaded){
_itemsLoaded--;
};
_itemsTotal--;
log(("Removing " + _arg1), LOG_VERBOSE);
return (true);
}
private function getLeastUrgentOpenedItem():LoadingItem{
var _local1:LoadingItem = LoadingItem(_connections.sortOn(["priority", "bytesRemaining"], [Array.NUMERIC, Array.DESCENDING, Array.NUMERIC])[0]);
return (_local1);
}
public function get contents():Object{
return (_contents);
}
public function get id():int{
return (_id);
}
public function getBitmap(_arg1:String, _arg2:Boolean=false):Bitmap{
return (Bitmap(getContentAsType(_arg1, Bitmap, _arg2)));
}
private function removeFromConnections(_arg1):Boolean{
if (!_connections){
return (false);
};
var _local2:int = _connections.indexOf(_arg1);
if (_local2 > -1){
_connections.splice(_local2, 1);
return (true);
};
return (false);
}
public function resume(_arg1):Boolean{
var _local2:LoadingItem = ((_arg1 is LoadingItem)) ? _arg1 : get(_arg1);
if (((_local2) && ((_local2.status == LoadingItem.STATUS_STOPPED)))){
_local2.status = null;
return (true);
};
return (false);
}
public function get isRunning():Boolean{
return (_isRunning);
}
public function getNetStreamMetaData(_arg1:String, _arg2:Boolean=false):Object{
var _local3:NetStream = getNetStream(_arg1, _arg2);
return ((Boolean(_local3)) ? get(_arg1).metaData : null);
}
private function onProgress(_arg1:Event=null):void{
var _local2:BulkProgressEvent = getProgressForItems(_items);
dispatchEvent(_local2);
}
public function get logFunction():Function{
return (_logFunction);
}
private function hasItemInBulkLoader(_arg1, _arg2:BulkLoader):Boolean{
var _local3:LoadingItem = get(_arg1);
if (((_local3) && (_local3._isLoaded))){
return (true);
};
return (false);
}
public function getProgressForItems(_arg1:Array):BulkProgressEvent{
var _local4:*;
_bytesLoaded = (_bytesTotal = (_bytesTotalCurrent = 0));
_weightPercent = 0;
_itemsLoaded = 0;
var _local2:int;
var _local3:Number = 0;
for each (_local4 in _arg1) {
_local4 = ((_local4 is LoadingItem)) ? _local4 : get(_local4);
if (!_local4){
} else {
if ((((((_local4.status == LoadingItem.STATUS_STARTED)) || ((_local4.status == LoadingItem.STATUS_FINISHED)))) || ((_local4.status == LoadingItem.STATUS_STOPPED)))){
_bytesLoaded = (_bytesLoaded + _local4._bytesLoaded);
_bytesTotalCurrent = (_bytesTotalCurrent + _local4._bytesTotal);
_local3 = (_local3 + ((_local4._bytesLoaded / _local4._bytesTotal) * _local4.weight));
if (_local4.status == LoadingItem.STATUS_FINISHED){
_itemsLoaded++;
};
_local2++;
};
};
};
if (_local2 == _items.length){
_bytesTotal = bytesTotalCurrent;
} else {
_bytesTotal = Number.POSITIVE_INFINITY;
};
_weightPercent = (_local3 / totalWeight);
var _local5:BulkProgressEvent = new BulkProgressEvent(PROGRESS);
_local5.setInfo(bytesLoaded, bytesTotal, bytesTotalCurrent, _itemsLoaded, itemsTotal, weightPercent);
return (_local5);
}
public function getContent(_arg1:String, _arg2:Boolean=false){
return (getContentAsType(_arg1, Object, _arg2));
}
public function getSerializedData(_arg1, _arg2:Boolean=false, _arg3:Function=null){
var raw:*;
var parsed:*;
var key = _arg1;
var clearMemory = _arg2;
var encodingFunction = _arg3;
try {
raw = getContentAsType(key, Object, clearMemory);
parsed = encodingFunction.apply(null, [raw]);
return (parsed);
} catch(e:Error) {
log("Failed to parse key:", key, ("with encodingFunction:" + encodingFunction), LOG_ERRORS);
};
return (null);
}
private function isAllDoneP():Boolean{
return (_items.every(function (_arg1:LoadingItem, ... _args):Boolean{
return (_arg1._isLoaded);
}));
}
function log(... _args):void{
var _local2:int = (isNaN(_args[(_args.length - 1)])) ? 3 : int(_args.pop());
if (_local2 >= logLevel){
_logFunction(("[BulkLoader] " + _args.join(" ")));
};
}
public function get speed():Number{
var _local1:int = (getTimer() - lastSpeedCheck);
var _local2:int = ((bytesLoaded - lastBytesCheck) / 0x0400);
var _local3:int = (_local2 / (_local1 / 1000));
lastSpeedCheck = _local1;
lastBytesCheck = bytesLoaded;
return (_local3);
}
public function get bytesLoaded():int{
return (_bytesLoaded);
}
public function getSound(_arg1, _arg2:Boolean=false):Sound{
return (Sound(getContentAsType(_arg1, Sound, _arg2)));
}
public function traceStats():String{
var _local2:LoadingItem;
var _local3:String;
var _local1:Array = [];
_local1.push("\n************************************");
_local1.push((("All items loaded(" + itemsTotal) + ")"));
_local1.push(("Total time(s): " + totalTime));
_local1.push(("Average latency(s): " + int((avgLatency * 1000))));
_local1.push(("Average speed(kb/s): " + truncateNumber(speedAvg)));
_local1.push(("Median speed(kb/s): " + truncateNumber(speedTotal)));
_local1.push(("KiloBytes total:" + truncateNumber((bytesTotal / 0x0400))));
_local1.push("");
for each (_local2 in _items) {
if (_local2._isLoaded){
_local1.push(((((((((("\t- Item url:" + _local2.url.url) + ", total time: ") + _local2.timeToDownload) + ", latency:") + _local2.latency) + ", speed: ") + _local2.speed) + ", kbs total: ") + truncateNumber((_local2.bytesTotal / 0x0400))));
};
};
_local1.push("************************************");
_local3 = _local1.join("\n");
log(_local3, LOG_VERBOSE);
return (_local3);
}
public function removeFailedItems():int{
var numCleared:int;
var badItems:Array = _items.filter(function (_arg1:LoadingItem, ... _args):Boolean{
return ((_arg1.status == LoadingItem.STATUS_ERROR));
});
numCleared = badItems.length;
badItems.forEach(function (_arg1:LoadingItem, ... _args):void{
remove(_arg1);
});
loadNext();
return (numCleared);
}
public function resumeAll():Boolean{
log("Resuming all items", LOG_VERBOSE);
var affected:Boolean;
_items.forEach(function (_arg1:LoadingItem, ... _args):void{
if (_arg1.status == LoadingItem.STATUS_STOPPED){
resume(_arg1);
affected = true;
};
});
loadNext();
return (affected);
}
public function start(_arg1:int=-1):void{
if (_connections){
loadNext();
return;
};
startTime = getTimer();
if (_arg1 > 0){
_numConnectons = _arg1;
};
_connections = [];
var _local2:int = Math.max(_numConnectons, _items.length);
loadNext();
isRunning = true;
lastBytesCheck = 0;
lastSpeedCheck = getTimer();
}
public function get itemsTotal():int{
return (_itemsTotal);
}
private function updateStats():void{
var _local4:LoadingItem;
avgLatency = 0;
speedAvg = 0;
var _local1:Number = 0;
var _local2:int;
speedTotal = 0;
var _local3:int;
for each (_local4 in _items) {
if (((_local4._isLoaded) && (!((_local4.status == LoadingItem.STATUS_ERROR))))){
_local1 = (_local1 + _local4.latency);
_local2 = (_local2 + _local4.bytesTotal);
_local3++;
};
};
speedTotal = ((_local2 / 0x0400) / totalTime);
avgLatency = (_local1 / _local3);
speedAvg = (speedTotal / _local3);
}
public function get highestPriority():int{
var _local2:LoadingItem;
var _local1:int = int.MIN_VALUE;
for each (_local2 in _items) {
if (_local2.priority > _local1){
_local1 = _local2.priority;
};
};
return (_local1);
}
public function set isRunning(_arg1:Boolean):void{
_isRunning = _arg1;
}
public function getBitmapData(_arg1, _arg2:Boolean=false):BitmapData{
var key = _arg1;
var clearMemory = _arg2;
try {
return (getBitmap(key, clearMemory).bitmapData);
} catch(e:Error) {
log("Failed to get bitmapData with url:", key, LOG_ERRORS);
};
return (null);
}
override public function toString():String{
return (((((("[BulkLoader] name:" + name) + ", itemsTotal: ") + itemsTotal) + ", itemsLoaded: ") + _itemsLoaded));
}
public function get numConnectons():int{
return (_numConnectons);
}
public function sortItemsByPriority():void{
_items.sortOn(["priority", "addedTime"], [(Array.NUMERIC | Array.DESCENDING), Array.NUMERIC]);
}
public function set logFunction(_arg1:Function):void{
_logFunction = _arg1;
}
public function get(_arg1):LoadingItem{
var _local2:LoadingItem;
if (!_arg1){
return (null);
};
for each (_local2 in _items) {
if ((((((((_local2._id == _arg1)) || ((_local2.url.url == _arg1)))) || ((_local2.url == _arg1)))) || ((((_arg1 is URLRequest)) && ((_local2.url.url == _arg1.url)))))){
return (_local2);
};
};
return (null);
}
public function get name():String{
return (_name);
}
public function removeAll():void{
var _local1:LoadingItem;
for each (_local1 in _items) {
remove(_local1);
};
delete allLoaders[name];
_items = (_connections = null);
_contents = null;
_items = [];
_contents = new Dictionary();
}
private function onItemStarted(_arg1:Event):void{
var _local2:LoadingItem = (_arg1.target as LoadingItem);
if (_local2.isVideo()){
_contents[_local2.url.url] = _local2.stream;
};
log("Started loading", _local2, LOG_INFO);
dispatchEvent(_arg1);
}
public function get bytesTotal():int{
return (_bytesTotal);
}
public function remove(_arg1):Boolean{
var item:LoadingItem;
var allDone:Boolean;
var key = _arg1;
try {
if ((key is LoadingItem)){
item = key;
} else {
item = get(key);
};
if (!item){
return (false);
};
removeFromItems(item);
removeFromConnections(item);
item.destroy();
item = null;
onProgress();
allDone = isAllDoneP();
if (allDone){
onAllLoaded();
};
return (true);
} catch(e:Error) {
log(("Error while removing item from key:" + key), LOG_ERRORS);
};
return (false);
}
private function onItemError(_arg1:BulkErrorEvent):void{
var evt = _arg1;
var item:LoadingItem = (evt.target as LoadingItem);
log(((("After " + item.numTries) + " I am giving up on ") + item.url.url), LOG_ERRORS);
log("Error loading", item, LOG_ERRORS);
removeFromConnections(item);
var bulkErrorEvent:BulkErrorEvent = new BulkErrorEvent(BulkErrorEvent.ERROR);
bulkErrorEvent.errors = _items.filter(function (_arg1:LoadingItem, ... _args):Boolean{
return ((_arg1.status == LoadingItem.STATUS_ERROR));
});
dispatchEvent(bulkErrorEvent);
}
public function getHttpStatus(_arg1):int{
var _local2:LoadingItem = get(_arg1);
if (_local2){
return (_local2.httpStatus);
};
return (-1);
}
public function add(_arg1, _arg2:Object=null):LoadingItem{
var _local4:String;
_arg2 = ((_arg2) || ({}));
if ((_arg1 is String)){
_arg1 = new URLRequest(_arg1);
if (_arg2[HEADERS]){
_arg1.requestHeaders = _arg2[HEADERS];
};
} else {
if ((!(_arg1) is URLRequest)){
throw (new Error(("[BulkLoader] cannot add object with bad type for url:'" + _arg1.url)));
};
};
var _local3:LoadingItem = get(_arg1);
if (_local3){
return (_local3);
};
_local3 = new LoadingItem(_arg1, _arg2["type"]);
log("Added", _local3, LOG_VERBOSE);
_local3.preventCache = _arg2[PREVENT_CACHING];
_local3._id = _arg2[ID];
_local3._priority = ((int(_arg2[PRIORITY])) || (0));
_local3.maxTries = ((_arg2[MAX_TRIES]) || (3));
_local3.weight = ((int(_arg2[WEIGHT])) || (1));
_local3.context = ((_arg2[CONTEXT]) || (null));
_local3.pausedAtStart = ((_arg2[PAUSED_AT_START]) || (false));
for (_local4 in _arg2) {
if (AVAILABLE_PROPS.indexOf(_local4) == -1){
log(((("add got a wrong property name: " + _local4) + ", with value:") + _arg2[_local4]));
};
};
_local3._addedTime = getTimer();
_local3.addEventListener(Event.COMPLETE, onItemComplete, false, int.MIN_VALUE, true);
_local3.addEventListener(ERROR, onItemError, false, 0, true);
_local3.addEventListener(Event.OPEN, onItemStarted, false, 0, true);
_local3.addEventListener(ProgressEvent.PROGRESS, onProgress, false, 0, true);
_items.push(_local3);
_itemsTotal = (_itemsTotal + 1);
_totalWeight = (_totalWeight + _local3.weight);
sortItemsByPriority();
_isFinished = false;
return (_local3);
}
public function getText(_arg1, _arg2:Boolean=false):String{
return (String(getContentAsType(_arg1, String, _arg2)));
}
public function get bytesTotalCurrent():int{
return (_bytesTotalCurrent);
}
public function getAVM1Movie(_arg1:String, _arg2:Boolean=false):AVM1Movie{
return (AVM1Movie(getContentAsType(_arg1, AVM1Movie, _arg2)));
}
public function get percentLoaded():Number{
return (_percentLoaded);
}
public function get weightPercent():Number{
return (_weightPercent);
}
private function getContentAsType(_arg1, _arg2:Class, _arg3:Boolean=false){
var res:*;
var key = _arg1;
var type = _arg2;
var clearMemory = _arg3;
var item:LoadingItem = get(key);
if (!item){
return (null);
};
try {
if (((item._isLoaded) || (item.isStreamable()))){
res = (item.content as type);
if (res == null){
throw (new Error("bad cast"));
};
if (clearMemory){
remove(key);
};
return (res);
};
} catch(e:Error) {
log((("Failed to get content with url: '" + key) + "'as type:"), type, LOG_ERRORS);
};
return (null);
}
public function get isFinished():Boolean{
return (_isFinished);
}
public function changeItemPriority(_arg1:String, _arg2:int):Boolean{
var _local3:LoadingItem = get(_arg1);
if (!_local3){
return (false);
};
_local3._priority = _arg2;
sortItemsByPriority();
return (true);
}
public function get items():Array{
return (_items.slice());
}
public function getNetStream(_arg1:String, _arg2:Boolean=false):NetStream{
return (NetStream(getContentAsType(_arg1, NetStream, _arg2)));
}
private function set itemsLoaded(_arg1:int):void{
_itemsLoaded = _arg1;
}
public function pauseAll():void{
var _local1:LoadingItem;
for each (_local1 in _items) {
pause(_local1);
};
isRunning = false;
log("Stopping all items", LOG_INFO);
}
public function hasItem(_arg1, _arg2:Boolean=true):Boolean{
var _local3:*;
var _local4:BulkLoader;
if (_arg2){
_local3 = allLoaders;
} else {
_local3 = [this];
};
for each (_local4 in _local3) {
if (hasItemInBulkLoader(_arg1, _local4)){
return (true);
};
};
return (false);
}
public function get totalWeight():int{
return (_totalWeight);
}
public function getNotLoadedItems():Array{
return (_items.filter(function (_arg1:LoadingItem, ... _args):Boolean{
return (!((_arg1.status == LoadingItem.STATUS_FINISHED)));
}));
}
public function getXML(_arg1, _arg2:Boolean=false):XML{
return (XML(getContentAsType(_arg1, XML, _arg2)));
}
public function get itemsLoaded():int{
return (_itemsLoaded);
}
private function onAllLoaded():void{
if (_isFinished){
return;
};
var _local1:BulkProgressEvent = new BulkProgressEvent(COMPLETE);
_local1.setInfo(bytesLoaded, bytesTotal, bytesTotalCurrent, _itemsLoaded, itemsTotal, weightPercent);
var _local2:BulkProgressEvent = new BulkProgressEvent(PROGRESS);
_local2.setInfo(bytesLoaded, bytesTotal, bytesTotalCurrent, _itemsLoaded, itemsTotal, weightPercent);
isRunning = false;
endTime = getTimer();
totalTime = BulkLoader.truncateNumber(((endTime - startTime) / 1000));
updateStats();
_connections = [];
traceStats();
_isFinished = true;
log("Finished all", LOG_INFO);
dispatchEvent(_local2);
dispatchEvent(_local1);
}
public function getMovieClip(_arg1:String, _arg2:Boolean=false):MovieClip{
return (MovieClip(getContentAsType(_arg1, MovieClip, _arg2)));
}
private function onItemComplete(_arg1:Event):void{
var _local2:LoadingItem = (_arg1.target as LoadingItem);
removeFromConnections(_local2);
log("Loaded ", _local2, LOG_INFO);
log("Items to load", getNotLoadedItems(), LOG_VERBOSE);
_local2.cleanListeners();
_contents[_local2.url.url] = _local2.content;
var _local3:Boolean = loadNext();
var _local4:Boolean = isAllDoneP();
_itemsLoaded++;
if (_local4){
onAllLoaded();
};
}
public function pause(_arg1, _arg2:Boolean=false):Boolean{
var _local3:LoadingItem = ((_arg1 is LoadingItem)) ? _arg1 : get(_arg1);
if (!_local3){
return (false);
};
_local3.stop();
var _local4:Boolean = removeFromConnections(_local3);
if (_arg2){
loadNext();
};
return (_local4);
}
private function loadNext(_arg1:LoadingItem=null):Boolean{
var checkItem:LoadingItem;
var toLoad = _arg1;
if (_isFinished){
return (false);
};
_connections.forEach(function (_arg1:LoadingItem, ... _args):void{
if ((((_arg1.status == LoadingItem.STATUS_ERROR)) && ((_arg1.numTries < _arg1.maxTries)))){
removeFromConnections(_arg1);
};
});
var next:Boolean;
if (!toLoad){
for each (checkItem in _items) {
if (((!(checkItem._isLoading)) && (!((checkItem.status == LoadingItem.STATUS_STOPPED))))){
toLoad = checkItem;
break;
};
};
};
if (toLoad){
next = true;
isRunning = true;
if (_connections.length < numConnectons){
_connections.push(toLoad);
toLoad.load();
log("Will load item:", toLoad, LOG_INFO);
};
if (_connections.length < numConnectons){
loadNext();
};
};
return (next);
}
public static function pauseAllLoaders():void{
var _local1:BulkLoader;
for each (_local1 in allLoaders) {
_local1.pauseAll();
};
}
public static function removeAllLoaders():void{
var _local1:BulkLoader;
for each (_local1 in allLoaders) {
_local1.removeAll();
delete allLoaders[_local1.name];
_local1 = null;
};
allLoaders = null;
}
public static function whichLoaderHasItem(_arg1):BulkLoader{
var _local2:BulkLoader;
for each (_local2 in allLoaders) {
if (_local2.hasItemInBulkLoader(_arg1, _local2)){
return (_local2);
};
};
return (null);
}
public static function getLoader(_arg1:String):BulkLoader{
return ((BulkLoader.allLoaders[_arg1] as BulkLoader));
}
public static function truncateNumber(_arg1:Number, _arg2:int=2):Number{
var _local3:int = Math.pow(10, _arg2);
return ((Math.round((_arg1 * _local3)) / _local3));
}
public static function registerNewType(_arg1:String, _arg2:String):Boolean{
var _local3:Array;
if (_arg1.charAt(0) == "."){
_arg1 = _arg1.substring(1);
};
var _local4:Object = {TYPE_LOADER:LOADER_TYPES, TYPE_VIDEO:VIDEO_TYPES, TYPE_SOUND:SOUND_TYPES, TYPE_TEXT:TEXT_TYPES};
_local3 = _local4[_arg2];
if (((_local3) && ((_local3.indexOf(_arg1) == -1)))){
_local3.push(_arg1);
return (true);
};
return (false);
}
}
}//package br.com.stimuli.loading
Section 3
//BulkProgressEvent (br.com.stimuli.loading.BulkProgressEvent)
package br.com.stimuli.loading {
import flash.events.*;
public class BulkProgressEvent extends ProgressEvent {
public var bytesTotalCurrent:int;
public var itemsTotal:int;
public var itemsLoaded:int;
public var name:String;
public var weightPercent:Number;
public var ratioLoaded:Number;
public var percentLoaded:Number;
public static const COMPLETE:String = "complete";
public static const PROGRESS:String = "progress";
public function BulkProgressEvent(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
this.name = _arg1;
}
override public function toString():String{
return (super.toString());
}
public function loadingStatus():String{
var _local1:Array = [];
_local1.push(("bytesLoaded: " + bytesLoaded));
_local1.push(("bytesTotal: " + bytesTotal));
_local1.push(("itemsLoaded: " + itemsLoaded));
_local1.push(("itemsTotal: " + itemsTotal));
_local1.push(("bytesTotalCurrent: " + bytesTotalCurrent));
_local1.push(("percentLoaded: " + BulkLoader.truncateNumber(percentLoaded)));
_local1.push(("weightPercent: " + BulkLoader.truncateNumber(weightPercent)));
_local1.push(("ratioLoaded: " + BulkLoader.truncateNumber(ratioLoaded)));
return ((("BulkProgressEvent " + _local1.join(", ")) + ";"));
}
public function setInfo(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:Number):void{
this.bytesLoaded = _arg1;
this.bytesTotal = _arg2;
this.bytesTotalCurrent = _arg3;
this.itemsLoaded = _arg4;
this.itemsTotal = _arg5;
this.weightPercent = _arg6;
this.percentLoaded = (_arg1 / _arg2);
ratioLoaded = (_arg4 / _arg5);
}
override public function clone():Event{
var _local1:BulkProgressEvent = new BulkProgressEvent(name, bubbles, cancelable);
_local1.setInfo(bytesLoaded, bytesTotal, bytesTotalCurrent, itemsLoaded, itemsTotal, weightPercent);
return (_local1);
}
}
}//package br.com.stimuli.loading
Section 4
//LoadingItem (br.com.stimuli.loading.LoadingItem)
package br.com.stimuli.loading {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class LoadingItem extends EventDispatcher {
var _priority:int;// = 0
private var loader;
var _type:String;
private var _canBeginStreaming:Boolean;// = false
var _isLoaded:Boolean;
var _isLoading:Boolean;
var _bytesTotal:int;// = -1
private var _content;
private var _httpStatus:int;// = 0
var _speed:Number;
var _weightPercentLoaded:Number;
var _addedTime:int;
var url:URLRequest;
var weight:int;// = 1
var stream:NetStream;
private var dummyEventTrigger:Sprite;
var preventCache:Boolean;
private var _responseTime:Number;
var _bytesLoaded:int;// = 0
var maxTries:int;// = 3
private var internalType:String;
var _percentLoaded:Number;
private var _metaData:Object;
var context;// = null
private var _totalTime:int;
var numTries:int;// = 0
private var nc:NetConnection;
var _id:String;
var _latency:Number;
private var _startTime:int;
var pausedAtStart:Boolean;// = false
var _bytesRemaining:int;// = -1
private var _timeToDownload:int;
var status:String;
static const STATUS_STOPPED:String = "stopped";
static const STATUS_STARTED:String = "started";
static const STATUS_ERROR:String = "error";
static const STATUS_FINISHED:String = "finished";
private static var classes:Object = {loader:Loader, xml:URLLoader, video:NetConnection, sound:Sound, text:URLLoader};
public function LoadingItem(_arg1:URLRequest, _arg2:String){
if (_arg2){
this._type = _arg2.toLowerCase();
} else {
this._type = guessType(_arg1.url);
};
internalType = getInternalType(this._type);
this.url = _arg1;
}
function stop():void{
if (_isLoaded){
return;
};
try {
if (loader){
loader.close();
};
} catch(e:Error) {
};
status = STATUS_STOPPED;
_isLoading = false;
}
public function isSound():Boolean{
return ((internalType == BulkLoader.TYPE_SOUND));
}
function get weightPercentLoaded():Number{
return (_weightPercentLoaded);
}
public function get id():String{
return (_id);
}
function onVideoMetadata(_arg1):void{
_metaData = _arg1;
}
function onHttpStatusHandler(_arg1:HTTPStatusEvent):void{
_httpStatus = _arg1.status;
dispatchEvent(_arg1);
}
public function get type():String{
return (_type);
}
private function fireCanBeginStreamingEvent():void{
if (_canBeginStreaming){
return;
};
_canBeginStreaming = true;
var _local1:Event = new Event(BulkLoader.CAN_BEGIN_PLAYING);
dispatchEvent(_local1);
}
public function get totalTime():int{
return (_totalTime);
}
public function get speed():Number{
return (_speed);
}
public function get metaData():Object{
return (_metaData);
}
function get bytesLoaded():int{
return (_bytesLoaded);
}
function createNetStreamEvent(_arg1:Event):void{
var _local2:Event;
var _local3:Event;
var _local4:ProgressEvent;
if ((((_bytesTotal == _bytesLoaded)) && ((_bytesTotal > 8)))){
dummyEventTrigger.removeEventListener(Event.ENTER_FRAME, createNetStreamEvent, false);
_local2 = new Event(Event.COMPLETE);
onCompleteHandler(_local2);
} else {
if ((((_bytesTotal == 0)) && ((stream.bytesTotal > 4)))){
_local3 = new Event(Event.OPEN);
onStartedHandler(_local3);
_bytesLoaded = stream.bytesLoaded;
_bytesTotal = stream.bytesTotal;
} else {
_local4 = new ProgressEvent(ProgressEvent.PROGRESS, false, false, stream.bytesLoaded, stream.bytesTotal);
onProgressHandler(_local4);
};
};
}
private function onStartedHandler(_arg1:Event):void{
_responseTime = getTimer();
_latency = BulkLoader.truncateNumber(((_responseTime - _startTime) / 1000));
status = STATUS_STARTED;
if (((pausedAtStart) && (stream))){
stream.pause();
};
if (isSound()){
_content = loader;
};
dispatchEvent(_arg1);
}
public function isImage():Boolean{
return (((isLoader()) && ((content is Bitmap))));
}
public function get startTime():int{
return (_startTime);
}
override public function toString():String{
return (((((("LoadingItem url: " + url.url) + ", type:") + _type) + ", status: ") + status));
}
public function isVideo():Boolean{
return ((internalType == BulkLoader.TYPE_VIDEO));
}
public function isText():Boolean{
return ((internalType == BulkLoader.TYPE_TEXT));
}
public function get content(){
return (_content);
}
private function onProgressHandler(_arg1):void{
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_bytesLoaded = _arg1.bytesLoaded;
_bytesTotal = _arg1.bytesTotal;
_bytesRemaining = (_bytesTotal - bytesLoaded);
_percentLoaded = (_bytesLoaded / _bytesTotal);
_weightPercentLoaded = (_percentLoaded * weight);
if (((((isVideo()) && (metaData))) && (!(_canBeginStreaming)))){
_local2 = (getTimer() - responseTime);
_local3 = (bytesLoaded / (_local2 / 1000));
_local4 = (_bytesRemaining / (_local3 * 0.8));
_local5 = (metaData.duration - stream.bufferLength);
if (_local5 > _local4){
fireCanBeginStreamingEvent();
};
};
dispatchEvent(_arg1);
}
public function isXML():Boolean{
return ((internalType == BulkLoader.TYPE_XML));
}
function get bytesTotal():int{
return (_bytesTotal);
}
public function get httpStatus():int{
return (_httpStatus);
}
private function onErrorHandler(_arg1:Event):void{
var _local2:BulkErrorEvent;
numTries++;
status = STATUS_ERROR;
if (numTries >= maxTries){
_local2 = new BulkErrorEvent(BulkErrorEvent.ERROR);
_local2.errors = [this];
dispatchEvent(_local2);
} else {
status = null;
load();
};
}
public function isStreamable():Boolean{
return (((((isVideo()) || (isSound()))) || (isSWF())));
}
function get percentLoaded():Number{
return (_percentLoaded);
}
public function get priority():int{
return (_priority);
}
public function get responseTime():Number{
return (_responseTime);
}
function get bytesRemaining():int{
return (_bytesRemaining);
}
public function get isLoaded():Boolean{
return (_isLoaded);
}
function onNetStatus(_arg1:NetStatusEvent):void{
var _local2:Event;
stream.removeEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false);
if (_arg1.info.code == "NetStream.Play.Start"){
_content = stream;
_local2 = new Event(Event.OPEN);
onStartedHandler(_local2);
};
}
public function isLoader():Boolean{
return ((internalType == BulkLoader.TYPE_LOADER));
}
public function get timeToDownload():int{
return (_timeToDownload);
}
function load():void{
var cacheString:String;
var customClient:Object;
if (preventCache){
cacheString = ("BulkLoaderNoCache=" + int(((Math.random() * 100) * getTimer())));
if (url.url.indexOf("?") == -1){
url.url = (url.url + ("?" + cacheString));
} else {
url.url = (url.url + ("&" + cacheString));
};
};
var loaderClass:Class = LoadingItem.classes[internalType];
loader = new (loaderClass);
if ((loader is Loader)){
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.OPEN, onStartedHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusHandler, false, 0, true);
loader.load(url, context);
} else {
if ((loader is Sound)){
loader.addEventListener(ProgressEvent.PROGRESS, onProgressHandler, false, 0, true);
loader.addEventListener(Event.COMPLETE, onCompleteHandler, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false, 0, true);
loader.addEventListener(Event.OPEN, onStartedHandler, false, 0, true);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatusHandler, false, 0, true);
loader.load(url, context);
} else {
if ((loader is NetConnection)){
loader.connect(null);
stream = new NetStream(loader);
stream.addEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false, 0, true);
stream.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus, false, 0, true);
dummyEventTrigger = new Sprite();
dummyEventTrigger.addEventListener(Event.ENTER_FRAME, createNetStreamEvent, false, 0, true);
customClient = new Object();
customClient.onCuePoint = function (... _args):void{
};
customClient.onMetaData = onVideoMetadata;
customClient.onPlayStatus = function (... _args):void{
};
stream.client = customClient;
stream.play(url.url);
stream.seek(0);
} else {
if ((loader is URLLoader)){
loader.addEventListener(ProgressEvent.PROGRESS, onProgressHandler, false, 0, true);
loader.addEventListener(Event.COMPLETE, onCompleteHandler, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false, 0, true);
loader.addEventListener(Event.OPEN, onStartedHandler, false, 0, true);
loader.load(url);
};
};
};
};
_isLoading = true;
_startTime = getTimer();
}
public function get addedTime():int{
return (_addedTime);
}
private function onCompleteHandler(_arg1:Event):void{
_totalTime = getTimer();
_timeToDownload = ((_totalTime - _responseTime) / 1000);
if (_timeToDownload == 0){
_timeToDownload = 0.2;
};
_speed = BulkLoader.truncateNumber(((bytesTotal / 0x0400) / _timeToDownload));
if (_timeToDownload == 0){
_speed = 3000;
};
status = STATUS_FINISHED;
_isLoaded = true;
if ((loader is Loader)){
_content = loader.content;
} else {
if ((loader is URLLoader)){
if (_type == BulkLoader.TYPE_XML){
_content = new XML(loader.data);
} else {
_content = loader.data;
};
} else {
if ((loader is Sound)){
_content = loader;
} else {
if ((loader is NetConnection)){
_content = stream;
};
};
};
};
dispatchEvent(_arg1);
}
function cleanListeners():void{
var _local1:Object;
if (((!((_type == BulkLoader.TYPE_VIDEO))) && (loader))){
_local1 = loader;
if ((loader is Loader)){
_local1 = loader.contentLoaderInfo;
};
_local1.removeEventListener(ProgressEvent.PROGRESS, onProgressHandler, false);
_local1.removeEventListener(Event.COMPLETE, onCompleteHandler, false);
_local1.removeEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false);
_local1.removeEventListener(BulkLoader.OPEN, onStartedHandler, false);
} else {
if (_type == BulkLoader.TYPE_VIDEO){
if (stream){
stream.removeEventListener(IOErrorEvent.IO_ERROR, onErrorHandler, false);
};
if (dummyEventTrigger){
dummyEventTrigger.removeEventListener(Event.ENTER_FRAME, createNetStreamEvent, false);
dummyEventTrigger = null;
};
};
};
}
public function isSWF():Boolean{
return (((isLoader()) && ((content is MovieClip))));
}
function destroy():void{
stop();
cleanListeners();
_content = null;
loader = null;
}
public function get latency():Number{
return (_latency);
}
static function getInternalType(_arg1:String):String{
var _local2:String;
if ((((_arg1 == BulkLoader.TYPE_LOADER)) || ((BulkLoader.LOADER_TYPES.indexOf(_arg1) > -1)))){
_local2 = BulkLoader.TYPE_LOADER;
} else {
if ((((_arg1 == BulkLoader.TYPE_SOUND)) || ((BulkLoader.SOUND_TYPES.indexOf(_arg1) > -1)))){
_local2 = BulkLoader.TYPE_SOUND;
} else {
if ((((_arg1 == BulkLoader.TYPE_VIDEO)) || ((BulkLoader.VIDEO_TYPES.indexOf(_arg1) > -1)))){
_local2 = BulkLoader.TYPE_VIDEO;
} else {
if ((((_arg1 == BulkLoader.TYPE_XML)) || ((BulkLoader.XML_TYPES.indexOf(_arg1) > -1)))){
_local2 = BulkLoader.TYPE_XML;
} else {
_local2 = BulkLoader.TYPE_TEXT;
};
};
};
};
return (_local2);
}
static function guessType(_arg1:String):String{
var _local2:String = ((_arg1.indexOf("?") > -1)) ? _arg1.substring(0, _arg1.indexOf("?")) : _arg1;
var _local3:String = _local2.substring((_local2.lastIndexOf(".") + 1)).toLowerCase();
if (!Boolean(_local3)){
_local3 = BulkLoader.TYPE_TEXT;
};
return (_local3);
}
}
}//package br.com.stimuli.loading
Section 5
//ColorShortcuts (caurina.transitions.properties.ColorShortcuts)
package caurina.transitions.properties {
import flash.geom.*;
import caurina.transitions.*;
import flash.filters.*;
public class ColorShortcuts {
private static var LUMINANCE_B:Number = 0.072169;
private static var LUMINANCE_G:Number = 0.71516;
private static var LUMINANCE_R:Number = 0.212671;
public function ColorShortcuts(){
trace("This is an static class and should not be instantiated.");
}
public static function _color_splitter(_arg1, _arg2:Array):Array{
var _local3:Array = new Array();
if (_arg1 == null){
_local3.push({name:"_color_redMultiplier", value:1});
_local3.push({name:"_color_redOffset", value:0});
_local3.push({name:"_color_greenMultiplier", value:1});
_local3.push({name:"_color_greenOffset", value:0});
_local3.push({name:"_color_blueMultiplier", value:1});
_local3.push({name:"_color_blueOffset", value:0});
} else {
_local3.push({name:"_color_redMultiplier", value:0});
_local3.push({name:"_color_redOffset", value:AuxFunctions.numberToR(_arg1)});
_local3.push({name:"_color_greenMultiplier", value:0});
_local3.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(_arg1)});
_local3.push({name:"_color_blueMultiplier", value:0});
_local3.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(_arg1)});
};
return (_local3);
}
public static function _contrast_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:Number;
var _local6:Number;
_local5 = (_arg2 + 1);
_local6 = Math.round((_arg2 * -128));
var _local7:ColorTransform = new ColorTransform(_local5, _local5, _local5, 1, _local6, _local6, _local6, 0);
_arg1.transform.colorTransform = _local7;
}
public static function _brightness_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
var _local4:Boolean = _arg2[0];
var _local5:ColorTransform = _arg1.transform.colorTransform;
var _local6:Number = (1 - (((_local5.redMultiplier + _local5.greenMultiplier) + _local5.blueMultiplier) / 3));
var _local7:Number = (((_local5.redOffset + _local5.greenOffset) + _local5.blueOffset) / 3);
if (_local4){
return (((_local7 > 0)) ? (_local7 / 0xFF) : -(_local6));
//unresolved jump
};
return ((_local7 / 100));
}
public static function _saturation_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
var _local4:Array = getObjectMatrix(_arg1);
var _local5:Boolean = _arg2[0];
var _local6:Number = (_local5) ? (1 / 3) : LUMINANCE_R;
var _local7:Number = (_local5) ? (1 / 3) : LUMINANCE_G;
var _local8:Number = (_local5) ? (1 / 3) : LUMINANCE_B;
var _local9:Number = (((((_local4[0] - _local6) / (1 - _local6)) + ((_local4[6] - _local7) / (1 - _local7))) + ((_local4[12] - _local8) / (1 - _local8))) / 3);
var _local10:Number = (1 - (((((((_local4[1] / _local7) + (_local4[2] / _local8)) + (_local4[5] / _local6)) + (_local4[7] / _local8)) + (_local4[10] / _local6)) + (_local4[11] / _local7)) / 6));
return (((_local9 + _local10) / 2));
}
public static function _oldColor_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return ((_arg1.transform.colorTransform[_arg2[0]] * 100));
}
public static function _brightness_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local6:Number;
var _local7:Number;
var _local5:Boolean = _arg3[0];
if (_local5){
_local6 = (1 - Math.abs(_arg2));
_local7 = ((_arg2 > 0)) ? Math.round((_arg2 * 0xFF)) : 0;
} else {
_local6 = 1;
_local7 = Math.round((_arg2 * 100));
};
var _local8:ColorTransform = new ColorTransform(_local6, _local6, _local6, 1, _local7, _local7, _local7, 0);
_arg1.transform.colorTransform = _local8;
}
public static function _saturation_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:Boolean = _arg3[0];
var _local6:Number = (_local5) ? (1 / 3) : LUMINANCE_R;
var _local7:Number = (_local5) ? (1 / 3) : LUMINANCE_G;
var _local8:Number = (_local5) ? (1 / 3) : LUMINANCE_B;
var _local9:Number = _arg2;
var _local10:Number = (1 - _local9);
var _local11:Number = (_local6 * _local10);
var _local12:Number = (_local7 * _local10);
var _local13:Number = (_local8 * _local10);
var _local14:Array = [(_local11 + _local9), _local12, _local13, 0, 0, _local11, (_local12 + _local9), _local13, 0, 0, _local11, _local12, (_local13 + _local9), 0, 0, 0, 0, 0, 1, 0];
setObjectMatrix(_arg1, _local14);
}
private static function getObjectMatrix(_arg1:Object):Array{
var _local2:Number = 0;
while (_local2 < _arg1.filters.length) {
if ((_arg1.filters[_local2] is ColorMatrixFilter)){
return (_arg1.filters[_local2].matrix.concat());
};
_local2++;
};
return ([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
}
public static function getHueDistance(_arg1:Array, _arg2:Array):Number{
return (((Math.abs((_arg1[0] - _arg2[0])) + Math.abs((_arg1[1] - _arg2[1]))) + Math.abs((_arg1[2] - _arg2[2]))));
}
public static function _hue_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
setObjectMatrix(_arg1, getHueMatrix(_arg2));
}
public static function _hue_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
var _local6:Number;
var _local8:Number;
var _local4:Array = getObjectMatrix(_arg1);
var _local5:Array = [];
_local5[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)};
_local5[1] = {angle:180, matrix:getHueMatrix(180)};
_local6 = 0;
while (_local6 < _local5.length) {
_local5[_local6].distance = getHueDistance(_local4, _local5[_local6].matrix);
_local6++;
};
var _local7:Number = 15;
_local6 = 0;
while (_local6 < _local7) {
if (_local5[0].distance < _local5[1].distance){
_local8 = 1;
} else {
_local8 = 0;
};
_local5[_local8].angle = ((_local5[0].angle + _local5[1].angle) / 2);
_local5[_local8].matrix = getHueMatrix(_local5[_local8].angle);
_local5[_local8].distance = getHueDistance(_local4, _local5[_local8].matrix);
_local6++;
};
return (_local5[_local8].angle);
}
public static function getHueMatrix(_arg1:Number):Array{
var _local2:Number = ((_arg1 * Math.PI) / 180);
var _local3:Number = LUMINANCE_R;
var _local4:Number = LUMINANCE_G;
var _local5:Number = LUMINANCE_B;
var _local6:Number = Math.cos(_local2);
var _local7:Number = Math.sin(_local2);
var _local8:Array = [((_local3 + (_local6 * (1 - _local3))) + (_local7 * -(_local3))), ((_local4 + (_local6 * -(_local4))) + (_local7 * -(_local4))), ((_local5 + (_local6 * -(_local5))) + (_local7 * (1 - _local5))), 0, 0, ((_local3 + (_local6 * -(_local3))) + (_local7 * 0.143)), ((_local4 + (_local6 * (1 - _local4))) + (_local7 * 0.14)), ((_local5 + (_local6 * -(_local5))) + (_local7 * -0.283)), 0, 0, ((_local3 + (_local6 * -(_local3))) + (_local7 * -((1 - _local3)))), ((_local4 + (_local6 * -(_local4))) + (_local7 * _local4)), ((_local5 + (_local6 * (1 - _local5))) + (_local7 * _local5)), 0, 0, 0, 0, 0, 1, 0];
return (_local8);
}
public static function _color_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.transform.colorTransform[_arg2[0]]);
}
public static function init():void{
Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]);
Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]);
Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]);
Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]);
Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]);
Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]);
Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]);
Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]);
Tweener.registerSpecialPropertySplitter("_color", _color_splitter);
Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter);
Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]);
Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]);
Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set);
Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set);
Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]);
Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]);
}
private static function setObjectMatrix(_arg1:Object, _arg2:Array):void{
var _local6:ColorMatrixFilter;
var _local3:Array = _arg1.filters.concat();
var _local4:Boolean;
var _local5:Number = 0;
while (_local5 < _local3.length) {
if ((_local3[_local5] is ColorMatrixFilter)){
_local3[_local5].matrix = _arg2.concat();
_local4 = true;
};
_local5++;
};
if (!_local4){
_local6 = new ColorMatrixFilter(_arg2);
_local3[_local3.length] = _local6;
};
_arg1.filters = _local3;
}
public static function _color_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:ColorTransform = _arg1.transform.colorTransform;
_local5[_arg3[0]] = _arg2;
_arg1.transform.colorTransform = _local5;
}
public static function _oldColor_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:ColorTransform = _arg1.transform.colorTransform;
_local5[_arg3[0]] = (_arg2 / 100);
_arg1.transform.colorTransform = _local5;
}
public static function _contrast_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
var _local5:Number;
var _local6:Number;
var _local4:ColorTransform = _arg1.transform.colorTransform;
_local5 = ((((_local4.redMultiplier + _local4.greenMultiplier) + _local4.blueMultiplier) / 3) - 1);
_local6 = ((((_local4.redOffset + _local4.greenOffset) + _local4.blueOffset) / 3) / -128);
return (((_local5 + _local6) / 2));
}
public static function _colorTransform_splitter(_arg1:Object, _arg2:Array):Array{
var _local3:Array = new Array();
if (_arg1 == null){
_local3.push({name:"_color_redMultiplier", value:1});
_local3.push({name:"_color_redOffset", value:0});
_local3.push({name:"_color_greenMultiplier", value:1});
_local3.push({name:"_color_greenOffset", value:0});
_local3.push({name:"_color_blueMultiplier", value:1});
_local3.push({name:"_color_blueOffset", value:0});
} else {
if (_arg1.ra != undefined){
_local3.push({name:"_color_ra", value:_arg1.ra});
};
if (_arg1.rb != undefined){
_local3.push({name:"_color_rb", value:_arg1.rb});
};
if (_arg1.ga != undefined){
_local3.push({name:"_color_ba", value:_arg1.ba});
};
if (_arg1.gb != undefined){
_local3.push({name:"_color_bb", value:_arg1.bb});
};
if (_arg1.ba != undefined){
_local3.push({name:"_color_ga", value:_arg1.ga});
};
if (_arg1.bb != undefined){
_local3.push({name:"_color_gb", value:_arg1.gb});
};
if (_arg1.aa != undefined){
_local3.push({name:"_color_aa", value:_arg1.aa});
};
if (_arg1.ab != undefined){
_local3.push({name:"_color_ab", value:_arg1.ab});
};
if (_arg1.redMultiplier != undefined){
_local3.push({name:"_color_redMultiplier", value:_arg1.redMultiplier});
};
if (_arg1.redOffset != undefined){
_local3.push({name:"_color_redOffset", value:_arg1.redOffset});
};
if (_arg1.blueMultiplier != undefined){
_local3.push({name:"_color_blueMultiplier", value:_arg1.blueMultiplier});
};
if (_arg1.blueOffset != undefined){
_local3.push({name:"_color_blueOffset", value:_arg1.blueOffset});
};
if (_arg1.greenMultiplier != undefined){
_local3.push({name:"_color_greenMultiplier", value:_arg1.greenMultiplier});
};
if (_arg1.greenOffset != undefined){
_local3.push({name:"_color_greenOffset", value:_arg1.greenOffset});
};
if (_arg1.alphaMultiplier != undefined){
_local3.push({name:"_color_alphaMultiplier", value:_arg1.alphaMultiplier});
};
if (_arg1.alphaOffset != undefined){
_local3.push({name:"_color_alphaOffset", value:_arg1.alphaOffset});
};
};
return (_local3);
}
}
}//package caurina.transitions.properties
Section 6
//DisplayShortcuts (caurina.transitions.properties.DisplayShortcuts)
package caurina.transitions.properties {
import flash.geom.*;
import caurina.transitions.*;
public class DisplayShortcuts {
public function DisplayShortcuts(){
trace("This is an static class and should not be instantiated.");
}
public static function init():void{
Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set);
Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set);
Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter);
Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter);
Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]);
Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]);
Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]);
Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]);
Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]);
Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]);
Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]);
Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]);
}
public static function _frame_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
_arg1.gotoAndStop(Math.round(_arg2));
}
public static function _autoAlpha_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
_arg1.alpha = _arg2;
_arg1.visible = (_arg2 > 0);
}
public static function _frame_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.currentFrame);
}
public static function _scrollRect_splitter(_arg1:Rectangle, _arg2:Array, _arg3:Object=null):Array{
var _local4:Array = new Array();
if (_arg1 == null){
_local4.push({name:"_scrollRect_x", value:0});
_local4.push({name:"_scrollRect_y", value:0});
_local4.push({name:"_scrollRect_width", value:100});
_local4.push({name:"_scrollRect_height", value:100});
} else {
_local4.push({name:"_scrollRect_x", value:_arg1.x});
_local4.push({name:"_scrollRect_y", value:_arg1.y});
_local4.push({name:"_scrollRect_width", value:_arg1.width});
_local4.push({name:"_scrollRect_height", value:_arg1.height});
};
return (_local4);
}
public static function _autoAlpha_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.alpha);
}
public static function _scrollRect_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{
return (_arg1.scrollRect[_arg2[0]]);
}
public static function _scale_splitter(_arg1:Number, _arg2:Array):Array{
var _local3:Array = new Array();
_local3.push({name:"scaleX", value:_arg1});
_local3.push({name:"scaleY", value:_arg1});
return (_local3);
}
public static function _scrollRect_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{
var _local5:Rectangle = _arg1.scrollRect;
_local5[_arg3[0]] = Math.round(_arg2);
_arg1.scrollRect = _local5;
}
}
}//package caurina.transitions.properties
Section 7
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function concatObjects(... _args):Object{
var _local3:Object;
var _local5:String;
var _local2:Object = {};
var _local4:int;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function isInArray(_arg1:String, _arg2:Array):Boolean{
var _local3:uint = _arg2.length;
var _local4:uint;
while (_local4 < _local3) {
if (_arg2[_local4] == _arg1){
return (true);
};
_local4++;
};
return (false);
}
public static function getObjectLength(_arg1:Object):uint{
var _local3:String;
var _local2:uint;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
}
}//package caurina.transitions
Section 8
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public function Equations(){
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package caurina.transitions
Section 9
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var valueComplete:Number;
public var modifierFunction:Function;
public var extra:Object;
public var valueStart:Number;
public var hasModifier:Boolean;
public var arrayIndex:Number;
public var originalValueComplete:Object;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 10
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var preProcess:Function;
public var setValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 11
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 12
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 13
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public function Tweener(){
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
if (!_inited){
init();
};
var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
if (!_inited){
init();
};
var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
var _local5:Object = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time;
var _local7:Number = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local5:uint;
var _local6:String;
var _local7:Boolean;
var _local3:TweenListObj = _tweenList[_arg1];
var _local4:TweenListObj = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
var _local3:Number = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.71");
}
public static function onEnterFrame(_arg1:Event):void{
updateTime();
updateFrame();
var _local2:Boolean;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
var isOver:Boolean;
var cTime:Number = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e:Error) {
handleError(tTweening, e, "onStart");
};
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
try {
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
} catch(e:Error) {
handleError(tTweening, e, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e:Error) {
handleError(tTweening, e, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
var _local7:Object = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time;
var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay;
var _local10:Array = new Array();
var _local11:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
var _local12:Object = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete);
_tweenList.push(_local15);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local16 = (_tweenList.length - 1);
updateTweenByIndex(_local16);
removeTweenByIndex(_local16);
};
_local3++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function printError(_arg1:String):void{
trace(("## [Tweener] Error: " + _arg1));
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local4:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
if (!Boolean(_tweenList)){
return ([]);
};
var _local4:Array = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
if (!Boolean(_tweenList)){
return (0);
};
var _local3:Number = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
var removed:Boolean;
var tl:uint = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
if (!_inited){
init();
};
var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(pauseTweenByIndex, _arg1, _local3));
}
}
}//package caurina.transitions
Section 14
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var hasStarted:Boolean;
public var onUpdate:Function;
public var useFrames:Boolean;
public var count:Number;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var isCaller:Boolean;
public var timePaused:Number;
public var transition:Function;
public var onCompleteParams:Array;
public var onError:Function;
public var timesCalled:Number;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local3:String;
var _local2:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local3:String;
var _local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
var _local2:Boolean;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local2:Object = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 15
//FrameScriptManager (com.gskinner.utils.FrameScriptManager)
package com.gskinner.utils {
import flash.display.*;
public class FrameScriptManager {
private var target:MovieClip;
private var labels:Object;
public function FrameScriptManager(_arg1:MovieClip){
this.target = _arg1;
updateLabels();
}
public function getFrameNumber(_arg1):uint{
var _local2:uint = uint(_arg1);
if (_local2){
return (_local2);
};
var _local3:String = String(_arg1);
if (_local3 == null){
return (0);
};
_local2 = labels[_local3];
return (_local2);
}
public function setFrameScript(_arg1, _arg2:Function):void{
var _local3:uint = getFrameNumber(_arg1);
if (_local3 == 0){
return;
};
target.addFrameScript((_local3 - 1), _arg2);
}
private function updateLabels():void{
var _local1:Array = target.currentLabels;
labels = {};
var _local2:uint;
while (_local2 < _local1.length) {
labels[_local1[_local2].name] = _local1[_local2].frame;
_local2++;
};
}
}
}//package com.gskinner.utils
Section 16
//Tracker (com.memecounter.Tracker)
package com.memecounter {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class Tracker {
public static const ORI_DOM:String = "ori_dom";
public static const LOCALHOST:String = "localhost";
public static const LOCAL:String = "Local";
public static const TRACKER_PATH:String = "/node/tracking/trackerAS3.swf";
private static var ori_dom:String;
private static var lurl:String;
private static var _isReady:Boolean = false;
public static var a:uint = 0;
public static var root:DisplayObject;
public static var c:uint;
public static var d:String = "";
private static var _isInited:Boolean = false;
public static var mcEvent:Function;
public static var fpv:String = "";
private static var l:Loader;
private static var tracker:MovieClip;
public static var da:Array = ["distralytics.com", "distralytics.co.uk"];
private static function loadError(_arg1:Event):void{
a++;
lc();
}
public static function init(_arg1:uint, _arg2:DisplayObject):void{
var _local3:uint;
if (!_isInited){
_isInited = true;
c = _arg1;
root = _arg2;
_local3 = 0;
while (_local3 < da.length) {
Security.allowDomain(("*" + da[_local3]));
Security.allowDomain(da[_local3]);
Security.allowDomain(((c + ".c.") + da[_local3]));
Security.allowDomain(("*." + da[_local3]));
_local3++;
};
ori_dom = (root.loaderInfo.parameters.hasOwnProperty(ORI_DOM)) ? root.loaderInfo.parameters[ORI_DOM] : "";
d = ((ori_dom)!="") ? ori_dom : ((new LocalConnection().domain.indexOf(LOCALHOST))==-1) ? new LocalConnection().domain : LOCAL;
fpv = Capabilities.version.split(" ")[1].split(",")[0];
lurl = (((((((((TRACKER_PATH + "?c=") + c) + "&r=") + Math.floor((Math.random() * 10000000000))) + "&d=") + d) + "&p=") + fpv) + "&as=3");
l = new Loader();
l.contentLoaderInfo.addEventListener(Event.INIT, loadComplete);
l.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
lc();
mcEvent = kvEvent;
};
}
public static function kvClick(_arg1:uint):void{
if (_isReady){
tracker.kvClick(_arg1);
};
}
public static function get isReady():Boolean{
return (_isReady);
}
public static function mcClick(_arg1:String, _arg2:String=null):void{
if (_isReady){
tracker.mcClick(_arg1, _arg2);
};
}
public static function kvEvent(_arg1):void{
if (_isReady){
tracker.kvEvent(_arg1);
};
}
public static function kvCountry():String{
if (_isReady){
return (tracker.kvCountry());
};
return ("");
}
private static function lc():void{
var _local1:String;
var _local2:String = da[(a % da.length)];
if (_local2.charAt(0) === "."){
_local1 = (("http://" + _local2.substr(1, (_local2.length - 1))) + lurl);
} else {
_local1 = (((("http://" + c) + ".c.") + _local2) + lurl);
};
Security.allowDomain(_local1);
l.load(new URLRequest(_local1));
}
private static function loadComplete(_arg1:Event):void{
var e = _arg1;
try {
tracker = e.target.content;
tracker.init(getDefinitionByName("com.memecounter.Tracker"), root);
_isReady = true;
} catch(e:Error) {
trace("Memecounter error: unable to access tracker object due to security sandbox.");
};
}
}
}//package com.memecounter
Section 17
//Config (config.Config)
package config {
import flash.geom.*;
import flash.ui.*;
public class Config {
public static const TILE_BUMPER_DIAGONAL:Point = new Point(5, 5);
public static const TILE_ITEM_BONUS:Point = new Point(7, 3);
public static const TILE_NO_COLLISION:Point = new Point(0, 1);
public static const TILE_ITEM_DOOR_KEY:Point = new Point(6, 3);
public static const TILE_SICK_CLOUD:Point = new Point(2, 4);
public static const TILE_STORM_CLOUD:Point = new Point(1, 4);
public static const MEME_CID:int = 831;
public static const TILE_PLATFORM_FALLING:Point = new Point(3, 5);
public static const TILE_EXIT:Point = new Point(1, 0);
public static const TILE_ITEM_ENERGY:Point = new Point(4, 3);
public static const TILE_ACID_TOP:Point = new Point(2, 2);
public static const MEME_RARE_MARB_2:int = 8674;
public static const MEME_RARE_MARB_1:int = 8670;
public static const GRAVITY:Number = 1.4;
public static const MEME_CLICK_TOYSTORY:int = 1349;
public static const TILE_ITEM_SPECIAL_MARBLE:Point = new Point(1, 3);
public static const TILE_BUMPER_VERTICAL:Point = new Point(4, 5);
public static const TILE_CLOUD:Point = new Point(9, 5);
public static const TILE_SIGNPOST:Point = new Point(3, 0);
public static const TILE_BRICK:Point = new Point(6, 5);
public static const TILE_ITEM_LIFE:Point = new Point(5, 3);
public static const TILE_ITEM_MARBLE_KEY:Point = new Point(2, 3);
public static const LEVEL_LAYERS_AMOUNT:int = 7;
public static const TILE_PLATFORM_HORIZONTAL:Point = new Point(2, 5);
public static const LEVEL_BORDER:int = 0;
public static const TILE_MARBLE_CAGE:Point = new Point(8, 5);
public static const TILE_START:Point = new Point(0, 0);
public static const MEME_CHAR_BOY:int = 8666;
public static const TILE_PLATFORM_VERTICAL:Point = new Point(1, 5);
public static const TILE_BADDY_FLAG:Point = new Point(0, 4);
public static const TILE_ALIEN_CAGE:Point = new Point(0, 7);
public static const MEME_SECRET_1:int = 8671;
public static const MEME_SECRET_2:int = 8672;
public static const MEME_SECRET_3:int = 8673;
public static const MEME_CHAR_GIRL:int = 8667;
public static const TILE_ITEM_LEGO_BRICK:Point = new Point(3, 3);
public static const TILE_DOOR:Point = new Point(0, 6);
public static const KEY_CONFIRM:int = Keyboard.SPACE;
public static const TILE_LEGO_PLACEHOLDER:Point = new Point(7, 5);
public static const MEME_LEVEL_2_COMPLETED:int = 8669;
public static const TILE_SAVEPOINT:Point = new Point(2, 0);
public static const FPS:int = 30;
public static const MEME_REPLAY:int = 8675;
public static const TILE_ITEM_MARBLE:Point = new Point(0, 3);
public static const TILE_ACID_BOTTOM:Point = new Point(1, 2);
public static const TILE_SPIKES:Point = new Point(0, 2);
public static const TILE_THUMPER:Point = new Point(3, 2);
public static const TILE_ALIEN_CAGE_TRIGGER:Point = new Point(1, 7);
public static const TILE_PLATFORM_CONTROL:Point = new Point(0, 5);
public static const MEME_LEVEL_1_COMPLETED:int = 8668;
public static const TILE_DOOR_TRIGGER:Point = new Point(1, 6);
public static function getMission1XML():XML{
return (new XML((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<data>") + "\t<total>dfRf40kAA0d30</total>") + "\t<levels>") + "\t\t<level>") + "\t\t\t<id>1</id>") + "\t\t\t<type>normal</type>") + "\t\t\t<time>480</time>") + "\t\t\t<min_time>240</min_time>") + "\t\t\t<tileset>tileset1</tileset>") + "\t\t\t<background>background1</background>") + "\t\t\t<map>map1_1</map>") + "\t\t\t<secrets>") + "\t\t\t\t<secret id=\"1\" x=\"93\" y=\"42\" width=\"14\" height=\"6\">") + "\t\t\t\t\t<entrance x=\"106\" y=\"47\" />") + "\t\t\t\t\t<entrance x=\"106\" y=\"46\" />") + "\t\t\t\t\t<entrance x=\"106\" y=\"45\" />") + "\t\t\t\t</secret>") + "\t\t\t\t<secret id=\"2\" x=\"181\" y=\"28\" width=\"14\" height=\"6\">") + "\t\t\t\t\t<entrance x=\"181\" y=\"31\" />") + "\t\t\t\t\t<entrance x=\"181\" y=\"32\" />") + "\t\t\t\t\t<entrance x=\"181\" y=\"33\" />") + "\t\t\t\t</secret>") + "\t\t\t</secrets>") + "\t\t</level>") + "\t\t<level>") + "\t\t\t<id>2</id>") + "\t\t\t<type>bonus</type>") + "\t\t\t<time>30</time>") + "\t\t\t<min_time>0</min_time>") + "\t\t\t<tileset>tileset1_bonus1</tileset>") + "\t\t\t<background>background1_bonus1</background>") + "\t\t\t<map>map1_bonus1</map>") + "\t\t</level>") + "\t\t<level>") + "\t\t\t<id>3</id>") + "\t\t\t<type>normal</type>") + "\t\t\t<time>720</time>") + "\t\t\t<min_time>330</min_time>") + "\t\t\t<tileset>tileset1</tileset>") + "\t\t\t<background>background1</background>") + "\t\t\t<map>map1_2</map>") + "\t\t\t<secrets>") + "\t\t\t\t<secret id=\"3\" x=\"0\" y=\"33\" width=\"15\" height=\"16\">") + "\t\t\t\t\t<entrance x=\"14\" y=\"34\" />") + "\t\t\t\t\t<entrance x=\"14\" y=\"35\" />") + "\t\t\t\t\t<entrance x=\"14\" y=\"36\" />") + "\t\t\t\t</secret>") + "\t\t\t</secrets>") + "\t\t</level>") + "\t\t<level>") + "\t\t\t<id>4</id>") + "\t\t\t<type>bonus</type>") + "\t\t\t<time>30</time>") + "\t\t\t<min_time>0</min_time>") + "\t\t\t<tileset>tileset1_bonus1</tileset>") + "\t\t\t<background>background1_bonus1</background>") + "\t\t\t<map>map1_bonus2</map>") + "\t\t</level>") + "\t</levels>") + "\t<hints>") + "\t\t<hint id=\"0\" name=\"marble\">") + "\t\t\t<copy>Run over marbles to pick them up. Don't forget members get to spend their marbles in the Marble Mall!!</copy>") + "\t\t</hint>") + "\t\t<hint id=\"1\" name=\"spring\">") + "\t\t\t<copy>Use springs to jump higher, Don't forget it's not flying, it's falling with style!!</copy>") + "\t\t</hint>") + "\t\t<hint id=\"2\" name=\"switch\">") + "\t\t\t<copy>Good work Space ranger - you found a switch. This unlocks an alien, you can now rescue him.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"3\" name=\"secret\">") + "\t\t\t<copy>Fantastic work Space Ranger, you've found an uncharted sector.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"4\" name=\"alien\">") + "\t\t\t<copy>You rescued an Alien, they will be eternally grateful!</copy>") + "\t\t</hint>") + "\t\t<hint id=\"5\" name=\"checkpoint\">") + "\t\t\t<copy>Great work Missioner. You made it to checkpoint gamma006. Your Mission progress will be saved from this point.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"6\" name=\"block\">") + "\t\t\t<copy>Hey space ranger, those blocks look useful. I think they might help you later in this mission.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"7\" name=\"rare_logged_out\">") + "\t\t\t<copy>To Infinity and Beyond! You've found one of the Rare Marble. If you become a member, this rare marb unlocks extra cool stuff. Register now!</copy>") + "\t\t</hint>") + "\t\t<hint id=\"8\" name=\"rare_logged_in\">") + "\t\t\t<copy>To Infinity and Beyond! You've found one of the Rare Marbles. Finding a rare marble means you've won a trophy, and also unlocked a sticker. </copy>") + "\t\t</hint>") + "\t\t<hint id=\"9\" name=\"key\">") + "\t\t\t<copy>Nice work. You found a key. This will help you unlock something later in the game.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"10\" name=\"enemy_cloud\">") + "\t\t\t<copy>Watch out space cadet. These clouds can zap you out of this quadrant. Shoot them with your marbles.</copy>") + "\t\t</hint>") + "\t\t<hint id=\"11\" name=\"bonus_unlock\">") + "\t\t\t<copy>Good skills space cadet. You've unlocked an uncharted bonus quadrant. Play this at the end of this level.</copy>") + "\t\t</hint>") + "\t</hints>") + "</data>")));
}
}
}//package config
Section 18
//SoundConfig (config.SoundConfig)
package config {
public class SoundConfig {
public static const SFX_HERO_SHOT:String = "SFX_HERO_SHOT";
public static const SFX_BRICK:String = "SFX_DESTROY_BRICK";
public static const SFX_TRIGGER:String = "SFX_TRIGGER";
public static const SFX_JUMP:String = "SFX_JUMP";
public static const SFX_FOOT_STEPS:String = "SFX_FOOT_STEPS";
public static const SFX_COLLECT_ALIEN:String = "sndCollectAlien";
public static const SFX_HERO_HURT:String = "SFX_HERO_HURT";
public static const MUSIC_GAMEOVER_FAILED:String = "sndMissionFail";
public static const SFX_DOOR_OPEN:String = "sndDoorOpen";
public static const MUSIC_GAMEOVER_SUCCESS:String = "sndMissionSuccess";
public static const SFX_LIFE_COLLECT:String = "SFX_LIFE_COLLECT";
public static const SFX_HERO_DEATH:String = "SFX_HERO_DEATH";
public static const SFX_THUNDER:String = "sndThunder";
public static const SFX_ENERGY_COLLECT:String = "SFX_ENERGY_COLLECT";
public static const SFX_BADDIE_DESTROYED:String = "SFX_BADDIE_DESTROYED";
public static const SFX_COLLECT:String = "SFX_COLLECT";
public static const MUSIC_1:String = "sndMusicInGame";
public static const SFX_SAVEPOINT:String = "SFX_SAVEPOINT";
public static const SFX_BUMPER:String = "SFX_BUMPER";
public static const MUSIC_MENU_PANEL:String = "sndMusicMenu";
}
}//package config
Section 19
//HintData (data.HintData)
package data {
public class HintData {
private var m_copy:String;
private var m_id:int;
private var m_displayed:Boolean;
private var m_name:String;
public function HintData(_arg1:int, _arg2:String, _arg3:String){
m_id = _arg1;
m_name = _arg2;
m_copy = _arg3;
m_displayed = false;
}
public function markAsDisplayed():void{
m_displayed = true;
}
public function get displayed():Boolean{
return (m_displayed);
}
public function get name():String{
return (m_name);
}
public function get copy():String{
return (m_copy);
}
public function get id():int{
return (m_id);
}
}
}//package data
Section 20
//LevelData (data.LevelData)
package data {
public class LevelData {
private var m_mapUrl:String;
private var m_type:int;
private var m_backgroundUrl:String;
private var m_time:int;
private var m_minTime:int;
private var m_secrets:Array;
private var m_tilesetUrl:String;
private var m_id:int;
public static const MISSION_TYPE_NORMAL:int = 0;
public static const MISSION_TYPE_BONUS:int = 1;
public function LevelData(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:String, _arg7:String, _arg8:String, _arg9:Array){
m_id = _arg2;
m_type = _arg3;
m_time = _arg4;
m_minTime = _arg5;
m_mapUrl = (_arg1 + _arg6);
m_tilesetUrl = (_arg1 + _arg7);
m_backgroundUrl = (_arg1 + _arg8);
m_secrets = _arg9;
}
public function get secrets():Array{
return (m_secrets);
}
public function get time():int{
return (m_time);
}
public function get tilesetUrl():String{
return (m_tilesetUrl);
}
public function get backgroundUrl():String{
return (m_backgroundUrl);
}
public function get id():int{
return (m_id);
}
public function toString():String{
return (((((((((("LevelData\nid: " + m_id) + "\ntime: ") + m_time) + "\nmap: ") + m_mapUrl) + "\ntileset: ") + m_tilesetUrl) + "\nbackground: ") + m_backgroundUrl));
}
public function get mapUrl():String{
return (m_mapUrl);
}
public function get type():int{
return (m_type);
}
public function get minTime():int{
return (m_minTime);
}
}
}//package data
Section 21
//SecretData (data.SecretData)
package data {
import flash.geom.*;
public class SecretData {
private var m_rect:Rectangle;
private var m_entrances:Array;
private var m_id:int;
public function SecretData(_arg1:int, _arg2:Rectangle, _arg3:Array){
m_id = _arg1;
m_rect = _arg2;
m_entrances = _arg3;
}
public function get rect():Rectangle{
return (m_rect);
}
public function get id():int{
return (m_id);
}
public function get entrances():Array{
return (m_entrances);
}
}
}//package data
Section 22
//SummaryData (data.SummaryData)
package data {
public class SummaryData {
private var m_timeBonus:int;
private var m_pointsGame:int;
private var m_time:int;
private var m_marbz:int;
private var m_secrets:int;
private var m_percent:int;
private var m_rare:int;
private var m_points:int;
public function SummaryData(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):void{
m_percent = _arg1;
m_time = _arg2;
m_marbz = _arg3;
m_rare = _arg4;
m_secrets = _arg5;
m_points = _arg6;
m_pointsGame = _arg7;
m_timeBonus = _arg8;
}
public function get secrets():int{
return (m_secrets);
}
public function get percent():int{
return (m_percent);
}
public function get time():int{
return (m_time);
}
public function get timeBonus():int{
return (m_timeBonus);
}
public function get points():int{
return (m_points);
}
public function get rare():int{
return (m_rare);
}
public function get marbz():int{
return (m_marbz);
}
public function get pointsGame():int{
return (m_pointsGame);
}
}
}//package data
Section 23
//ActiveObjectEvent (events.ActiveObjectEvent)
package events {
import flash.events.*;
public class ActiveObjectEvent extends Event {
private var m_gridX:int;
private var m_gridY:int;
public static const REMOVED:String = "onRemoved";
public function ActiveObjectEvent(_arg1:String, _arg2:int=-1, _arg3:int=-1, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
m_gridX = _arg2;
m_gridY = _arg3;
}
public function get gridX():int{
return (m_gridX);
}
public function get gridY():int{
return (m_gridY);
}
override public function toString():String{
return (formatToString("ActiveObjectEvent", "type", "gridX", "gridY", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new ActiveObjectEvent(type, gridX, gridY, bubbles, cancelable));
}
}
}//package events
Section 24
//BlockadeEvent (events.BlockadeEvent)
package events {
import flash.events.*;
public class BlockadeEvent extends Event {
private var m_distance:int;
private var m_blockadeX:int;
private var m_dir:int;
public static const NEXT_TO_BLOCKADE:String = "onNextToBlockade";
public function BlockadeEvent(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean=false, _arg6:Boolean=false){
super(_arg1, _arg5, _arg6);
m_blockadeX = _arg2;
m_dir = _arg3;
m_distance = _arg4;
}
public function get blockadeX():int{
return (m_blockadeX);
}
override public function toString():String{
return (formatToString("BlockadeEvent", "type", "blockadeX", "dir", "distance", "bubbles", "cancelable", "eventPhase"));
}
public function get dir():int{
return (m_dir);
}
public function get distance():int{
return (m_distance);
}
override public function clone():Event{
return (new BlockadeEvent(type, blockadeX, dir, distance, bubbles, cancelable));
}
}
}//package events
Section 25
//BrickEvent (events.BrickEvent)
package events {
import flash.events.*;
public class BrickEvent extends Event {
public static const CRUSH:String = "onCrush";
public function BrickEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("BrickEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new BrickEvent(type, bubbles, cancelable));
}
}
}//package events
Section 26
//BumperEvent (events.BumperEvent)
package events {
import flash.events.*;
public class BumperEvent extends Event {
private var m_speedY:Number;
private var m_speedX:Number;
public static const BUMP:String = "onBump";
public function BumperEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
m_speedX = _arg2;
m_speedY = _arg3;
}
public function get speedX():Number{
return (m_speedX);
}
public function get speedY():Number{
return (m_speedY);
}
override public function toString():String{
return (formatToString("BumperEvent", "type", "speedX", "speedY", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new BumperEvent(type, speedX, speedY, bubbles, cancelable));
}
}
}//package events
Section 27
//DoorEvent (events.DoorEvent)
package events {
import flash.events.*;
public class DoorEvent extends Event {
private var m_dir:int;
private var m_id:int;
private var m_doorX:int;
public static const NEXT_TO_DOOR:String = "onNextToDoor";
public function DoorEvent(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean=false, _arg6:Boolean=false){
super(_arg1, _arg5, _arg6);
m_doorX = _arg2;
m_dir = _arg3;
m_id = _arg4;
}
public function get doorX():int{
return (m_doorX);
}
override public function toString():String{
return (formatToString("DoorEvent", "type", "doorX", "dir", "id", "bubbles", "cancelable", "eventPhase"));
}
public function get dir():int{
return (m_dir);
}
public function get id():int{
return (m_id);
}
override public function clone():Event{
return (new DoorEvent(type, doorX, dir, id, bubbles, cancelable));
}
}
}//package events
Section 28
//HeroEvent (events.HeroEvent)
package events {
import flash.events.*;
public class HeroEvent extends Event {
private var m_damageValue:Number;
private var m_damageSide:int;
public static const ENEMY_CLOSE:String = "onEnemyClose";
public static const SIDE_TOP:int = 0;
public static const DAMAGE:String = "onGetDamage";
public static const SIDE_BOTTOM:int = 2;
public static const DEATH_ANIM_END:String = "onDeathAnimEnd";
public static const HIT_ENEMY:String = "onHitEnemy";
public static const EXIT:String = "onExit";
public function HeroEvent(_arg1:String, _arg2:Number=0, _arg3:int=0, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
m_damageValue = _arg2;
m_damageSide = _arg3;
}
public function get damageValue():Number{
return (m_damageValue);
}
public function get damageSide():int{
return (m_damageSide);
}
override public function toString():String{
return (formatToString("HeroEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new HeroEvent(type, damageValue, damageSide, bubbles, cancelable));
}
}
}//package events
Section 29
//ItemEvent (events.ItemEvent)
package events {
import flash.events.*;
public class ItemEvent extends Event {
private var m_gridX:int;
private var m_gridY:int;
private var m_itemType:int;
public static const REMOVED:String = "onRemove";
public static const COLLECTED:String = "onCollected";
public function ItemEvent(_arg1:String, _arg2:int=-1, _arg3:int=-1, _arg4:int=-1, _arg5:Boolean=false, _arg6:Boolean=false){
super(_arg1, _arg5, _arg6);
m_itemType = _arg2;
m_gridX = _arg3;
m_gridY = _arg4;
}
override public function toString():String{
return (formatToString("ItemEvent", "type", "itemType", "gridX", "gridY", "bubbles", "cancelable", "eventPhase"));
}
public function get itemType():int{
return (m_itemType);
}
public function get gridX():int{
return (m_gridX);
}
public function get gridY():int{
return (m_gridY);
}
override public function clone():Event{
return (new ItemEvent(type, itemType, gridX, gridY, bubbles, cancelable));
}
}
}//package events
Section 30
//ObjectEvent (events.ObjectEvent)
package events {
import flash.events.*;
public class ObjectEvent extends Event {
private var m_object;
public function ObjectEvent(_arg1:String, _arg2, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
m_object = _arg2;
}
override public function toString():String{
return (formatToString("ObjectEvent", "type", "object", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new ObjectEvent(type, object, bubbles, cancelable));
}
public function get object(){
return (m_object);
}
}
}//package events
Section 31
//PlatformEvent (events.PlatformEvent)
package events {
import flash.events.*;
public class PlatformEvent extends Event {
private var m_speedX:Number;
private var m_speedY:Number;
private var m_dY:Number;
public static const STAND:String = "onStand";
public function PlatformEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false, _arg6:Boolean=false){
super(_arg1, _arg5, _arg6);
m_dY = _arg2;
m_speedX = _arg3;
m_speedY = _arg4;
}
override public function toString():String{
return (formatToString("PlatformEvent", "type", "dY", "speedX", "speedY", "bubbles", "cancelable", "eventPhase"));
}
public function get speedX():Number{
return (m_speedX);
}
public function get speedY():Number{
return (m_speedY);
}
public function get dY():Number{
return (m_dY);
}
override public function clone():Event{
return (new PlatformEvent(type, dY, speedX, speedY, bubbles, cancelable));
}
}
}//package events
Section 32
//SavepointEvent (events.SavepointEvent)
package events {
import flash.events.*;
public class SavepointEvent extends Event {
private var m_gridX:int;
private var m_gridY:int;
private var m_dir:int;
public static const ACTIVATE:String = "onActivate";
public function SavepointEvent(_arg1:String, _arg2:int=-1, _arg3:int=-1, _arg4:int=1, _arg5:Boolean=false, _arg6:Boolean=false){
super(_arg1, _arg5, _arg6);
m_gridX = _arg2;
m_gridY = _arg3;
m_dir = _arg4;
}
override public function toString():String{
return (formatToString("SavepointEvent", "type", "gridX", "gridY", "dir", "bubbles", "cancelable", "eventPhase"));
}
public function get dir():int{
return (m_dir);
}
public function get gridX():int{
return (m_gridX);
}
public function get gridY():int{
return (m_gridY);
}
override public function clone():Event{
return (new SavepointEvent(type, gridX, gridY, dir, bubbles, cancelable));
}
}
}//package events
Section 33
//ShotEvent (events.ShotEvent)
package events {
import flash.events.*;
public class ShotEvent extends Event {
private var m_angle:int;
private var m_posX:int;
private var m_posY:int;
private var m_dir:int;
public static const REMOVE:String = "onRemoveShot";
public static const CREATE_GRENADE:String = "onCreateGrenade";
public static const CREATE:String = "onCreate";
public function ShotEvent(_arg1:String, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:int=-1000, _arg6:Boolean=false, _arg7:Boolean=false){
super(_arg1, _arg6, _arg7);
m_posX = _arg2;
m_posY = _arg3;
m_dir = _arg4;
m_angle = _arg5;
}
public function get posX():int{
return (m_posX);
}
override public function toString():String{
return (formatToString("ShotEvent", "type", "posX", "posY", "dir", "angle", "bubbles", "cancelable", "eventPhase"));
}
public function get dir():int{
return (m_dir);
}
public function get posY():int{
return (m_posY);
}
public function get angle():int{
return (m_angle);
}
override public function clone():Event{
return (new ShotEvent(type, posX, posY, dir, angle, bubbles, cancelable));
}
}
}//package events
Section 34
//TriggerEvent (events.TriggerEvent)
package events {
import flash.events.*;
public class TriggerEvent extends Event {
private var m_id:int;
public static const PRESSED:String = "onPressed";
public function TriggerEvent(_arg1:String, _arg2:int, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
m_id = _arg2;
}
public function get id():int{
return (m_id);
}
override public function toString():String{
return (formatToString("TriggerEvent", "type", "id", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new TriggerEvent(type, id, bubbles, cancelable));
}
}
}//package events
Section 35
//ViewEvent (events.ViewEvent)
package events {
import flash.events.*;
public class ViewEvent extends Event {
private var m_gridX:int;
private var m_gridY:int;
public static const INSERT_OBJECT:String = "onInsertObject";
public static const CAMERA_ON_TARGET:String = "onCameraOnTarget";
public static const TARGET_ON_SCREEN:String = "onTargetOnScreen";
public function ViewEvent(_arg1:String, _arg2:int=-1, _arg3:int=-1, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
m_gridX = _arg2;
m_gridY = _arg3;
}
public function get gridX():int{
return (m_gridX);
}
public function get gridY():int{
return (m_gridY);
}
override public function toString():String{
return (formatToString("ViewEvent", "type", "gridX", "gridY", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new ViewEvent(type, gridX, gridY, bubbles, cancelable));
}
}
}//package events
Section 36
//AutoLayoutEvent (fl.video.AutoLayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class AutoLayoutEvent extends LayoutEvent implements IVPEvent {
private var _vp:uint;
public static const AUTO_LAYOUT:String = "autoLayout";
public function AutoLayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
override public function clone():Event{
return (new AutoLayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone()), vp));
}
}
}//package fl.video
Section 37
//ConnectClient (fl.video.ConnectClient)
package fl.video {
import flash.net.*;
public class ConnectClient {
public var owner:NCManager;
public var nc:NetConnection;
public var connIndex:uint;
public var pending:Boolean;
public function ConnectClient(_arg1:NCManager, _arg2:NetConnection, _arg3:uint=0){
this.owner = _arg1;
this.nc = _arg2;
this.connIndex = _arg3;
this.pending = false;
}
public function onBWCheck(... _args):Number{
return (++owner._payload);
}
public function close():void{
}
public function onBWDone(... _args):void{
var _local2:Number;
if (_args.length > 0){
_local2 = _args[0];
};
owner.onConnected(nc, _local2);
}
}
}//package fl.video
Section 38
//ControlData (fl.video.ControlData)
package fl.video {
import flash.display.*;
public class ControlData {
public var state_mc:Array;
public var origWidth:Number;
public var handle_mc:Sprite;
public var fullness_mc:DisplayObject;
public var state:uint;
public var leftMargin:Number;
public var isDragging:Boolean;
public var currentState_mc:DisplayObject;
public var percentage:Number;
public var owner:DisplayObject;
public var origX:Number;
public var origY:Number;
public var bottomMargin:Number;
public var disabled_mc:DisplayObject;
public var enabled:Boolean;
public var hit_mc:Sprite;
public var origHeight:Number;
public var index:int;
public var mask_mc:DisplayObject;
public var avatar:DisplayObject;
public var cachedFocusRect:Boolean;
public var captureFocus:Boolean;
public var fill_mc:DisplayObject;
public var topMargin:Number;
public var uiMgr:UIManager;
public var progress_mc:DisplayObject;
public var rightMargin:Number;
public var ctrl:DisplayObject;
public var origScaleX:Number;
public var origScaleY:Number;
public function ControlData(_arg1:UIManager, _arg2:DisplayObject, _arg3:DisplayObject, _arg4:int){
var uiMgr = _arg1;
var ctrl = _arg2;
var owner = _arg3;
var index = _arg4;
super();
this.uiMgr = uiMgr;
this.index = index;
this.ctrl = ctrl;
this.owner = owner;
try {
ctrl["uiMgr"] = uiMgr;
} catch(re:ReferenceError) {
};
}
}
}//package fl.video
Section 39
//CuePointManager (fl.video.CuePointManager)
package fl.video {
public class CuePointManager {
flvplayback_internal var _disabledCuePointsByNameOnly:Object;
flvplayback_internal var navCuePoints:Array;
flvplayback_internal var allCuePoints:Array;
flvplayback_internal var _disabledCuePoints:Array;
flvplayback_internal var _asCuePointTolerance:Number;
flvplayback_internal var _linearSearchTolerance:Number;
flvplayback_internal var _asCuePointIndex:int;
flvplayback_internal var asCuePoints:Array;
flvplayback_internal var flvCuePoints:Array;
flvplayback_internal var _metadataLoaded:Boolean;
flvplayback_internal var _id:uint;
private var _owner:FLVPlayback;
flvplayback_internal var eventCuePoints:Array;
public static const SHORT_VERSION:String = "2.1";
public static const VERSION:String = "2.1.0.20";
flvplayback_internal static const DEFAULT_LINEAR_SEARCH_TOLERANCE:Number = 50;
flvplayback_internal static var cuePointsReplace:Array = [""", "\"", "'", "'", ",", ",", "&", "&"];
public function CuePointManager(_arg1:FLVPlayback, _arg2:uint){
_owner = _arg1;
_id = _arg2;
reset();
_asCuePointTolerance = (_owner.getVideoPlayer(_id).playheadUpdateInterval / 2000);
_linearSearchTolerance = DEFAULT_LINEAR_SEARCH_TOLERANCE;
}
flvplayback_internal function getCuePoint(_arg1:Array, _arg2:Boolean, _arg3):Object{
var _local4:Object;
switch (typeof(_arg3)){
case "string":
_local4 = {name:_arg3};
break;
case "number":
_local4 = {time:_arg3};
break;
case "object":
_local4 = _arg3;
break;
};
var _local5:int = getCuePointIndex(_arg1, _arg2, _local4.time, _local4.name);
if (_local5 < 0){
return (null);
};
_local4 = deepCopyObject(_arg1[_local5]);
_local4.array = _arg1;
_local4.index = _local5;
return (_local4);
}
public function resetASCuePointIndex(_arg1:Number):void{
if ((((_arg1 <= 0)) || ((asCuePoints == null)))){
_asCuePointIndex = 0;
return;
};
var _local2:int = getCuePointIndex(asCuePoints, true, _arg1);
_asCuePointIndex = ((asCuePoints[_local2].time)<_arg1) ? (_local2 + 1) : _local2;
}
public function set playheadUpdateInterval(_arg1:Number):void{
_asCuePointTolerance = (_arg1 / 2000);
}
flvplayback_internal function addOrDisable(_arg1:Boolean, _arg2:Object):void{
if (_arg1){
if (_arg2.type == CuePointType.ACTIONSCRIPT){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "Cannot disable actionscript cue points"));
};
setFLVCuePointEnabled(false, _arg2);
} else {
if (_arg2.type == CuePointType.ACTIONSCRIPT){
addASCuePoint(_arg2);
};
};
}
public function processFLVCuePoints(_arg1:Array):void{
var _local2:int;
var _local4:Object;
_metadataLoaded = true;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
return;
};
flvCuePoints = _arg1;
navCuePoints = new Array();
eventCuePoints = new Array();
var _local3:Number = -1;
var _local5:Array = _disabledCuePoints;
var _local6:Number = 0;
_disabledCuePoints = new Array();
var _local7:int;
while ((_local4 = flvCuePoints[_local7++]) != undefined) {
if ((((_local3 > 0)) && ((_local3 >= _local4.time)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, ("Unsorted cuePoint found after time: " + _local3)));
};
_local3 = _local4.time;
while ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, null, _local4) < 0)))) {
_local6++;
};
if (((!((_disabledCuePointsByNameOnly[_local4.name] == undefined))) || ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, _local5[_local6].name, _local4) == 0)))))){
_disabledCuePoints.push({time:_local4.time, name:_local4.name});
};
if (_local4.type == CuePointType.NAVIGATION){
navCuePoints.push(_local4);
} else {
if (_local4.type == CuePointType.EVENT){
eventCuePoints.push(_local4);
};
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local2 = getCuePointIndex(allCuePoints, true, _local4.time);
_local2 = ((allCuePoints[_local2].time)>_local4.time) ? 0 : (_local2 + 1);
allCuePoints.splice(_local2, 0, _local4);
};
};
_disabledCuePointsByNameOnly = new Object();
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:Object;
var _local7:int;
var _local10:int;
if (typeof(_arg1) == "object"){
_local4 = deepCopyObject(_arg1);
} else {
_local4 = {time:_arg1, name:_arg2, parameters:deepCopyObject(_arg3)};
};
if (_local4.parameters == null){
delete _local4.parameters;
};
var _local5:Boolean = ((isNaN(_local4.time)) || ((_local4.time < 0)));
if (_local5){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
var _local6 = (_local4.name == null);
if (_local6){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
_local4.type = CuePointType.ACTIONSCRIPT;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
_local7 = 0;
asCuePoints = new Array();
asCuePoints.push(_local4);
} else {
_local7 = getCuePointIndex(asCuePoints, true, _local4.time);
_local7 = ((asCuePoints[_local7].time)>_local4.time) ? 0 : (_local7 + 1);
asCuePoints.splice(_local7, 0, _local4);
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local10 = getCuePointIndex(allCuePoints, true, _local4.time);
_local10 = ((allCuePoints[_local10].time)>_local4.time) ? 0 : (_local10 + 1);
allCuePoints.splice(_local10, 0, _local4);
};
var _local8:Number = _owner.getVideoPlayer(_id).playheadTime;
if (_local8 > 0){
if (_asCuePointIndex == _local7){
if (_local8 > asCuePoints[_local7].time){
_asCuePointIndex++;
};
} else {
if (_asCuePointIndex > _local7){
_asCuePointIndex++;
};
};
} else {
_asCuePointIndex = 0;
};
var _local9:Object = deepCopyObject(asCuePoints[_local7]);
_local9.array = asCuePoints;
_local9.index = _local7;
return (_local9);
}
public function get metadataLoaded():Boolean{
return (_metadataLoaded);
}
public function reset():void{
_metadataLoaded = false;
allCuePoints = null;
asCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_asCuePointIndex = 0;
}
public function removeCuePoints(_arg1:Array, _arg2:Object):Number{
var _local3:int;
var _local4:Object;
var _local5:int;
_local3 = getCuePointIndex(_arg1, true, -1, _arg2.name);
while (_local3 >= 0) {
_local4 = _arg1[_local3];
_arg1.splice(_local3, 1);
_local3--;
_local5++;
_local3 = getNextCuePointIndexWithName(_local4.name, _arg1, _local3);
};
return (_local5);
}
flvplayback_internal function unescape(_arg1:String):String{
var _local2:String = _arg1;
var _local3:int;
while (_local3 < cuePointsReplace.length) {
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local2 = _local2.replace(cuePointsReplace[_temp1], cuePointsReplace[_temp2]);
};
return (_local2);
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):int{
var _local3:Object;
var _local7:int;
var _local8:int;
var _local9:Object;
switch (typeof(_arg2)){
case "string":
_local3 = {name:_arg2};
break;
case "number":
_local3 = {time:_arg2};
break;
case "object":
_local3 = _arg2;
break;
};
var _local4:Boolean = ((isNaN(_local3.time)) || ((_local3.time < 0)));
var _local5 = (_local3.name == null);
if (((_local4) && (_local5))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
var _local6:uint;
if (_local4){
if (!_metadataLoaded){
if (_disabledCuePointsByNameOnly[_local3.name] == undefined){
if (!_arg1){
_disabledCuePointsByNameOnly[_local3.name] = new Array();
};
} else {
if (_arg1){
delete _disabledCuePointsByNameOnly[_local3.name];
};
return (-1);
};
removeCuePoints(_disabledCuePoints, _local3);
return (-1);
};
if (_arg1){
_local6 = removeCuePoints(_disabledCuePoints, _local3);
} else {
_local7 = getCuePointIndex(flvCuePoints, true, -1, _local3.name);
while (_local7 >= 0) {
_local9 = flvCuePoints[_local7];
_local8 = getCuePointIndex(_disabledCuePoints, true, _local9.time);
if ((((_local8 < 0)) || (!((_disabledCuePoints[_local8].time == _local9.time))))){
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, {name:_local9.name, time:_local9.time});
_local6 = (_local6 + 1);
};
_local7 = getNextCuePointIndexWithName(_local9.name, flvCuePoints, _local7);
};
};
return (_local6);
};
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
if (_arg1){
if (!_metadataLoaded){
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time);
if (_local7 < 0){
_local8 = getCuePointIndex(_disabledCuePointsByNameOnly[_local3.name], true, _local3.time);
if (cuePointCompare(_local3.time, null, _disabledCuePointsByNameOnly[_local3.name]) != 0){
_disabledCuePointsByNameOnly[_local3.name] = insertCuePoint(_local8, _disabledCuePointsByNameOnly[_local3.name], _local3);
};
} else {
_disabledCuePoints.splice(_local7, 1);
};
};
return ((_metadataLoaded) ? 0 : -1);
};
} else {
if (_arg1){
_disabledCuePoints.splice(_local7, 1);
_local6 = 1;
} else {
_local6 = 0;
};
return ((_metadataLoaded) ? _local6 : -1);
};
if (_metadataLoaded){
_local7 = getCuePointIndex(flvCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
return (0);
};
if (_local5){
_local3.name = flvCuePoints[_local7].name;
};
};
_local8 = getCuePointIndex(_disabledCuePoints, true, _local3.time);
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, _local3);
_local6 = 1;
return ((_metadataLoaded) ? _local6 : -1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:Object;
var _local5:int;
if (!_metadataLoaded){
return (true);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
var _local3:Boolean = ((isNaN(_local2.time)) || ((_local2.time < 0)));
var _local4 = (_local2.name == null);
if (((_local3) && (_local4))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_local3){
_local5 = getCuePointIndex(flvCuePoints, true, -1, _local2.name);
if (_local5 < 0){
return (true);
};
while (_local5 >= 0) {
if (getCuePointIndex(_disabledCuePoints, false, flvCuePoints[_local5].time, flvCuePoints[_local5].name) < 0){
return (true);
};
_local5 = getNextCuePointIndexWithName(_local2.name, flvCuePoints, _local5);
};
return (false);
};
return ((getCuePointIndex(_disabledCuePoints, false, _local2.time, _local2.name) < 0));
}
public function removeASCuePoint(_arg1):Object{
var _local2:Object;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
return (null);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
var _local3:int = getCuePointIndex(asCuePoints, false, _local2.time, _local2.name);
if (_local3 < 0){
return (null);
};
_local2 = asCuePoints[_local3];
asCuePoints.splice(_local3, 1);
_local3 = getCuePointIndex(allCuePoints, false, _local2.time, _local2.name);
if (_local3 > 0){
allCuePoints.splice(_local3, 1);
};
if (_owner.getVideoPlayer(_id).playheadTime > 0){
if (_asCuePointIndex > _local3){
_asCuePointIndex--;
};
} else {
_asCuePointIndex = 0;
};
return (_local2);
}
public function get id():uint{
return (_id);
}
public function processCuePointsProperty(_arg1:Array):void{
var _local3:uint;
var _local4:String;
var _local5:String;
var _local6:Object;
var _local7:Boolean;
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
var _local2:uint;
var _local8:int;
while (_local8 < (_arg1.length - 1)) {
switch (_local2){
case 6:
addOrDisable(_local7, _local6);
_local2 = 0;
case 0:
var _temp1 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp1] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local6 = new Object();
_local6.time = (_arg1[_local8] / 1000);
_local2++;
break;
case 1:
var _temp2 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp2] != "n"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (_arg1[_local8] == undefined){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be null or undefined"));
};
_local6.name = unescape(_arg1[_local8]);
_local2++;
break;
case 2:
var _temp3 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp3] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be number"));
};
switch (_arg1[_local8]){
case 0:
_local6.type = CuePointType.EVENT;
break;
case 1:
_local6.type = CuePointType.NAVIGATION;
break;
case 2:
_local6.type = CuePointType.ACTIONSCRIPT;
break;
default:
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be 0, 1 or 2"));
};
_local2++;
break;
case 3:
var _temp4 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp4] != "d"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "disabled must be number"));
};
_local7 = !((_arg1[_local8] == 0));
_local2++;
break;
case 4:
var _temp5 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp5] != "p"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "num params must be number"));
};
_local3 = _arg1[_local8];
_local2++;
if (_local3 == 0){
_local2++;
} else {
_local6.parameters = new Object();
};
break;
case 5:
var _temp6 = _local8;
_local8 = (_local8 + 1);
_local4 = _arg1[_temp6];
_local5 = _arg1[_local8];
if ((_local4 is String)){
_local4 = unescape(_local4);
};
if ((_local5 is String)){
_local5 = unescape(_local5);
};
_local6.parameters[_local4] = _local5;
_local3--;
if (_local3 == 0){
_local2++;
};
break;
};
_local8++;
};
if (_local2 == 6){
addOrDisable(_local7, _local6);
} else {
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected end of cuePoint param string"));
};
}
flvplayback_internal function getNextCuePointIndexWithName(_arg1:String, _arg2:Array, _arg3:int):int{
var _local4:int;
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
if (_arg2 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.array undefined"));
};
if (((((isNaN(_arg3)) || ((_arg3 < -1)))) || ((_arg3 >= _arg2.length)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.index must be number between -1 and cuePoint.array.length"));
};
_local4 = (_arg3 + 1);
while (_local4 < _arg2.length) {
if (_arg2[_local4].name == _arg1){
break;
};
_local4++;
};
if (_local4 < _arg2.length){
return (_local4);
};
return (-1);
}
public function dispatchASCuePoints():void{
var _local1:Number = _owner.getVideoPlayer(_id).playheadTime;
if (((_owner.getVideoPlayer(_id).stateResponsive) && (!((asCuePoints == null))))){
while ((((_asCuePointIndex < asCuePoints.length)) && ((asCuePoints[_asCuePointIndex].time <= (_local1 + _asCuePointTolerance))))) {
_owner.dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, deepCopyObject(asCuePoints[_asCuePointIndex++]), _id));
};
};
}
flvplayback_internal function getNextCuePointWithName(_arg1:Object):Object{
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint parameter undefined"));
};
if (((isNaN(_arg1.time)) || ((_arg1.time < 0)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
var _local2:int = getNextCuePointIndexWithName(_arg1.name, _arg1.array, _arg1.index);
if (_local2 < 0){
return (null);
};
var _local3:Object = deepCopyObject(_arg1.array[_local2]);
_local3.array = _arg1.array;
_local3.index = _local2;
return (_local3);
}
public function insertCuePoint(_arg1:int, _arg2:Array, _arg3:Object):Array{
if (_arg1 < 0){
_arg2 = new Array();
_arg2.push(_arg3);
} else {
if (_arg2[_arg1].time > _arg3.time){
_arg1 = 0;
} else {
_arg1++;
};
_arg2.splice(_arg1, 0, _arg3);
};
return (_arg2);
}
flvplayback_internal function getCuePointIndex(_arg1:Array, _arg2:Boolean, _arg3:Number=NaN, _arg4:String=null, _arg5:int=-1, _arg6:int=-1):int{
var _local9:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
return (-1);
};
var _local7:Boolean = ((isNaN(_arg3)) || ((_arg3 < 0)));
var _local8 = (_arg4 == null);
if (((_local7) && (_local8))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = _arg1.length;
};
if (((!(_local8)) && (((_arg2) || (_local7))))){
if (_local7){
_local12 = _arg5;
} else {
_local12 = getCuePointIndex(_arg1, _arg2, _arg3);
};
_local13 = _local12;
while (_local13 >= _arg5) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13--;
};
if (_local13 >= _arg5){
return (_local13);
};
_local13 = (_local12 + 1);
while (_local13 < _arg6) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13++;
};
if (_local13 < _arg6){
return (_local13);
};
return (-1);
};
if (_arg6 <= _linearSearchTolerance){
_local14 = (_arg5 + _arg6);
_local15 = _arg5;
while (_local15 < _local14) {
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local15]);
if (_local9 == 0){
return (_local15);
};
if (_local9 < 0){
break;
};
_local15++;
};
if (_arg2){
if (_local15 > 0){
return ((_local15 - 1));
};
return (0);
};
return (-1);
};
var _local10:int = int((_arg6 / 2));
var _local11:int = (_arg5 + _local10);
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local11]);
if (_local9 < 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, _arg5, _local10));
};
if (_local9 > 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, (_local11 + 1), ((_local10 - 1) + (_arg6 % 2))));
};
return (_local11);
}
flvplayback_internal static function deepCopyObject(_arg1:Object, _arg2:uint=0):Object{
var _local4:*;
if (_arg1 == null){
return (_arg1);
};
var _local3:Object = new Object();
for (_local4 in _arg1) {
if ((((_arg2 == 0)) && ((((_local4 == "array")) || ((_local4 == "index")))))){
} else {
if (typeof(_arg1[_local4]) == "object"){
_local3[_local4] = deepCopyObject(_arg1[_local4], (_arg2 + 1));
} else {
_local3[_local4] = _arg1[_local4];
};
};
};
return (_local3);
}
flvplayback_internal static function cuePointCompare(_arg1:Number, _arg2:String, _arg3:Object):int{
var _local4:Number = Math.round((_arg1 * 1000));
var _local5:Number = Math.round((_arg3.time * 1000));
if (_local4 < _local5){
return (-1);
};
if (_local4 > _local5){
return (1);
};
if (_arg2 != null){
if (_arg2 == _arg3.name){
return (0);
};
if (_arg2 < _arg3.name){
return (-1);
};
return (1);
};
return (0);
}
}
}//package fl.video
Section 40
//CuePointType (fl.video.CuePointType)
package fl.video {
public final class CuePointType {
public static const FLV:String = "flv";
public static const ALL:String = "all";
public static const ACTIONSCRIPT:String = "actionscript";
public static const EVENT:String = "event";
public static const NAVIGATION:String = "navigation";
}
}//package fl.video
Section 41
//FLVPlayback (fl.video.FLVPlayback)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class FLVPlayback extends Sprite {
private var _playheadUpdateInterval:Number;
private var _align:String;
flvplayback_internal var videoPlayerStateDict:Dictionary;
flvplayback_internal var cuePointMgrs:Array;
private var _volume:Number;
flvplayback_internal var videoPlayerStates:Array;
private var _origHeight:Number;
private var _progressInterval:Number;
private var _origWidth:Number;
private var _seekToPrevOffset:Number;
private var _scaleMode:String;
flvplayback_internal var resizingNow:Boolean;
flvplayback_internal var videoPlayers:Array;
private var _bufferTime:Number;
private var _aspectRatio:Boolean;
flvplayback_internal var uiMgr:UIManager;
private var previewImage_mc:Loader;
private var _autoRewind:Boolean;
private var _componentInspectorSetting:Boolean;
flvplayback_internal var _firstStreamShown:Boolean;
private var _visibleVP:uint;
private var _idleTimeout:Number;
private var _soundTransform:SoundTransform;
flvplayback_internal var skinShowTimer:Timer;
public var boundingBox_mc:DisplayObject;
private var preview_mc:MovieClip;
private var livePreviewHeight:Number;
flvplayback_internal var _firstStreamReady:Boolean;
private var _activeVP:uint;
private var isLivePreview:Boolean;
private var _topVP:uint;
private var livePreviewWidth:Number;
private var __forceNCMgr:NCManager;
private var previewImageUrl:String;
public static const SEEK_TO_PREV_OFFSET_DEFAULT:Number = 1;
public static const SHORT_VERSION:String = "2.1";
flvplayback_internal static const skinShowTimerInterval:Number = 2000;
public static const VERSION:String = "2.1.0.20";
flvplayback_internal static const DEFAULT_SKIN_SHOW_TIMER_INTERVAL:Number = 2000;
public function FLVPlayback(){
mouseEnabled = false;
isLivePreview = ((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")));
_componentInspectorSetting = false;
var _local1:Number = rotation;
rotation = 0;
_origWidth = super.width;
_origHeight = super.height;
super.scaleX = 1;
super.scaleY = 1;
rotation = _local1;
var _local2:VideoPlayer = new VideoPlayer(0, 0);
_local2.setSize(_origWidth, _origHeight);
videoPlayers = new Array();
videoPlayers[0] = _local2;
_align = _local2.align;
_autoRewind = _local2.autoRewind;
_scaleMode = _local2.scaleMode;
_bufferTime = _local2.bufferTime;
_idleTimeout = _local2.idleTimeout;
_playheadUpdateInterval = _local2.playheadUpdateInterval;
_progressInterval = _local2.progressInterval;
_soundTransform = _local2.soundTransform;
_volume = _local2.volume;
_seekToPrevOffset = SEEK_TO_PREV_OFFSET_DEFAULT;
_firstStreamReady = false;
_firstStreamShown = false;
resizingNow = false;
uiMgr = new UIManager(this);
if (isLivePreview){
uiMgr.visible = true;
};
_activeVP = 0;
_visibleVP = 0;
_topVP = 0;
videoPlayerStates = new Array();
videoPlayerStateDict = new Dictionary(true);
cuePointMgrs = new Array();
createVideoPlayer(0);
boundingBox_mc.visible = false;
removeChild(boundingBox_mc);
boundingBox_mc = null;
if (isLivePreview){
previewImageUrl = "";
createLivePreviewMovieClip();
setSize(_origWidth, _origHeight);
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
var _local6:VideoPlayer;
var _local3:Rectangle = new Rectangle(x, y, width, height);
var _local4:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
var _local5:int;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 !== null){
_local6.setSize((_origWidth * _arg1), (_origWidth * _arg2));
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
public function stop():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.STOP);
} else {
_local2 = videoPlayers[_activeVP];
_local2.stop();
};
}
public function set align(_arg1:String):void{
if (_activeVP == 0){
_align = _arg1;
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.align = _arg1;
}
public function getVideoPlayer(_arg1:Number):VideoPlayer{
return (videoPlayers[_arg1]);
}
public function get playheadTime():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.playheadTime);
}
public function get seekBarScrubTolerance():Number{
return (uiMgr.seekBarScrubTolerance);
}
public function get progressInterval():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.progressInterval);
}
public function set skinFadeTime(_arg1:int):void{
uiMgr.skinFadeTime = _arg1;
}
public function get scaleMode():String{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.scaleMode);
}
public function get skinFadeTime():int{
return (uiMgr.skinFadeTime);
}
public function get seekToPrevOffset():Number{
return (_seekToPrevOffset);
}
public function set scaleMode(_arg1:String):void{
if (_activeVP == 0){
_scaleMode = _arg1;
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.scaleMode = _arg1;
}
public function get source():String{
var _local1:VideoPlayerState = videoPlayerStates[_activeVP];
if (_local1.isWaiting){
return (_local1.url);
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
return (_local2.source);
}
public function get activeVideoPlayerIndex():uint{
return (_activeVP);
}
public function set bufferingBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BUFFERING_BAR, _arg1);
}
public function get ncMgr():INCManager{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.ncMgr);
}
public function closeVideoPlayer(_arg1:uint):void{
if (_arg1 == 0){
throw (new VideoError(VideoError.DELETE_DEFAULT_PLAYER));
};
if (videoPlayers[_arg1] == undefined){
return;
};
var _local2:VideoPlayer = videoPlayers[_arg1];
if (_visibleVP == _arg1){
visibleVideoPlayerIndex = 0;
};
if (_activeVP == _arg1){
activeVideoPlayerIndex = 0;
};
removeChild(_local2);
_local2.close();
delete videoPlayers[_arg1];
delete videoPlayerStates[_arg1];
delete videoPlayerStateDict[_local2];
}
public function assignTabIndexes(_arg1:int):int{
if (tabIndex){
tabEnabled = false;
tabChildren = true;
if (isNaN(_arg1)){
_arg1 = tabIndex;
};
};
var _local2:int = uiMgr.assignTabIndexes(_arg1);
return (_local2);
}
public function set progressInterval(_arg1:Number):void{
if (_activeVP == 0){
_progressInterval = _arg1;
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.progressInterval = _arg1;
}
public function get metadataLoaded():Boolean{
var _local1:CuePointManager = cuePointMgrs[_activeVP];
return (_local1.metadataLoaded);
}
public function get playing():Boolean{
return ((state == VideoState.PLAYING));
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
public function get totalTime():Number{
if (isLivePreview){
return (1);
};
var _local1:VideoPlayerState = videoPlayerStates[_activeVP];
if (_local1.totalTimeSet){
return (_local1.totalTime);
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
return (_local2.totalTime);
}
public function set seekToPrevOffset(_arg1:Number):void{
_seekToPrevOffset = _arg1;
}
public function set volume(_arg1:Number):void{
var _local2:VideoPlayer;
if (_volume == _arg1){
return;
};
_volume = _arg1;
if (!scrubbing){
_local2 = videoPlayers[_visibleVP];
_local2.volume = _volume;
};
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function get skinAutoHide():Boolean{
return (uiMgr.skinAutoHide);
}
public function set source(_arg1:String):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
if (isLivePreview){
return;
};
if (_arg1 == null){
_arg1 = "";
};
if (_componentInspectorSetting){
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
if (_arg1.length > 0){
_local2.isWaiting = true;
addEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
} else {
if (source == _arg1){
return;
};
_local3 = cuePointMgrs[_activeVP];
_local3.reset();
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
_local2.isWaiting = true;
doContentPathConnect(_activeVP);
};
}
public function set activeVideoPlayerIndex(_arg1:uint):void{
if (_activeVP == _arg1){
return;
};
_activeVP = _arg1;
if (videoPlayers[_activeVP] == undefined){
createVideoPlayer(_activeVP);
};
}
override public function set soundTransform(_arg1:SoundTransform):void{
if (_arg1 == null){
return;
};
_volume = _arg1.volume;
_soundTransform.volume = (scrubbing) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.soundTransform = _soundTransform;
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function get endTabIndex():int{
return (uiMgr.endTabIndex);
}
public function seekToNavCuePoint(_arg1):void{
var _local2:Object;
if ((_arg1 is String)){
_local2 = {name:String(_arg1)};
} else {
if ((_arg1 is Number)){
_local2 = {time:Number(_arg1)};
} else {
_local2 = _arg1;
};
};
if (_local2.name == undefined){
seekToNextNavCuePoint(_local2.time);
return;
};
if (isNaN(_local2.time)){
_local2.time = 0;
};
var _local3:Object = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
while (((!((_local3 == null))) && ((((_local3.time < _local2.time)) || (!(isFLVCuePointEnabled(_local3))))))) {
_local3 = findNextCuePointWithName(_local3);
};
if (_local3 == null){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(_local3.time);
}
override public function set height(_arg1:Number):void{
var _local5:VideoPlayer;
if (isLivePreview){
setSize(this.width, _arg1);
return;
};
var _local2:Rectangle = new Rectangle(x, y, width, height);
var _local3:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
var _local4:int;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.height = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
override public function get scaleY():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return ((_local1.height / _origHeight));
}
public function get bytesLoaded():uint{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.bytesLoaded);
}
override public function get scaleX():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return ((_local1.width / _origWidth));
}
public function get forwardButton():Sprite{
return (uiMgr.getControl(UIManager.FORWARD_BUTTON));
}
public function get seekBarInterval():Number{
return (uiMgr.seekBarInterval);
}
public function set bufferTime(_arg1:Number):void{
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.bufferTime = _arg1;
}
public function set totalTime(_arg1:Number):void{
var _local2:VideoPlayerState = videoPlayerStates[_activeVP];
_local2.totalTime = _arg1;
_local2.totalTimeSet = true;
}
public function set skinAutoHide(_arg1:Boolean):void{
if (isLivePreview){
return;
};
uiMgr.skinAutoHide = _arg1;
}
flvplayback_internal function queueCmd(_arg1:VideoPlayerState, _arg2:Number, _arg3:Number=NaN):void{
if (_arg1.cmdQueue == null){
_arg1.cmdQueue = new Array();
};
_arg1.cmdQueue.push(new QueuedCommand(_arg2, null, false, _arg3));
}
public function get fullScreenSkinDelay():int{
return (uiMgr.fullScreenSkinDelay);
}
public function set isLive(_arg1:Boolean):void{
var _local2:VideoPlayerState = videoPlayerStates[_activeVP];
_local2.isLive = _arg1;
_local2.isLiveSet = true;
}
private function onCompletePreview(_arg1:Event):void{
var e = _arg1;
try {
previewImage_mc.width = livePreviewWidth;
previewImage_mc.height = livePreviewHeight;
} catch(e:Error) {
};
}
flvplayback_internal function showSkinNow(_arg1:TimerEvent):void{
skinShowTimer = null;
uiMgr.visible = true;
}
override public function get y():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return ((super.y + _local1.y));
}
public function get seekBar():Sprite{
return (uiMgr.getControl(UIManager.SEEK_BAR));
}
public function get volumeBarInterval():Number{
return (uiMgr.volumeBarInterval);
}
public function seek(_arg1:Number):void{
var _local3:VideoPlayer;
var _local2:VideoPlayerState = videoPlayerStates[_activeVP];
if (!_firstStreamShown){
_local2.preSeekTime = 0;
queueCmd(_local2, QueuedCommand.SEEK, _arg1);
} else {
_local2.preSeekTime = playheadTime;
_local3 = videoPlayers[_activeVP];
_local3.seek(_arg1);
};
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (uiMgr.bufferingBarHidesAndDisablesOthers);
}
flvplayback_internal function skinError(_arg1:String):void{
if (isLivePreview){
return;
};
if (((_firstStreamReady) && (!(_firstStreamShown)))){
showFirstStream();
};
dispatchEvent(new SkinErrorEvent(SkinErrorEvent.SKIN_ERROR, false, false, _arg1));
}
public function get registrationWidth():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return (_local1.registrationWidth);
}
override public function get x():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return ((super.x + _local1.x));
}
public function get state():String{
if (isLivePreview){
return (VideoState.STOPPED);
};
var _local1:VideoPlayer = videoPlayers[_activeVP];
if ((((_activeVP == _visibleVP)) && (scrubbing))){
return (VideoState.SEEKING);
};
var _local2:String = _local1.state;
if (_local2 == VideoState.RESIZING){
return (VideoState.LOADING);
};
var _local3:VideoPlayerState = videoPlayerStates[_activeVP];
if ((((((_local3.prevState == VideoState.LOADING)) && (_local3.autoPlay))) && ((_local2 == VideoState.STOPPED)))){
return (VideoState.LOADING);
};
return (_local2);
}
public function set autoRewind(_arg1:Boolean):void{
if (_activeVP == 0){
_autoRewind = _arg1;
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.autoRewind = _arg1;
}
public function get volumeBar():Sprite{
return (uiMgr.getControl(UIManager.VOLUME_BAR));
}
override public function set scaleY(_arg1:Number):void{
var _local5:VideoPlayer;
var _local2:Rectangle = new Rectangle(x, y, width, height);
var _local3:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
var _local4:int;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.height = (_origHeight * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
flvplayback_internal function createVideoPlayer(_arg1:Number):void{
var skinDepth:int;
var index = _arg1;
if (isLivePreview){
return;
};
var vp:VideoPlayer = videoPlayers[index];
if (vp == null){
var _local3 = new VideoPlayer(0, 0);
vp = _local3;
videoPlayers[index] = _local3;
vp.setSize(registrationWidth, registrationHeight);
};
vp.visible = false;
vp.volume = 0;
vp.name = String(index);
var added:Boolean;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
addChildAt(vp, skinDepth);
added = true;
};
} catch(err:Error) {
};
};
if (!added){
addChild(vp);
};
_topVP = index;
vp.autoRewind = _autoRewind;
vp.scaleMode = _scaleMode;
vp.bufferTime = _bufferTime;
vp.idleTimeout = _idleTimeout;
vp.playheadUpdateInterval = _playheadUpdateInterval;
vp.progressInterval = _progressInterval;
vp.soundTransform = _soundTransform;
var vpState:VideoPlayerState = new VideoPlayerState(vp, index);
videoPlayerStates[index] = vpState;
videoPlayerStateDict[vp] = vpState;
vp.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleAutoLayoutEvent);
vp.addEventListener(MetadataEvent.CUE_POINT, handleMetadataEvent);
vp.addEventListener(MetadataEvent.METADATA_RECEIVED, handleMetadataEvent);
vp.addEventListener(VideoProgressEvent.PROGRESS, handleVideoProgressEvent);
vp.addEventListener(VideoEvent.AUTO_REWOUND, handleVideoEvent);
vp.addEventListener(VideoEvent.CLOSE, handleVideoEvent);
vp.addEventListener(VideoEvent.COMPLETE, handleVideoEvent);
vp.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleVideoEvent);
vp.addEventListener(VideoEvent.STATE_CHANGE, handleVideoEvent);
vp.addEventListener(VideoEvent.READY, handleVideoEvent);
var cpMgr:CuePointManager = new CuePointManager(this, index);
cuePointMgrs[index] = cpMgr;
cpMgr.playheadUpdateInterval = _playheadUpdateInterval;
}
public function findNearestCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, true, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, true, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, true, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, true, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, true, _arg1));
};
}
override public function set scaleX(_arg1:Number):void{
var _local5:VideoPlayer;
var _local2:Rectangle = new Rectangle(x, y, width, height);
var _local3:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
var _local4:int;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.width = (_origWidth * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get muteButton():Sprite{
return (uiMgr.getControl(UIManager.MUTE_BUTTON));
}
public function seekPercent(_arg1:Number):void{
var _local2:VideoPlayer = videoPlayers[_activeVP];
if (((((((((isNaN(_arg1)) || ((_arg1 < 0)))) || ((_arg1 > 100)))) || (isNaN(_local2.totalTime)))) || ((_local2.totalTime <= 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(((_local2.totalTime * _arg1) / 100));
}
public function set forwardButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FORWARD_BUTTON, _arg1);
}
private function doContentPathConnect(_arg1):void{
if (isLivePreview){
return;
};
var _local2:int;
if ((_arg1 is int)){
_local2 = int(_arg1);
} else {
removeEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
var _local3:VideoPlayer = videoPlayers[_local2];
var _local4:VideoPlayerState = videoPlayerStates[_local2];
if (!_local4.isWaiting){
return;
};
if (((_local4.autoPlay) && (_firstStreamShown))){
_local3.play(_local4.url, _local4.totalTime, _local4.isLive);
} else {
_local3.load(_local4.url, _local4.totalTime, _local4.isLive);
};
_local4.isLiveSet = false;
_local4.totalTimeSet = false;
_local4.isWaiting = false;
}
public function get registrationX():Number{
return (super.x);
}
public function get registrationY():Number{
return (super.y);
}
public function bringVideoPlayerToFront(_arg1:uint):void{
var skinDepth:int;
var index = _arg1;
if (index == _topVP){
return;
};
var vp:VideoPlayer = videoPlayers[index];
if (vp == null){
createVideoPlayer(index);
vp = videoPlayers[index];
};
var moved:Boolean;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
setChildIndex(vp, (skinDepth - 1));
moved = true;
};
} catch(err:Error) {
};
};
if (!moved){
setChildIndex(vp, (numChildren - 1));
};
_topVP = index;
}
public function get startTabIndex():int{
if (uiMgr.startTabIndex){
return (uiMgr.startTabIndex);
};
if (tabIndex){
return (tabIndex);
};
return (uiMgr.startTabIndex);
}
public function set seekBarInterval(_arg1:Number):void{
uiMgr.seekBarInterval = _arg1;
}
public function get pauseButton():Sprite{
return (uiMgr.getControl(UIManager.PAUSE_BUTTON));
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:CuePointManager = cuePointMgrs[_activeVP];
return (_local4.addASCuePoint(_arg1, _arg2, _arg3));
}
public function get playheadPercentage():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
if (isNaN(_local1.totalTime)){
return (NaN);
};
return (((_local1.playheadTime / _local1.totalTime) * 100));
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):Number{
var _local3:CuePointManager = cuePointMgrs[_activeVP];
return (_local3.setFLVCuePointEnabled(_arg1, _arg2));
}
public function seekToNextNavCuePoint(_arg1:Number=NaN):void{
var _local2:VideoPlayer = videoPlayers[_activeVP];
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_arg1 = (_local2.playheadTime + 0.001);
};
var _local3:Object = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local3 == null){
seek(_local2.totalTime);
return;
};
var _local4:Number = _local3.index;
if (_local3.time < _arg1){
_local4++;
};
while ((((_local4 < _local3.array.length)) && (!(isFLVCuePointEnabled(_local3.array[_local4]))))) {
_local4++;
};
if (_local4 >= _local3.array.length){
_arg1 = _local2.totalTime;
if (_local3.array[(_local3.array.length - 1)].time > _arg1){
_arg1 = _local3.array[(_local3.array.length - 1)];
};
seek(_arg1);
} else {
seek(_local3.array[_local4].time);
};
}
public function set fullScreenSkinDelay(_arg1:int):void{
uiMgr.fullScreenSkinDelay = _arg1;
}
public function get playheadUpdateInterval():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.playheadUpdateInterval);
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
if (_arg1 == this.source){
return;
};
this.autoPlay = false;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
}
public function seekSeconds(_arg1:Number):void{
seek(_arg1);
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_componentInspectorSetting = _arg1;
}
public function get idleTimeout():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.idleTimeout);
}
public function get scrubbing():Boolean{
var _local2:ControlData;
var _local1:Sprite = seekBar;
if (_local1 != null){
_local2 = uiMgr.ctrlDataDict[_local1];
return (_local2.isDragging);
};
return (false);
}
public function set bitrate(_arg1:Number):void{
ncMgr.bitrate = _arg1;
}
public function removeASCuePoint(_arg1):Object{
var _local2:CuePointManager = cuePointMgrs[_activeVP];
return (_local2.removeASCuePoint(_arg1));
}
public function get playPauseButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_PAUSE_BUTTON));
}
public function get fullScreenTakeOver():Boolean{
return (uiMgr.fullScreenTakeOver);
}
public function get backButton():Sprite{
return (uiMgr.getControl(UIManager.BACK_BUTTON));
}
public function set skin(_arg1:String):void{
uiMgr.skin = _arg1;
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
uiMgr.fullScreenBackgroundColor = _arg1;
}
public function get fullScreenButton():Sprite{
return (uiMgr.getControl(UIManager.FULL_SCREEN_BUTTON));
}
public function set seekBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.SEEK_BAR, _arg1);
}
override public function set x(_arg1:Number):void{
var _local2:VideoPlayer = videoPlayers[_visibleVP];
super.x = (_arg1 - _local2.x);
}
override public function set y(_arg1:Number):void{
var _local2:VideoPlayer = videoPlayers[_visibleVP];
super.y = (_arg1 - _local2.y);
}
public function set volumeBarInterval(_arg1:Number):void{
uiMgr.volumeBarInterval = _arg1;
}
public function get align():String{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.align);
}
public function get preferredHeight():int{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.videoHeight);
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
uiMgr.bufferingBarHidesAndDisablesOthers = _arg1;
}
public function set autoPlay(_arg1:Boolean):void{
var _local2:VideoPlayerState = videoPlayerStates[_activeVP];
_local2.autoPlay = _arg1;
}
public function set visibleVideoPlayerIndex(_arg1:uint):void{
var _local5:Rectangle;
var _local6:Rectangle;
if (_visibleVP == _arg1){
return;
};
if (videoPlayers[_arg1] == undefined){
createVideoPlayer(_arg1);
};
var _local2:VideoPlayer = videoPlayers[_arg1];
var _local3:VideoPlayer = videoPlayers[_visibleVP];
_local3.visible = false;
_local3.volume = 0;
_visibleVP = _arg1;
if (_firstStreamShown){
uiMgr.setupSkinAutoHide(false);
_local2.visible = true;
_soundTransform.volume = (scrubbing) ? 0 : _volume;
_local2.soundTransform = _soundTransform;
} else {
if (((((((_local2.stateResponsive) || ((_local2.state == VideoState.CONNECTION_ERROR)))) || ((_local2.state == VideoState.DISCONNECTED)))) && (uiMgr.skinReady))){
uiMgr.visible = true;
uiMgr.setupSkinAutoHide(false);
_firstStreamReady = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
if (((!((_local2.height == _local3.height))) || (!((_local2.width == _local3.width))))){
_local5 = new Rectangle((_local3.x + super.x), (_local3.y + super.y), _local3.width, _local3.height);
_local6 = new Rectangle((_local3.registrationX + super.x), (_local3.registrationY + super.y), _local3.registrationWidth, _local3.registrationHeight);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local5, _local6));
};
var _local4:uint = _activeVP;
_activeVP = _visibleVP;
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, state, playheadTime, _visibleVP));
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, state, playheadTime, _visibleVP));
if (_local2.isRTMP){
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.READY, false, false, state, playheadTime, _visibleVP));
} else {
uiMgr.handleIVPEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, bytesLoaded, bytesTotal, _visibleVP));
};
_activeVP = _local4;
}
public function get bufferingBar():Sprite{
return (uiMgr.getControl(UIManager.BUFFERING_BAR));
}
flvplayback_internal function _scrubStart():void{
var _local1:Number = playheadTime;
var _local2:VideoPlayer = videoPlayers[_visibleVP];
_volume = _local2.volume;
_local2.volume = 0;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.SEEKING, _local1, _visibleVP));
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_START, false, false, VideoState.SEEKING, _local1, _visibleVP));
}
public function set playButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_BUTTON, _arg1);
}
flvplayback_internal function handleAutoLayoutEvent(_arg1:AutoLayoutEvent):void{
var _local4:Rectangle;
var _local5:Rectangle;
var _local2:VideoPlayerState = videoPlayerStateDict[_arg1.currentTarget];
var _local3:AutoLayoutEvent = AutoLayoutEvent(_arg1.clone());
_local3.oldBounds.x = (_local3.oldBounds.x + super.x);
_local3.oldBounds.y = (_local3.oldBounds.y + super.y);
_local3.oldRegistrationBounds.x = (_local3.oldRegistrationBounds.x + super.y);
_local3.oldRegistrationBounds.y = (_local3.oldRegistrationBounds.y + super.y);
_local3.vp = _local2.index;
dispatchEvent(_local3);
if (((!(resizingNow)) && ((_local2.index == _visibleVP)))){
_local4 = Rectangle(_arg1.oldBounds.clone());
_local5 = Rectangle(_arg1.oldRegistrationBounds.clone());
_local4.x = (_local4.x + super.x);
_local4.y = (_local4.y + super.y);
_local5.x = (_local5.x + super.y);
_local5.y = (_local5.y + super.y);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local4, _local5));
};
}
public function findNextCuePointWithName(_arg1:Object):Object{
var _local2:CuePointManager = cuePointMgrs[_activeVP];
return (_local2.getNextCuePointWithName(_arg1));
}
override public function get soundTransform():SoundTransform{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
var _local2:SoundTransform = _local1.soundTransform;
if (scrubbing){
_local2.volume = _volume;
};
return (_local2);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
flvplayback_internal function showFirstStream():void{
var _local3:VideoPlayerState;
var _local4:int;
_firstStreamShown = true;
var _local1:VideoPlayer = videoPlayers[_visibleVP];
_local1.visible = true;
if (!scrubbing){
_soundTransform.volume = _volume;
_local1.soundTransform = _soundTransform;
};
var _local2:int;
while (_local2 < videoPlayers.length) {
_local1 = videoPlayers[_local2];
if (_local1 != null){
_local3 = videoPlayerStates[_local2];
if ((((_local1.state == VideoState.STOPPED)) && (_local3.autoPlay))){
if (_local1.isRTMP){
_local1.play();
} else {
_local3.prevState = VideoState.STOPPED;
_local1.playWhenEnoughDownloaded();
};
};
if (_local3.cmdQueue != null){
_local4 = 0;
while (_local4 < _local3.cmdQueue.length) {
switch (_local3.cmdQueue[_local4].type){
case QueuedCommand.PLAY:
_local1.play();
break;
case QueuedCommand.PAUSE:
_local1.pause();
break;
case QueuedCommand.STOP:
_local1.stop();
break;
case QueuedCommand.SEEK:
_local1.seek(_local3.cmdQueue[_local4].time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
_local1.playWhenEnoughDownloaded();
break;
};
_local4++;
};
_local3.cmdQueue = null;
};
};
_local2++;
};
}
public function get stateResponsive():Boolean{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.stateResponsive);
}
public function set skinBackgroundAlpha(_arg1:Number):void{
uiMgr.skinBackgroundAlpha = _arg1;
}
flvplayback_internal function handleVideoEvent(_arg1:VideoEvent):void{
var _local6:Number;
var _local2:VideoPlayerState = videoPlayerStateDict[_arg1.currentTarget];
var _local3:CuePointManager = cuePointMgrs[_local2.index];
var _local4:VideoEvent = VideoEvent(_arg1.clone());
_local4.vp = _local2.index;
var _local5:String = ((((_local2.index == _visibleVP)) && (scrubbing))) ? VideoState.SEEKING : _arg1.state;
switch (_arg1.type){
case VideoEvent.AUTO_REWOUND:
dispatchEvent(_local4);
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _local5, _arg1.playheadTime, _local2.index));
_local3.resetASCuePointIndex(_arg1.playheadTime);
break;
case VideoEvent.PLAYHEAD_UPDATE:
_local4.state = _local5;
dispatchEvent(_local4);
if (((!(isNaN(_local2.preSeekTime))) && (!((_arg1.state == VideoState.SEEKING))))){
_local6 = _local2.preSeekTime;
_local2.preSeekTime = NaN;
_local3.resetASCuePointIndex(_arg1.playheadTime);
dispatchEvent(new VideoEvent(VideoEvent.SEEKED, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
if (_local6 < _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.FAST_FORWARD, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
} else {
if (_local6 > _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
};
};
};
_local3.dispatchASCuePoints();
break;
case VideoEvent.STATE_CHANGE:
if ((((_local2.index == _visibleVP)) && (scrubbing))){
break;
};
if (_arg1.state == VideoState.RESIZING){
break;
};
if ((((((_local2.prevState == VideoState.LOADING)) && (_local2.autoPlay))) && ((_arg1.state == VideoState.STOPPED)))){
return;
};
if ((((((((_arg1.state == VideoState.CONNECTION_ERROR)) && ((_arg1.vp == _visibleVP)))) && (!(_firstStreamShown)))) && (uiMgr.skinReady))){
showFirstStream();
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
};
_local2.prevState = _arg1.state;
_local4.state = _local5;
dispatchEvent(_local4);
if (_local2.owner.state != _arg1.state){
return;
};
switch (_arg1.state){
case VideoState.BUFFERING:
dispatchEvent(new VideoEvent(VideoEvent.BUFFERING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PAUSED:
dispatchEvent(new VideoEvent(VideoEvent.PAUSED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PLAYING:
dispatchEvent(new VideoEvent(VideoEvent.PLAYING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.STOPPED:
dispatchEvent(new VideoEvent(VideoEvent.STOPPED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
};
break;
case VideoEvent.READY:
if (!_firstStreamReady){
if (_local2.index == _visibleVP){
_firstStreamReady = true;
if (((uiMgr.skinReady) && (!(_firstStreamShown)))){
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
} else {
if (((((_firstStreamShown) && ((_arg1.state == VideoState.STOPPED)))) && (_local2.autoPlay))){
if (_local2.owner.isRTMP){
_local2.owner.play();
} else {
_local2.prevState = VideoState.STOPPED;
_local2.owner.playWhenEnoughDownloaded();
};
};
};
_local4.state = _local5;
dispatchEvent(_local4);
break;
case VideoEvent.CLOSE:
case VideoEvent.COMPLETE:
_local4.state = _local5;
dispatchEvent(_local4);
break;
};
}
public function get volume():Number{
return (_volume);
}
public function get metadata():Object{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.metadata);
}
public function set skinBackgroundColor(_arg1:uint):void{
uiMgr.skinBackgroundColor = _arg1;
}
public function set volumeBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.VOLUME_BAR, _arg1);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
var _local4:VideoPlayerState;
var _local5:VideoPlayer;
if (_arg1 == null){
if (!_firstStreamShown){
_local4 = videoPlayerStates[_activeVP];
queueCmd(_local4, QueuedCommand.PLAY);
} else {
_local5 = videoPlayers[_activeVP];
_local5.play();
};
} else {
if (_arg1 == this.source){
return;
};
this.autoPlay = true;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
};
}
public function get paused():Boolean{
return ((state == VideoState.PAUSED));
}
override public function get height():Number{
if (isLivePreview){
return (livePreviewHeight);
};
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return (_local1.height);
}
public function get isLive():Boolean{
var _local1:VideoPlayerState = videoPlayerStates[_activeVP];
if (_local1.isLiveSet){
return (_local1.isLive);
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
return (_local2.isLive);
}
public function get registrationHeight():Number{
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return (_local1.registrationHeight);
}
public function get bufferTime():Number{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.bufferTime);
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
uiMgr.volumeBarScrubTolerance = _arg1;
}
public function set skinScaleMaximum(_arg1:Number):void{
uiMgr.skinScaleMaximum = _arg1;
}
public function get autoRewind():Boolean{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.autoRewind);
}
public function set muteButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.MUTE_BUTTON, _arg1);
}
public function enterFullScreenDisplayState():void{
uiMgr.enterFullScreenDisplayState();
}
flvplayback_internal function handleMetadataEvent(_arg1:MetadataEvent):void{
var _local2:VideoPlayerState = videoPlayerStateDict[_arg1.currentTarget];
var _local3:CuePointManager = cuePointMgrs[_local2.index];
switch (_arg1.type){
case MetadataEvent.METADATA_RECEIVED:
_local3.processFLVCuePoints(_arg1.info.cuePoints);
break;
case MetadataEvent.CUE_POINT:
if (!_local3.isFLVCuePointEnabled(_arg1.info)){
return;
};
break;
};
var _local4:MetadataEvent = MetadataEvent(_arg1.clone());
_local4.vp = _local2.index;
dispatchEvent(_local4);
}
public function playWhenEnoughDownloaded():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PLAY_WHEN_ENOUGH);
} else {
_local2 = videoPlayers[_activeVP];
_local2.playWhenEnoughDownloaded();
};
}
public function get bitrate():Number{
return (ncMgr.bitrate);
}
public function get fullScreenBackgroundColor():uint{
return (uiMgr.fullScreenBackgroundColor);
}
public function get skin():String{
return (uiMgr.skin);
}
public function set registrationX(_arg1:Number):void{
super.x = _arg1;
}
public function set registrationY(_arg1:Number):void{
super.y = _arg1;
}
public function get playButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_BUTTON));
}
public function get visibleVideoPlayerIndex():uint{
return (_visibleVP);
}
public function setSize(_arg1:Number, _arg2:Number):void{
var _local6:VideoPlayer;
var _local3:Rectangle = new Rectangle(x, y, this.width, this.height);
var _local4:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
if (isLivePreview){
livePreviewWidth = _arg1;
livePreviewHeight = _arg2;
if (previewImage_mc != null){
previewImage_mc.width = _arg1;
previewImage_mc.height = _arg2;
};
preview_mc.box_mc.width = _arg1;
preview_mc.box_mc.height = _arg2;
if ((((preview_mc.box_mc.width < preview_mc.icon_mc.width)) || ((preview_mc.box_mc.height < preview_mc.icon_mc.height)))){
preview_mc.icon_mc.visible = false;
} else {
preview_mc.icon_mc.visible = true;
preview_mc.icon_mc.x = ((preview_mc.box_mc.width - preview_mc.icon_mc.width) / 2);
preview_mc.icon_mc.y = ((preview_mc.box_mc.height - preview_mc.icon_mc.height) / 2);
};
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
return;
};
resizingNow = true;
var _local5:int;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 != null){
_local6.setSize(_arg1, _arg2);
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
override public function set width(_arg1:Number):void{
var _local5:VideoPlayer;
if (isLivePreview){
setSize(_arg1, this.height);
return;
};
var _local2:Rectangle = new Rectangle(x, y, width, height);
var _local3:Rectangle = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
var _local4:int;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.width = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get isRTMP():Boolean{
if (isLivePreview){
return (true);
};
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.isRTMP);
}
public function set preview(_arg1:String):void{
var filename = _arg1;
if (!isLivePreview){
return;
};
previewImageUrl = filename;
if (previewImage_mc != null){
removeChild(previewImage_mc);
};
previewImage_mc = new Loader();
previewImage_mc.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompletePreview);
previewImage_mc.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
});
previewImage_mc.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (_arg1:SecurityErrorEvent):void{
});
addChildAt(previewImage_mc, 1);
previewImage_mc.load(new URLRequest(previewImageUrl));
}
public function get skinBackgroundAlpha():Number{
return (uiMgr.skinBackgroundAlpha);
}
public function set pauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PAUSE_BUTTON, _arg1);
}
public function get bytesTotal():uint{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.bytesTotal);
}
public function seekToPrevNavCuePoint(_arg1:Number=NaN):void{
var _local4:VideoPlayer;
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_local4 = videoPlayers[_activeVP];
_arg1 = _local4.playheadTime;
};
var _local2:Object = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local2 == null){
seek(0);
return;
};
var _local3:Number = _local2.index;
while ((((_local3 >= 0)) && (((!(isFLVCuePointEnabled(_local2.array[_local3]))) || ((_local2.array[_local3].time >= (_arg1 - _seekToPrevOffset))))))) {
_local3--;
};
if (_local3 < 0){
seek(0);
} else {
seek(_local2.array[_local3].time);
};
}
public function get autoPlay():Boolean{
var _local1:VideoPlayerState = videoPlayerStates[_activeVP];
return (_local1.autoPlay);
}
public function set playheadPercentage(_arg1:Number):void{
seekPercent(_arg1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:CuePointManager = cuePointMgrs[_activeVP];
return (_local2.isFLVCuePointEnabled(_arg1));
}
public function get buffering():Boolean{
return ((state == VideoState.BUFFERING));
}
public function get volumeBarScrubTolerance():Number{
return (uiMgr.volumeBarScrubTolerance);
}
public function get skinBackgroundColor():uint{
return (uiMgr.skinBackgroundColor);
}
public function get skinScaleMaximum():Number{
return (uiMgr.skinScaleMaximum);
}
public function set stopButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.STOP_BUTTON, _arg1);
}
public function get preferredWidth():int{
var _local1:VideoPlayer = videoPlayers[_activeVP];
return (_local1.videoWidth);
}
override public function get width():Number{
if (isLivePreview){
return (livePreviewWidth);
};
var _local1:VideoPlayer = videoPlayers[_visibleVP];
return (_local1.width);
}
public function set playheadUpdateInterval(_arg1:Number):void{
if (_activeVP == 0){
_playheadUpdateInterval = _arg1;
};
var _local2:CuePointManager = cuePointMgrs[_activeVP];
_local2.playheadUpdateInterval = _arg1;
var _local3:VideoPlayer = videoPlayers[_activeVP];
_local3.playheadUpdateInterval = _arg1;
}
public function get stopped():Boolean{
return ((state == VideoState.STOPPED));
}
public function set fullScreenButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FULL_SCREEN_BUTTON, _arg1);
}
public function get stopButton():Sprite{
return (uiMgr.getControl(UIManager.STOP_BUTTON));
}
private function createLivePreviewMovieClip():void{
preview_mc = new MovieClip();
preview_mc.name = "preview_mc";
preview_mc.box_mc = new MovieClip();
preview_mc.box_mc.name = "box_mc";
preview_mc.box_mc.graphics.beginFill(0);
preview_mc.box_mc.graphics.moveTo(0, 0);
preview_mc.box_mc.graphics.lineTo(0, 100);
preview_mc.box_mc.graphics.lineTo(100, 100);
preview_mc.box_mc.graphics.lineTo(100, 0);
preview_mc.box_mc.graphics.lineTo(0, 0);
preview_mc.box_mc.graphics.endFill();
preview_mc.addChild(preview_mc.box_mc);
preview_mc.icon_mc = new Icon();
preview_mc.icon_mc.name = "icon_mc";
preview_mc.addChild(preview_mc.icon_mc);
addChild(preview_mc);
}
public function set idleTimeout(_arg1:Number):void{
if (_activeVP == 0){
_idleTimeout = _arg1;
};
var _local2:VideoPlayer = videoPlayers[_activeVP];
_local2.idleTimeout = _arg1;
}
flvplayback_internal function skinLoaded():void{
if (isLivePreview){
return;
};
var _local1:VideoPlayer = videoPlayers[_visibleVP];
if (((((_firstStreamReady) || ((_local1.state == VideoState.CONNECTION_ERROR)))) || ((_local1.state == VideoState.DISCONNECTED)))){
uiMgr.visible = true;
if (!_firstStreamShown){
showFirstStream();
};
} else {
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
skinShowTimer = new Timer(DEFAULT_SKIN_SHOW_TIMER_INTERVAL, 1);
skinShowTimer.addEventListener(TimerEvent.TIMER, showSkinNow);
skinShowTimer.start();
};
dispatchEvent(new VideoEvent(VideoEvent.SKIN_LOADED, false, false, state, playheadTime, _visibleVP));
}
flvplayback_internal function _scrubFinish():void{
var _local1:Number = playheadTime;
var _local2:String = state;
var _local3:VideoPlayer = videoPlayers[_visibleVP];
_soundTransform.volume = _volume;
_local3.soundTransform = _soundTransform;
if (_local2 != VideoState.SEEKING){
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local2, _local1, _visibleVP));
};
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_FINISH, false, false, _local2, _local1, _visibleVP));
}
public function set playPauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_PAUSE_BUTTON, _arg1);
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
uiMgr.fullScreenTakeOver = _arg1;
}
public function set backButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BACK_BUTTON, _arg1);
}
public function set cuePoints(_arg1:Array):void{
if (!_componentInspectorSetting){
return;
};
cuePointMgrs[0].processCuePointsProperty(_arg1);
}
public function pause():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PAUSE);
} else {
_local2 = videoPlayers[_activeVP];
_local2.pause();
};
}
public function set seekBarScrubTolerance(_arg1:Number):void{
uiMgr.seekBarScrubTolerance = _arg1;
}
flvplayback_internal function handleVideoProgressEvent(_arg1:VideoProgressEvent):void{
var _local2:VideoPlayerState = videoPlayerStateDict[_arg1.currentTarget];
var _local3:VideoProgressEvent = VideoProgressEvent(_arg1.clone());
_local3.vp = _local2.index;
dispatchEvent(_local3);
}
public function findCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, false, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, false, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, false, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, false, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, false, _arg1));
};
}
}
}//package fl.video
Section 42
//flvplayback_internal (fl.video.flvplayback_internal)
package fl.video {
public namespace flvplayback_internal = "http://www.adobe.com/2007/flash/flvplayback/internal";
}//package fl.video
Section 43
//FPADManager (fl.video.FPADManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class FPADManager {
flvplayback_internal var _uriParam:String;
flvplayback_internal var _parseResults:ParseResults;
private var _owner:INCManager;
flvplayback_internal var rtmpURL:String;
flvplayback_internal var _url:String;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
public static const VERSION:String = "2.1.0.20";
public static const SHORT_VERSION:String = "2.1";
public function FPADManager(_arg1:INCManager){
_owner = _arg1;
}
flvplayback_internal function connectXML(_arg1:String, _arg2:String, _arg3:String, _arg4:ParseResults):Boolean{
_uriParam = _arg2;
_parseResults = _arg4;
_url = ((_arg1 + "uri=") + _parseResults.protocol);
if (_parseResults.serverName != null){
_url = (_url + ("/" + _parseResults.serverName));
};
if (_parseResults.portNumber != null){
_url = (_url + (":" + _parseResults.portNumber));
};
if (_parseResults.wrappedURL != null){
_url = (_url + ("/?" + _parseResults.wrappedURL));
};
_url = (_url + ("/" + _parseResults.appName));
_url = (_url + _arg3);
xml = new XML();
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var proxy:String;
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "fpad"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not fpad")));
};
};
proxy = null;
if ((((((xml.proxy.length() > 0)) && (xml.proxy.hasSimpleContent()))) && ((xml.proxy.*[0].nodeKind() == "text")))){
proxy = xml.proxy.*[0].toString();
};
if (proxy == null){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" fpad xml requires proxy tag.")));
};
rtmpURL = ((((_parseResults.protocol + "/") + proxy) + "/?") + _uriParam);
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
};
}
}
}//package fl.video
Section 44
//Icon (fl.video.Icon)
package fl.video {
import flash.display.*;
public dynamic class Icon extends MovieClip {
}
}//package fl.video
Section 45
//INCManager (fl.video.INCManager)
package fl.video {
import flash.net.*;
public interface INCManager {
function get timeout():uint;
function set timeout(_arg1:uint):void;
function get streamLength():Number;
function get streamHeight():int;
function connectToURL(_arg1:String):Boolean;
function get streamName():String;
function get bitrate():Number;
function get isRTMP():Boolean;
function helperDone(_arg1:Object, _arg2:Boolean):void;
function getProperty(_arg1:String);
function get streamWidth():int;
function connectAgain():Boolean;
function reconnect():void;
function close():void;
function set bitrate(_arg1:Number):void;
function get netConnection():NetConnection;
function get videoPlayer():VideoPlayer;
function setProperty(_arg1:String, _arg2):void;
function set videoPlayer(_arg1:VideoPlayer):void;
}
}//package fl.video
Section 46
//IVPEvent (fl.video.IVPEvent)
package fl.video {
public interface IVPEvent {
function get vp():uint;
function get type():String;
function set vp(_arg1:uint):void;
}
}//package fl.video
Section 47
//LayoutEvent (fl.video.LayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class LayoutEvent extends Event {
private var _oldRegistrationBounds:Rectangle;
private var _oldBounds:Rectangle;
public static const LAYOUT:String = "layout";
public function LayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null){
super(_arg1, _arg2, _arg3);
_oldBounds = _arg4;
_oldRegistrationBounds = _arg5;
}
public function set oldRegistrationBounds(_arg1:Rectangle):void{
_oldRegistrationBounds = _arg1;
}
override public function clone():Event{
return (new LayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone())));
}
public function get oldRegistrationBounds():Rectangle{
return (_oldRegistrationBounds);
}
public function set oldBounds(_arg1:Rectangle):void{
_oldBounds = _arg1;
}
public function get oldBounds():Rectangle{
return (_oldBounds);
}
}
}//package fl.video
Section 48
//MetadataEvent (fl.video.MetadataEvent)
package fl.video {
import flash.events.*;
public class MetadataEvent extends Event implements IVPEvent {
private var _info:Object;
private var _vp:uint;
public static const METADATA_RECEIVED:String = "metadataReceived";
public static const CUE_POINT:String = "cuePoint";
public function MetadataEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Object=null, _arg5:uint=0){
super(_arg1, _arg2, _arg3);
_info = _arg4;
_vp = _arg5;
}
public function set info(_arg1:Object):void{
_info = _arg1;
}
public function get vp():uint{
return (_vp);
}
public function get info():Object{
return (_info);
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
override public function clone():Event{
return (new MetadataEvent(type, bubbles, cancelable, info, vp));
}
}
}//package fl.video
Section 49
//NCManager (fl.video.NCManager)
package fl.video {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class NCManager implements INCManager {
public const DEFAULT_TIMEOUT:uint = 60000;
flvplayback_internal var _serverName:String;
flvplayback_internal var _tryNCTimer:Timer;
flvplayback_internal var _autoSenseBW:Boolean;
flvplayback_internal var _fpadZone:Number;
flvplayback_internal var _appName:String;
flvplayback_internal var _ncConnected:Boolean;
flvplayback_internal var _fpadMgr:FPADManager;
flvplayback_internal var _bitrate:Number;
flvplayback_internal var _timeoutTimer:Timer;
flvplayback_internal var _wrappedURL:String;
flvplayback_internal var _payload:Number;
flvplayback_internal var _nc:NetConnection;
flvplayback_internal var _streamLength:Number;
flvplayback_internal var _connTypeCounter:uint;
flvplayback_internal var _streamWidth:int;
flvplayback_internal var _proxyType:String;
flvplayback_internal var _ncUri:String;
flvplayback_internal var _contentPath:String;
flvplayback_internal var _smilMgr:SMILManager;
flvplayback_internal var _streamHeight:int;
flvplayback_internal var _isRTMP:Boolean;
flvplayback_internal var _tryNC:Array;
flvplayback_internal var _streams:Array;
flvplayback_internal var _owner:VideoPlayer;
flvplayback_internal var _portNumber:String;
flvplayback_internal var _streamName:String;
flvplayback_internal var _objectEncoding:uint;
public var fallbackServerName:String;
flvplayback_internal var _protocol:String;
public static const VERSION:String = "2.1.0.20";
public static const SHORT_VERSION:String = "2.1";
public function NCManager(){
_fpadZone = NaN;
_objectEncoding = ObjectEncoding.AMF0;
_proxyType = "best";
_timeoutTimer = new Timer(DEFAULT_TIMEOUT);
_timeoutTimer.addEventListener(TimerEvent.TIMER, this._onFMSConnectTimeOut);
_tryNCTimer = new Timer(1500, 1);
_tryNCTimer.addEventListener(TimerEvent.TIMER, this.nextConnect);
initNCInfo();
initOtherInfo();
_nc = null;
_ncConnected = false;
}
flvplayback_internal function initNCInfo():void{
_isRTMP = false;
_serverName = null;
_wrappedURL = null;
_portNumber = null;
_appName = null;
}
flvplayback_internal function cleanConns():void{
var _local1:uint;
_tryNCTimer.reset();
if (_tryNC != null){
_local1 = 0;
while (_local1 < _tryNC.length) {
if (_tryNC[_local1] != null){
_tryNC[_local1].removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
if (_tryNC[_local1].client.pending){
_tryNC[_local1].addEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
} else {
_tryNC[_local1].close();
};
};
_tryNC[_local1] = null;
_local1++;
};
_tryNC = null;
};
}
public function get streamWidth():int{
return (_streamWidth);
}
public function connectToURL(_arg1:String):Boolean{
var canReuse:Boolean;
var name:String;
var url = _arg1;
initOtherInfo();
_contentPath = url;
if ((((_contentPath == null)) || ((_contentPath == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE));
};
var parseResults:ParseResults = parseURL(_contentPath);
if ((((parseResults.streamName == null)) || ((parseResults.streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
if (parseResults.isRTMP){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = true;
_protocol = parseResults.protocol;
_streamName = parseResults.streamName;
_serverName = parseResults.serverName;
_wrappedURL = parseResults.wrappedURL;
_portNumber = parseResults.portNumber;
_appName = parseResults.appName;
if ((((((((_appName == null)) || ((_appName == "")))) || ((_streamName == null)))) || ((_streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
_autoSenseBW = (_streamName.indexOf(",") >= 0);
return (((canReuse) || (connectRTMP())));
//unresolved jump
};
name = parseResults.streamName;
if ((((((((name.indexOf("?") < 0)) && ((((name.length < 4)) || (!((name.slice(-4).toLowerCase() == ".txt"))))))) && ((((name.length < 4)) || (!((name.slice(-4).toLowerCase() == ".xml"))))))) && ((((name.length < 5)) || (!((name.slice(-5).toLowerCase() == ".smil"))))))){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = false;
_streamName = name;
return (((canReuse) || (connectHTTP())));
};
if (name.indexOf("/fms/fpad") >= 0){
try {
return (connectFPAD(name));
} catch(err:Error) {
};
};
_smilMgr = new SMILManager(this);
return (_smilMgr.connectXML(name));
}
public function get streamName():String{
return (_streamName);
}
flvplayback_internal function reconnectOnStatus(_arg1:NetStatusEvent):void{
if ((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))){
_nc = null;
_ncConnected = false;
_owner.ncReconnected();
};
}
public function get videoPlayer():VideoPlayer{
return (_owner);
}
flvplayback_internal function getStreamLengthResult(_arg1:Number):void{
if (_arg1 > 0){
_streamLength = _arg1;
};
_owner.ncConnected();
}
flvplayback_internal function canReuseOldConnection(_arg1:ParseResults):Boolean{
if ((((_nc == null)) || (!(_ncConnected)))){
return (false);
};
if (!_arg1.isRTMP){
if (!_isRTMP){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
initNCInfo();
return (false);
};
if (_isRTMP){
if ((((((((((_arg1.serverName == _serverName)) && ((_arg1.appName == _appName)))) && ((_arg1.protocol == _protocol)))) && ((_arg1.portNumber == _portNumber)))) && ((_arg1.wrappedURL == _wrappedURL)))){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
};
initNCInfo();
return (false);
}
public function helperDone(_arg1:Object, _arg2:Boolean):void{
var _local3:ParseResults;
var _local4:String;
var _local7:Number;
if (!_arg2){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
_smilMgr = null;
_fpadMgr = null;
return;
};
var _local5:Boolean;
if (_arg1 == _fpadMgr){
_local4 = _fpadMgr.rtmpURL;
_fpadMgr = null;
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
_streamName = _local3.streamName;
_local7 = _fpadZone;
_fpadZone = NaN;
connectRTMP();
_fpadZone = _local7;
return;
};
if (_arg1 != _smilMgr){
return;
};
_streamWidth = _smilMgr.width;
_streamHeight = _smilMgr.height;
_local4 = _smilMgr.baseURLAttr[0];
if (((!((_local4 == null))) && (!((_local4 == ""))))){
if (_local4.charAt((_local4.length - 1)) != "/"){
_local4 = (_local4 + "/");
};
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_local5 = true;
_streamName = _local3.streamName;
if (_isRTMP){
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
_smilMgr = null;
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
if (_smilMgr.baseURLAttr.length > 1){
_local3 = parseURL(_smilMgr.baseURLAttr[1]);
if (_local3.serverName != null){
fallbackServerName = _local3.serverName;
};
};
};
};
_streams = _smilMgr.videoTags;
_smilMgr = null;
var _local6:uint;
while (_local6 < _streams.length) {
_local4 = _streams[_local6].src;
_local3 = parseURL(_local4);
if (!_local5){
_isRTMP = _local3.isRTMP;
_local5 = true;
if (_isRTMP){
_protocol = _local3.protocol;
if (_streams.length > 1){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute RTMP URLs, must use meta tag base attribute."));
};
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
} else {
if ((((_local3.streamName.indexOf("/fms/fpad") >= 0)) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute fpad URLs, must use meta tag base attribute."));
};
};
} else {
if (((((((!((_streamName == null))) && (!((_streamName == ""))))) && (!(_local3.isRelative)))) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "When using meta tag base attribute, cannot use absolute URLs for video or ref tag src attributes."));
};
};
_streams[_local6].parseResults = _local3;
_local6++;
};
_autoSenseBW = (_streams.length > 1);
if (!_autoSenseBW){
if (_streamName != null){
_streamName = (_streamName + _streams[0].parseResults.streamName);
} else {
_streamName = _streams[0].parseResults.streamName;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[0].dur;
};
if (_isRTMP){
connectRTMP();
} else {
if (((!((_streamName == null))) && ((_streamName.indexOf("/fms/fpad") >= 0)))){
connectFPAD(_streamName);
} else {
if (_autoSenseBW){
bitrateMatch();
};
connectHTTP();
_owner.ncConnected();
};
};
}
public function getProperty(_arg1:String){
switch (_arg1){
case "fallbackServerName":
return (fallbackServerName);
case "fpadZone":
return (_fpadZone);
case "objectEncoding":
return (_objectEncoding);
case "proxyType":
return (_proxyType);
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
flvplayback_internal function connectRTMP():Boolean{
_timeoutTimer.stop();
_timeoutTimer.start();
_tryNC = new Array();
var _local1:int = ((((_protocol == "rtmp:/")) || ((_protocol == "rtmpe:/")))) ? 2 : 1;
var _local2:uint;
while (_local2 < _local1) {
_tryNC[_local2] = new NetConnection();
_tryNC[_local2].objectEncoding = _objectEncoding;
_tryNC[_local2].proxyType = _proxyType;
if (!isNaN(_fpadZone)){
_tryNC[_local2].fpadZone = _fpadZone;
};
_tryNC[_local2].client = new ConnectClient(this, _tryNC[_local2], _local2);
_tryNC[_local2].addEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_local2++;
};
nextConnect();
return (false);
}
public function reconnect():void{
if (!_isRTMP){
throw (new Error("Cannot call reconnect on an http connection"));
};
_nc.client = new ReconnectClient(this);
_nc.addEventListener(NetStatusEvent.NET_STATUS, reconnectOnStatus);
_nc.connect(_ncUri, false);
}
public function get netConnection():NetConnection{
return (_nc);
}
public function get bitrate():Number{
return (_bitrate);
}
public function setProperty(_arg1:String, _arg2):void{
switch (_arg1){
case "fallbackServerName":
fallbackServerName = String(_arg2);
break;
case "fpadZone":
_fpadZone = Number(_arg2);
break;
case "objectEncoding":
_objectEncoding = uint(_arg2);
break;
case "proxyType":
_proxyType = String(_arg2);
break;
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
public function get timeout():uint{
return (_timeoutTimer.delay);
}
flvplayback_internal function connectHTTP():Boolean{
_nc = new NetConnection();
_nc.connect(null);
_ncConnected = true;
return (true);
}
public function set videoPlayer(_arg1:VideoPlayer):void{
_owner = _arg1;
}
flvplayback_internal function bitrateMatch():void{
var _local1:Number = _bitrate;
if (isNaN(_local1)){
_local1 = 0;
};
var _local2:uint = _streams.length;
var _local3:uint;
while (_local3 < _streams.length) {
if (((isNaN(_streams[_local3].bitrate)) || ((_local1 >= _streams[_local3].bitrate)))){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 == _streams.length){
throw (new VideoError(VideoError.NO_BITRATE_MATCH));
};
if (_streamName != null){
_streamName = (_streamName + _streams[_local2].src);
} else {
_streamName = _streams[_local2].src;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[_local2].dur;
}
flvplayback_internal function disconnectOnStatus(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetConnection.Connect.Success"){
_arg1.target.removeEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
_arg1.target.close();
};
}
flvplayback_internal function nextConnect(_arg1:TimerEvent=null):void{
var _local2:String;
var _local3:String;
if (_connTypeCounter == 0){
_local2 = _protocol;
_local3 = _portNumber;
} else {
_local3 = null;
if (_protocol == "rtmp:/"){
_local2 = "rtmpt:/";
} else {
if (_protocol == "rtmpe:/"){
_local2 = "rtmpte:/";
} else {
_tryNC.pop();
return;
};
};
};
var _local4:String = (((_local2 + ((_serverName)==null) ? "" : ((("/" + _serverName) + ((_local3)==null) ? "" : (":" + _local3)) + "/")) + ((_wrappedURL)==null) ? "" : (_wrappedURL + "/")) + _appName);
_tryNC[_connTypeCounter].client.pending = true;
_tryNC[_connTypeCounter].connect(_local4, _autoSenseBW);
if (_connTypeCounter < (_tryNC.length - 1)){
_connTypeCounter++;
_tryNCTimer.reset();
_tryNCTimer.start();
};
}
flvplayback_internal function connectFPAD(_arg1:String):Boolean{
var _local2:Object = /^(.+)(\?|\&)(uri=)([^&]+)(\&.*)?$/.exec(_arg1);
if (_local2 == null){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url must include uri parameter: " + _arg1)));
};
var _local3:String = (_local2[1] + _local2[2]);
var _local4:String = _local2[4];
var _local5:String = ((_local2[5])==undefined) ? "" : _local2[5];
var _local6:ParseResults = parseURL(_local4);
if (!_local6.isRTMP){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url uri parameter must be rtmp url: " + _arg1)));
};
_fpadMgr = new FPADManager(this);
return (_fpadMgr.connectXML(_local3, _local4, _local5, _local6));
}
public function get isRTMP():Boolean{
return (_isRTMP);
}
public function get streamLength():Number{
return (_streamLength);
}
public function connectAgain():Boolean{
var _local1:int = _appName.indexOf("/");
if (_local1 < 0){
_local1 = _streamName.indexOf("/");
if (_local1 >= 0){
_appName = (_appName + "/");
_appName = (_appName + _streamName.slice(0, _local1));
_streamName = _streamName.slice((_local1 + 1));
};
return (false);
};
var _local2:String = _appName.slice((_local1 + 1));
_local2 = (_local2 + "/");
_local2 = (_local2 + _streamName);
_streamName = _local2;
_appName = _appName.slice(0, _local1);
close();
_payload = 0;
_connTypeCounter = 0;
cleanConns();
connectRTMP();
return (true);
}
flvplayback_internal function parseURL(_arg1:String):ParseResults{
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:ParseResults;
var _local2:ParseResults = new ParseResults();
var _local3:int;
var _local4:int = _arg1.indexOf(":/", _local3);
if (_local4 >= 0){
_local4 = (_local4 + 2);
_local2.protocol = _arg1.slice(_local3, _local4).toLowerCase();
_local2.isRelative = false;
} else {
_local2.isRelative = true;
};
if (((!((_local2.protocol == null))) && ((((((((((_local2.protocol == "rtmp:/")) || ((_local2.protocol == "rtmpt:/")))) || ((_local2.protocol == "rtmps:/")))) || ((_local2.protocol == "rtmpe:/")))) || ((_local2.protocol == "rtmpte:/")))))){
_local2.isRTMP = true;
_local3 = _local4;
if (_arg1.charAt(_local3) == "/"){
_local3++;
_local5 = _arg1.indexOf(":", _local3);
_local6 = _arg1.indexOf("/", _local3);
if (_local6 < 0){
if (_local5 < 0){
_local2.serverName = _arg1.slice(_local3);
} else {
_local4 = _local5;
_local2.portNumber = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local2.serverName = _arg1.slice(_local3);
};
return (_local2);
};
if ((((_local5 >= 0)) && ((_local5 < _local6)))){
_local4 = _local5;
_local2.serverName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _local6;
_local2.portNumber = _arg1.slice(_local3, _local4);
} else {
_local4 = _local6;
_local2.serverName = _arg1.slice(_local3, _local4);
};
_local3 = (_local4 + 1);
};
if (_arg1.charAt(_local3) == "?"){
_local7 = _arg1.slice((_local3 + 1));
_local8 = parseURL(_local7);
if ((((_local8.protocol == null)) || (!(_local8.isRTMP)))){
throw (new VideoError(VideoError.INVALID_SOURCE, _arg1));
};
_local2.wrappedURL = "?";
_local2.wrappedURL = (_local2.wrappedURL + _local8.protocol);
if (_local8.serverName != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.serverName);
};
if (_local8.portNumber != null){
_local2.wrappedURL = (_local2.wrappedURL + (":" + _local8.portNumber));
};
if (_local8.wrappedURL != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.wrappedURL);
};
_local2.appName = _local8.appName;
_local2.streamName = _local8.streamName;
return (_local2);
};
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.appName = _arg1.slice(_local3);
return (_local2);
};
_local2.appName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
return (_local2);
};
_local2.appName = (_local2.appName + "/");
_local2.appName = (_local2.appName + _arg1.slice(_local3, _local4));
_local3 = (_local4 + 1);
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
} else {
_local2.isRTMP = false;
_local2.streamName = _arg1;
};
return (_local2);
}
flvplayback_internal function initOtherInfo():void{
_contentPath = null;
_streamName = null;
_streamWidth = -1;
_streamHeight = -1;
_streamLength = NaN;
_streams = null;
_autoSenseBW = false;
_payload = 0;
_connTypeCounter = 0;
cleanConns();
}
public function set timeout(_arg1:uint):void{
_timeoutTimer.delay = _arg1;
}
flvplayback_internal function _onFMSConnectTimeOut(_arg1:TimerEvent=null):void{
cleanConns();
_nc = null;
_ncConnected = false;
if (!connectAgain()){
_owner.ncConnected();
};
}
public function get streamHeight():int{
return (_streamHeight);
}
flvplayback_internal function connectOnStatus(_arg1:NetStatusEvent):void{
var _local2:ParseResults;
_arg1.target.client.pending = false;
if (_arg1.info.code == "NetConnection.Connect.Success"){
_nc = _tryNC[_arg1.target.client.connIndex];
cleanConns();
} else {
if ((((((_arg1.info.code == "NetConnection.Connect.Rejected")) && (!((_arg1.info.ex == null))))) && ((_arg1.info.ex.code == 302)))){
_connTypeCounter = 0;
cleanConns();
_local2 = parseURL(_arg1.info.ex.redirect);
if (_local2.isRTMP){
_protocol = _local2.protocol;
_serverName = _local2.serverName;
_wrappedURL = _local2.wrappedURL;
_portNumber = _local2.portNumber;
_appName = _local2.appName;
if (_local2.streamName != null){
_appName = (_appName + ("/" + _local2.streamName));
};
connectRTMP();
} else {
tryFallBack();
};
} else {
if ((((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))) && ((_arg1.target.client.connIndex == (_tryNC.length - 1))))){
if (!connectAgain()){
tryFallBack();
};
};
};
};
}
flvplayback_internal function onReconnected():void{
_ncConnected = true;
_owner.ncReconnected();
}
flvplayback_internal function tryFallBack():void{
if ((((_serverName == fallbackServerName)) || ((fallbackServerName == null)))){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
} else {
_connTypeCounter = 0;
cleanConns();
_serverName = fallbackServerName;
connectRTMP();
};
}
public function set bitrate(_arg1:Number):void{
if (!_isRTMP){
_bitrate = _arg1;
};
}
flvplayback_internal function onConnected(_arg1:NetConnection, _arg2:Number):void{
var _local3:Array;
var _local4:uint;
var _local5:String;
_timeoutTimer.stop();
_arg1.removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_nc = _arg1;
_ncUri = _nc.uri;
_ncConnected = true;
if (_autoSenseBW){
_bitrate = (_arg2 * 0x0400);
if (_streams != null){
bitrateMatch();
} else {
_local3 = _streamName.split(",");
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = stripFrontAndBackWhiteSpace(_local3[_local4]);
if ((_local4 + 1) < _local3.length){
if (_arg2 <= Number(_local3[(_local4 + 1)])){
_streamName = _local5;
break;
};
} else {
_streamName = _local5;
break;
};
_local4 = (_local4 + 2);
};
if (_streamName.slice(-4).toLowerCase() == ".flv"){
_streamName = _streamName.slice(0, -4);
};
};
};
if (((!(_owner.isLive)) && (isNaN(_streamLength)))){
_nc.call("getStreamLength", new Responder(getStreamLengthResult), _streamName);
} else {
_owner.ncConnected();
};
}
public function close():void{
if (_nc){
_nc.close();
_ncConnected = false;
};
}
flvplayback_internal static function stripFrontAndBackWhiteSpace(_arg1:String):String{
var _local2:uint;
var _local3:uint = _arg1.length;
var _local4:int;
var _local5:int = _local3;
_local2 = 0;
for (;_local2 < _local3;_local2++) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local4 = _local2;
break;
};
_local2 = _local3;
for (;_local2 >= 0;_local2--) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local5 = (_local2 + 1);
break;
};
if (_local5 <= _local4){
return ("");
};
return (_arg1.slice(_local4, _local5));
}
}
}//package fl.video
Section 50
//ParseResults (fl.video.ParseResults)
package fl.video {
public class ParseResults {
public var portNumber:String;
public var streamName:String;
public var appName:String;
public var serverName:String;
public var isRTMP:Boolean;
public var wrappedURL:String;
public var isRelative:Boolean;
public var protocol:String;
}
}//package fl.video
Section 51
//QueuedCommand (fl.video.QueuedCommand)
package fl.video {
public class QueuedCommand {
public var isLive:Boolean;
public var type:uint;
public var time:Number;
public var url:String;
public static const LOAD:uint = 1;
public static const STOP:uint = 3;
public static const PLAY_WHEN_ENOUGH:uint = 5;
public static const PLAY:uint = 0;
public static const PAUSE:uint = 2;
public static const SEEK:uint = 4;
public function QueuedCommand(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number){
this.type = _arg1;
this.url = _arg2;
this.isLive = _arg3;
this.time = _arg4;
}
}
}//package fl.video
Section 52
//ReconnectClient (fl.video.ReconnectClient)
package fl.video {
public class ReconnectClient {
public var owner:NCManager;
public function ReconnectClient(_arg1:NCManager){
this.owner = _arg1;
}
public function close():void{
}
public function onBWDone(... _args):void{
owner.onReconnected();
}
}
}//package fl.video
Section 53
//SeekBarAccImpl (fl.video.SeekBarAccImpl)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.accessibility.*;
public class SeekBarAccImpl extends AccessibilityImplementation {
private var _timer:Timer;
private var _vc:FLVPlayback;
protected var master:Sprite;
protected var role:uint;
private var _cachedPercentage:Number;
private static const ROLE_SYSTEM_INDICATOR:uint = 39;
private static const ROLE_SLIDER:uint = 51;
private static const STATE_SYSTEM_FOCUSABLE:uint = 0x100000;
private static const EVENT_OBJECT_SELECTION:uint = 32774;
private static const ROLE_SYSTEM_PUSHBUTTON:uint = 43;
private static const STATE_SYSTEM_FOCUSED:uint = 4;
private static const STATE_SYSTEM_SELECTABLE:uint = 0x200000;
private static const EVENT_OBJECT_FOCUS:uint = 32773;
private static const STATE_SYSTEM_SELECTED:uint = 2;
private static const EVENT_OBJECT_VALUECHANGE:uint = 32782;
private static const EVENT_OBJECT_LOCATIONCHANGE:uint = 32779;
private static const STATE_SYSTEM_NORMAL:uint = 0;
private static const STATE_SYSTEM_UNAVAILABLE:uint = 1;
public function SeekBarAccImpl(_arg1:Sprite){
var n:int;
var i:int;
var sprite = _arg1;
super();
stub = false;
master = sprite;
if (!master.accessibilityProperties){
master.accessibilityProperties = new AccessibilityProperties();
};
master.accessibilityProperties.forceSimple = true;
var events:Array = eventsToHandle;
if (events){
n = events.length;
i = 0;
while (i < n) {
master.addEventListener(events[i], eventHandler);
i = (i + 1);
};
};
master.addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
try {
_vc = Object(master).uiMgr._vc;
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, eventHandler);
} catch(e:Error) {
};
role = SeekBarAccImpl.ROLE_SLIDER;
}
protected function getName(_arg1:uint):String{
var _local2 = "";
switch (_arg1){
case 1:
_local2 = "Page Left";
break;
case 2:
_local2 = "Position";
break;
case 3:
_local2 = "Page Right";
break;
case 0:
_local2 = "";
break;
};
return (_local2);
}
override public function get_accName(_arg1:uint):String{
var _local2 = "";
if ((((((((_arg1 == 0)) && (master.accessibilityProperties))) && (master.accessibilityProperties.name))) && (!((master.accessibilityProperties.name == ""))))){
_local2 = (_local2 + (master.accessibilityProperties.name + " "));
};
_local2 = (_local2 + (getName(_arg1) + getStatusName()));
return ((((!((_local2 == null))) && (!((_local2 == ""))))) ? _local2 : null);
}
private function secondsToTime(_arg1:Number):String{
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:Number;
_local5 = ((_arg1)>=3600) ? (_arg1 / 3600) : 0;
_local6 = ((_arg1)>=60) ? ((_arg1 / 60) - (_local5 * 60)) : 0;
_local7 = (_arg1 - ((_local5 * 3600) + (_local6 * 60)));
_local2 = String(_local5);
_local3 = ((((String(_local6).length == 1)) && ((_local5 > 0)))) ? ("0" + String(_local6)) : String(_local6);
_local4 = ((String(Math.floor(_local7)).length)==1) ? ("0" + String(_local7)) : String(_local7);
var _local8:String = ((_local3 + ":") + _local4);
if (_local5 > 0){
_local8 = ((((_local2 + ":") + _local3) + ":") + _local4);
};
return (_local8);
}
override public function accDoDefaultAction(_arg1:uint):void{
var nearestCuePoint:Object;
var nextCuePoint:Object;
var childID = _arg1;
var percent:Number = _vc.playheadPercentage;
nearestCuePoint = _vc.findNearestCuePoint(_vc.playheadTime);
if (childID == 1){
percent = (percent - (_vc.seekBarScrubTolerance * 2));
_vc.playheadPercentage = Math.max(percent, 0);
} else {
if (childID == 3){
if (_vc.playheadPercentage >= 99){
return;
};
if (((!((nearestCuePoint == null))) && ((nearestCuePoint.index < ((nearestCuePoint.array as Array).length - 1))))){
try {
nextCuePoint = _vc.findCuePoint(nearestCuePoint.array[(nearestCuePoint.index + 1)]);
if (((nextCuePoint) && (_vc.isFLVCuePointEnabled(nextCuePoint)))){
if (isNaN(Number(_vc.metadata.videocodecid))){
_vc.playheadPercentage = Math.max(((nextCuePoint.time / _vc.totalTime) * 100), Math.min(99, (_vc.playheadPercentage + (_vc.seekBarScrubTolerance * 2))));
} else {
_vc.playheadTime = nextCuePoint.time;
};
};
} catch(err:Error) {
};
};
};
};
}
protected function eventHandler(_arg1:Event):void{
var _local2:SeekBarAccImpl;
if (Accessibility.active){
switch (_arg1.type){
case VideoEvent.PLAYHEAD_UPDATE:
_cachedPercentage = _vc.playheadPercentage;
_local2 = this;
if (Accessibility.active){
Accessibility.sendEvent(master, 0, EVENT_OBJECT_SELECTION);
Accessibility.sendEvent(master, 0, EVENT_OBJECT_VALUECHANGE, true);
};
if (!_timer){
_timer = new Timer(10);
_timer.removeEventListener(TimerEvent.TIMER, sendAccessibilityEvent);
_timer.addEventListener(TimerEvent.TIMER, sendAccessibilityEvent);
_timer.start();
};
break;
};
};
}
private function sendAccessibilityEvent(_arg1:TimerEvent):void{
if (_cachedPercentage != _vc.playheadPercentage){
_arg1.target.stop();
_arg1.target.removeEventListener(TimerEvent.TIMER, sendAccessibilityEvent);
_timer = undefined;
if (Accessibility.active){
Accessibility.sendEvent(master, 0, EVENT_OBJECT_SELECTION);
Accessibility.sendEvent(master, 0, EVENT_OBJECT_VALUECHANGE, true);
};
};
}
override public function accLocation(_arg1:uint){
var _local2:Object = master;
var _local3:UIManager = (_vc.uiMgr as UIManager);
var _local4:DisplayObject = (_local3.controls[UIManager.SEEK_BAR] as DisplayObject);
var _local5:Dictionary = (UIManager(_local3).ctrlDataDict as Dictionary);
var _local6:ControlData = _local5[_local4];
switch (_arg1){
case 0:
if (_local6.hit_mc){
_local2 = _local6.hit_mc;
};
break;
case 1:
case 3:
if (_local6.progress_mc){
_local2 = _local6.progress_mc;
};
break;
default:
break;
};
return (_local2);
}
override public function get_accState(_arg1:uint):uint{
var _local2:uint = getState(_arg1);
return (_local2);
}
private function getStatusName():String{
return ("");
}
protected function getState(_arg1:uint):uint{
var _local2:uint = STATE_SYSTEM_NORMAL;
if (_arg1 == 0){
if (((!(master.mouseEnabled)) || (!(master.tabEnabled)))){
_local2 = (_local2 | STATE_SYSTEM_UNAVAILABLE);
} else {
_local2 = (_local2 | STATE_SYSTEM_FOCUSABLE);
};
if (Sprite(master).stage.focus == master){
_local2 = (_local2 | STATE_SYSTEM_FOCUSED);
};
};
return (_local2);
}
override public function get_accDefaultAction(_arg1:uint):String{
if ((((_arg1 == 1)) || ((_arg1 == 3)))){
return ("Press");
};
return (null);
}
override public function getChildIDArray():Array{
var _local1:Array = [];
var _local2:uint;
while (_local2 < 3) {
_local1[_local2] = (_local2 + 1);
_local2++;
};
return (_local1);
}
private function focusInHandler(_arg1:Event):void{
if (Accessibility.active){
Accessibility.sendEvent(master, 0, EVENT_OBJECT_FOCUS);
Accessibility.sendEvent(master, 0, EVENT_OBJECT_VALUECHANGE, true);
};
}
override public function get_accRole(_arg1:uint):uint{
if (_arg1 == 0){
return (role);
};
if (_arg1 == 2){
return (ROLE_SYSTEM_INDICATOR);
};
return (ROLE_SYSTEM_PUSHBUTTON);
}
override public function get_accValue(_arg1:uint):String{
if (_arg1 == 0){
return ((Math.round(_vc.playheadPercentage).toString() + "%"));
};
return (null);
}
protected function get eventsToHandle():Array{
return ([]);
}
public static function createAccessibilityImplementation(_arg1:Sprite):void{
_arg1.accessibilityImplementation = new SeekBarAccImpl(_arg1);
}
public static function enableAccessibility():void{
}
}
}//package fl.video
Section 54
//SkinErrorEvent (fl.video.SkinErrorEvent)
package fl.video {
import flash.events.*;
public class SkinErrorEvent extends ErrorEvent {
public static const SKIN_ERROR:String = "skinError";
public function SkinErrorEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=""){
super(_arg1, _arg2, _arg3, _arg4);
}
override public function clone():Event{
return (new SkinErrorEvent(type, bubbles, cancelable, text));
}
}
}//package fl.video
Section 55
//SMILManager (fl.video.SMILManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class SMILManager {
flvplayback_internal var width:int;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
flvplayback_internal var height:int;
private var _url:String;
flvplayback_internal var videoTags:Array;
flvplayback_internal var baseURLAttr:Array;
private var _owner:INCManager;
public static const VERSION:String = "2.1.0.20";
public static const SHORT_VERSION:String = "2.1";
public function SMILManager(_arg1:INCManager){
_owner = _arg1;
width = -1;
height = -1;
}
flvplayback_internal function parseSwitch(_arg1:XML):void{
var _local2:String;
var _local3:XML;
for (_local2 in _arg1.*) {
_local3 = _arg1.*[_local2];
if (_local3.nodeKind() != "element"){
} else {
switch (_local3.localName()){
case "video":
case "ref":
videoTags.push(parseVideo(_local3));
break;
default:
break;
};
};
};
}
flvplayback_internal function parseVideo(_arg1:XML):Object{
var _local2:Object = new Object();
if (_arg1.@src.length() > 0){
_local2.src = _arg1.@src.toString();
};
if (_arg1.@["system-bitrate"].length() > 0){
_local2.bitrate = int(_arg1.@["system-bitrate"].toString());
};
if (_arg1.@dur.length() > 0){
_local2.dur = parseTime(_arg1.@dur.toString());
};
return (_local2);
}
flvplayback_internal function connectXML(_arg1:String):Boolean{
_url = fixURL(_arg1);
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function fixURL(_arg1:String):String{
var _local2:String;
if (/^(http:|https:)/i.test(_arg1)){
_local2 = ((_arg1.indexOf("?"))>=0) ? "&" : "?";
return ((((_arg1 + _local2) + "FLVPlaybackVersion=") + SHORT_VERSION));
};
return (_arg1);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
baseURLAttr = new Array();
videoTags = new Array();
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "smil"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not smil")));
};
};
checkForIllegalNodes(xml, "element", ["head", "body"]);
if (xml.head.length() > 0){
parseHead(xml.head[0]);
};
if (xml.body.length() < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Tag body is required.")));
} else {
parseBody(xml.body[0]);
};
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
} finally {
xmlLoader.removeEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader = null;
};
}
flvplayback_internal function checkForIllegalNodes(_arg1:XML, _arg2:String, _arg3:Array):void{
var _local4:String;
var _local5:Boolean;
var _local6:XML;
var _local7:String;
var _local8:String;
for (_local4 in _arg1.*) {
_local5 = false;
_local6 = _arg1.*[_local4];
if (_local6.nodeKind() != _arg2){
} else {
_local7 = _local6.localName();
for (_local8 in _arg3) {
if (_arg3[_local8] == _local7){
_local5 = true;
break;
};
};
if (!_local5){
throw (new VideoError(VideoError.INVALID_XML, (((((((("URL: \"" + _url) + "\" ") + _arg2) + " ") + _local7) + " not supported in ") + _arg1.localName()) + " tag.")));
};
};
};
}
flvplayback_internal function parseHead(_arg1:XML):void{
checkForIllegalNodes(_arg1, "element", ["meta", "layout"]);
if (_arg1.meta.length() > 0){
checkForIllegalNodes(_arg1.meta[0], "element", []);
checkForIllegalNodes(_arg1.meta[0], "attribute", ["base"]);
if (_arg1.meta.@base.length() > 0){
baseURLAttr.push(_arg1.meta.@base.toString());
};
};
if (_arg1.layout.length() > 0){
parseLayout(_arg1.layout[0]);
};
}
flvplayback_internal function parseBody(_arg1:XML):void{
var _local2:XML;
var _local4:Object;
if (((!((_arg1.*.length() == 1))) || (!((_arg1.*[0].nodeKind() == "element"))))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " is required to contain exactly one tag.")));
};
_local2 = _arg1.*[0];
var _local3:String = _local2.localName();
switch (_local3){
case "switch":
parseSwitch(_local2);
break;
case "video":
case "ref":
_local4 = parseVideo(_local2);
videoTags.push(_local4);
break;
default:
throw (new VideoError(VideoError.INVALID_XML, (((((("URL: \"" + _url) + "\" Tag ") + _local3) + " not supported in ") + _arg1.localName()) + " tag.")));
};
if (videoTags.length < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" At least one video of ref tag is required.")));
};
}
flvplayback_internal function parseTime(_arg1:String):Number{
var _local3:Number;
var _local4:Number;
var _local2:Object = /^((\d+):)?(\d+):((\d+)(.\d+)?)$/.exec(_arg1);
if (_local2 == null){
_local3 = Number(_arg1);
if (((isNaN(_local3)) || ((_local3 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, ("Invalid dur value: " + _arg1)));
};
return (_local3);
//unresolved jump
};
_local4 = 0;
_local4 = (_local4 + ((uint(_local2[2]) * 60) * 60));
_local4 = (_local4 + (uint(_local2[3]) * 60));
_local4 = (_local4 + Number(_local2[4]));
return (_local4);
}
flvplayback_internal function parseLayout(_arg1:XML):void{
var _local2:XML;
var _local3:Number;
var _local4:Number;
checkForIllegalNodes(_arg1, "element", ["root-layout"]);
if (_arg1["root-layout"].length() > 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Only one base attribute supported in meta tag.")));
};
if (_arg1["root-layout"].length() > 0){
_local2 = _arg1["root-layout"][0];
if (_local2.@width.length() > 0){
_local3 = Number(_local2.@width[0]);
};
if (_local2.@height.length() > 0){
_local4 = Number(_local2.@height[0]);
};
if (((((((isNaN(_local3)) || ((_local3 < 0)))) || (isNaN(_local4)))) || ((_local4 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " requires attributes width and height. Width and height must be numbers greater than or equal to 0.")));
};
width = Math.round(_local3);
height = Math.round(_local4);
};
}
}
}//package fl.video
Section 56
//SoundEvent (fl.video.SoundEvent)
package fl.video {
import flash.events.*;
import flash.media.*;
public class SoundEvent extends Event {
private var _soundTransform:SoundTransform;
public static const SOUND_UPDATE:String = "soundUpdate";
public function SoundEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:SoundTransform=null){
super(_arg1, _arg2, _arg3);
_soundTransform = _arg4;
}
public function get soundTransform():SoundTransform{
return (_soundTransform);
}
override public function clone():Event{
return (new SoundEvent(type, bubbles, cancelable, soundTransform));
}
}
}//package fl.video
Section 57
//UIManager (fl.video.UIManager)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.accessibility.*;
import flash.system.*;
import flash.ui.*;
public class UIManager {
flvplayback_internal var cacheStageBGColor:uint;
flvplayback_internal var _bufferingDelayTimer:Timer;
public var ctrlDataDict:Dictionary;
flvplayback_internal var _skinAutoHide:Boolean;
flvplayback_internal var placeholderLeft:Number;
flvplayback_internal var _playAfterScrub:Boolean;
public var customClips:Array;
flvplayback_internal var _skinFadeStartTime:int;
flvplayback_internal var delayedControls:Array;
flvplayback_internal var _lastScrubPos:Number;
flvplayback_internal var endTabIndex:int;
flvplayback_internal var _skinAutoHideLastMotionTime:int;
flvplayback_internal var _volumeBarTimer:Timer;
flvplayback_internal var cacheFLVPlaybackScaleMode:Array;
flvplayback_internal var borderScale9Rects:Array;
flvplayback_internal var _volumeBarScrubTolerance:Number;
flvplayback_internal var fullScreenSourceRectMinAspectRatio:Number;
flvplayback_internal var _skin:String;
flvplayback_internal var fullScreenSourceRectMinHeight:uint;
flvplayback_internal var _bufferingBarHides:Boolean;
flvplayback_internal var videoRight:Number;
flvplayback_internal var placeholderRight:Number;
flvplayback_internal var cachedSoundLevel:Number;
flvplayback_internal var videoBottom:Number;
flvplayback_internal var border_mc:DisplayObject;
flvplayback_internal var _skinFadingTimer:Timer;
flvplayback_internal var borderAlpha:Number;
flvplayback_internal var borderColorTransform:ColorTransform;
flvplayback_internal var borderColor:uint;
flvplayback_internal var __visible:Boolean;
flvplayback_internal var cacheFLVPlaybackLocation:Rectangle;
flvplayback_internal var cacheFLVPlaybackIndex:int;
flvplayback_internal var _skinReady:Boolean;
flvplayback_internal var hitTarget_mc:Sprite;
flvplayback_internal var controls:Array;
flvplayback_internal var cacheFLVPlaybackAlign:Array;
flvplayback_internal var startTabIndex:int;
flvplayback_internal var _skinAutoHideMouseX:Number;
flvplayback_internal var _skinAutoHideMouseY:Number;
flvplayback_internal var layout_mc:Sprite;
flvplayback_internal var cacheSkinAutoHide:Boolean;
flvplayback_internal var cacheStageScaleMode:String;
flvplayback_internal var videoTop:Number;
flvplayback_internal var _skinFadingMaxTime:int;
flvplayback_internal var placeholderTop:Number;
flvplayback_internal var focusRect:Boolean;// = true
flvplayback_internal var _lastVolumePos:Number;
flvplayback_internal var mouseCaptureCtrl:int;
flvplayback_internal var _seekBarScrubTolerance:Number;
flvplayback_internal var borderPrevRect:Rectangle;
flvplayback_internal var skinTemplate:Sprite;
flvplayback_internal var _progressPercent:Number;
flvplayback_internal var videoLeft:Number;
flvplayback_internal var _fullScreenVideoWidth:Number;
flvplayback_internal var _isMuted:Boolean;
flvplayback_internal var _skinAutoHideTimer:Timer;
flvplayback_internal var _fullScreenBgColor:uint;
flvplayback_internal var _vc:FLVPlayback;
flvplayback_internal var _bufferingOn:Boolean;
flvplayback_internal var _seekBarTimer:Timer;
flvplayback_internal var _controlsEnabled:Boolean;
flvplayback_internal var _fullScreen:Boolean;
flvplayback_internal var placeholderBottom:Number;
flvplayback_internal var fullScreenSourceRectMinWidth:uint;
flvplayback_internal var _fullScreenTakeOver:Boolean;
flvplayback_internal var skin_mc:Sprite;
flvplayback_internal var _fullScreenAccel:Boolean;
flvplayback_internal var _fullScreenVideoHeight:Number;
flvplayback_internal var skinLoadDelayCount:uint;
flvplayback_internal var _skinFadingIn:Boolean;
flvplayback_internal var _skinAutoHideMotionTimeout:int;
flvplayback_internal var borderCopy:Sprite;
flvplayback_internal var accessibilityPropertyNames:Array;
flvplayback_internal var cacheStageAlign:String;
flvplayback_internal var cacheFLVPlaybackParent:DisplayObjectContainer;
flvplayback_internal var skinLoader:Loader;
flvplayback_internal var _skinScaleMaximum:Number;
public static const VOLUME_BAR_HIT:int = 12;
public static const MUTE_OFF_BUTTON:int = 10;
public static const BACK_BUTTON:int = 5;
public static const FORWARD_BUTTON:int = 6;
public static const STOP_BUTTON:int = 2;
public static const NUM_BUTTONS:int = 13;
public static const NORMAL_STATE:uint = 0;
public static const SEEK_BAR_HANDLE:int = 3;
public static const PLAY_BUTTON:int = 1;
public static const MUTE_BUTTON:int = 15;
public static const DOWN_STATE:uint = 2;
public static const SEEK_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 5;
public static const FULL_SCREEN_OFF_BUTTON:int = 8;
flvplayback_internal static const SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT:Number = 3000;
public static const SEEK_BAR:int = 17;
public static const VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 0;
public static const FULL_SCREEN_ON_BUTTON:int = 7;
public static const SHOW_CONTROLS_BUTTON:Number = 30;
public static const FULL_SCREEN_BUTTON:int = 14;
public static const BUFFERING_BAR:int = 16;
public static const VERSION:String = "2.1.0.20";
public static const VOLUME_BAR_HANDLE:int = 11;
public static const PAUSE_BUTTON:int = 0;
flvplayback_internal static const SKIN_AUTO_HIDE_INTERVAL:Number = 200;
public static const CAPTIONS_ON_BUTTON:Number = 28;
public static const OVER_STATE:uint = 1;
flvplayback_internal static const SKIN_FADING_INTERVAL:Number = 100;
public static const VOLUME_BAR:int = 18;
public static const CAPTIONS_OFF_BUTTON:Number = 29;
public static const SHORT_VERSION:String = "2.1";
public static const SEEK_BAR_INTERVAL_DEFAULT:Number = 250;
flvplayback_internal static const SKIN_FADING_MAX_TIME_DEFAULT:Number = 500;
public static const SEEK_BAR_HIT:int = 4;
public static const PLAY_PAUSE_BUTTON:int = 13;
public static const BUFFERING_DELAY_INTERVAL_DEFAULT:Number = 1000;
public static const MUTE_ON_BUTTON:int = 9;
public static const HIDE_CONTROLS_BUTTON:Number = 31;
public static const FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT:uint = 240;
public static const NUM_CONTROLS:int = 19;
public static const VOLUME_BAR_INTERVAL_DEFAULT:Number = 250;
public static const FULL_SCREEN_SOURCE_RECT_MIN_WIDTH:uint = 320;
flvplayback_internal static var layoutNameToIndexMappings:Object = null;
flvplayback_internal static var buttonSkinLinkageIDs:Array = ["upLinkageID", "overLinkageID", "downLinkageID"];
flvplayback_internal static var layoutNameArray:Array = ["pause_mc", "play_mc", "stop_mc", null, null, "back_mc", "forward_mc", null, null, null, null, null, null, "playpause_mc", "fullScreenToggle_mc", "volumeMute_mc", "bufferingBar_mc", "seekBar_mc", "volumeBar_mc", "seekBarHandle_mc", "seekBarHit_mc", "seekBarProgress_mc", "seekBarFullness_mc", "volumeBarHandle_mc", "volumeBarHit_mc", "volumeBarProgress_mc", "volumeBarFullness_mc", "progressFill_mc"];
flvplayback_internal static var skinClassPrefixes:Array = ["pauseButton", "playButton", "stopButton", null, null, "backButton", "forwardButton", "fullScreenButtonOn", "fullScreenButtonOff", "muteButtonOn", "muteButtonOff", null, null, null, null, null, "bufferingBar", "seekBar", "volumeBar"];
flvplayback_internal static var customComponentClassNames:Array = ["PauseButton", "PlayButton", "StopButton", null, null, "BackButton", "ForwardButton", null, null, null, null, null, null, "PlayPauseButton", "FullScreenButton", "MuteButton", "BufferingBar", "SeekBar", "VolumeBar"];
public function UIManager(_arg1:FLVPlayback){
var vc = _arg1;
accessibilityPropertyNames = ["Pause", "Play", "Stop", "Seek Bar", null, "Back", "Forward", "Go Full Screen", "Exit Full Screen", "Volume Mute On", "Volume Mute Off", "Volume", null, null, null, null, "Buffering", null, null, null, null, null, null, null, null, null, null, null, "Captions Off", "Captions On", "Show Video Player Controls", "Hide Video Player Controls"];
super();
_vc = vc;
_skin = null;
_skinAutoHide = false;
cacheSkinAutoHide = _skinAutoHide;
_skinFadingMaxTime = SKIN_FADING_MAX_TIME_DEFAULT;
_skinAutoHideMotionTimeout = SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT;
_skinReady = true;
__visible = false;
_bufferingBarHides = false;
_controlsEnabled = true;
_lastScrubPos = 0;
_lastVolumePos = 0;
cachedSoundLevel = _vc.volume;
_isMuted = false;
controls = new Array();
customClips = null;
ctrlDataDict = new Dictionary(true);
skin_mc = null;
skinLoader = null;
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
borderAlpha = 0.85;
borderColor = 4697035;
borderColorTransform = new ColorTransform(0, 0, 0, 0, 71, 171, 203, (0xFF * borderAlpha));
_seekBarScrubTolerance = SEEK_BAR_SCRUB_TOLERANCE_DEFAULT;
_volumeBarScrubTolerance = VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT;
_bufferingOn = false;
mouseCaptureCtrl = -1;
_seekBarTimer = new Timer(SEEK_BAR_INTERVAL_DEFAULT);
_seekBarTimer.addEventListener(TimerEvent.TIMER, seekBarListener);
_volumeBarTimer = new Timer(VOLUME_BAR_INTERVAL_DEFAULT);
_volumeBarTimer.addEventListener(TimerEvent.TIMER, volumeBarListener);
_bufferingDelayTimer = new Timer(BUFFERING_DELAY_INTERVAL_DEFAULT, 1);
_bufferingDelayTimer.addEventListener(TimerEvent.TIMER, doBufferingDelay);
_skinAutoHideTimer = new Timer(SKIN_AUTO_HIDE_INTERVAL);
_skinAutoHideTimer.addEventListener(TimerEvent.TIMER, skinAutoHideHitTest);
_skinFadingTimer = new Timer(SKIN_FADING_INTERVAL);
_skinFadingTimer.addEventListener(TimerEvent.TIMER, skinFadeMore);
_vc.addEventListener(MetadataEvent.METADATA_RECEIVED, handleIVPEvent);
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
_vc.addEventListener(VideoProgressEvent.PROGRESS, handleIVPEvent);
_vc.addEventListener(VideoEvent.STATE_CHANGE, handleIVPEvent);
_vc.addEventListener(VideoEvent.READY, handleIVPEvent);
_vc.addEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.addEventListener(Event.REMOVED_FROM_STAGE, handleEvent);
fullScreenSourceRectMinWidth = FULL_SCREEN_SOURCE_RECT_MIN_WIDTH;
fullScreenSourceRectMinHeight = FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT;
fullScreenSourceRectMinAspectRatio = (FULL_SCREEN_SOURCE_RECT_MIN_WIDTH / FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT);
_fullScreen = false;
_fullScreenTakeOver = true;
_fullScreenBgColor = 0;
_fullScreenAccel = false;
if (_vc.stage != null){
_vc.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, handleMouseFocusChangeEvent);
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
if (layoutNameToIndexMappings == null){
initLayoutNameToIndexMappings();
};
}
public function get seekBarScrubTolerance():Number{
return (_seekBarScrubTolerance);
}
flvplayback_internal function removeButtonListeners(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
_arg1.removeEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.CLICK, handleButtonEvent);
_arg1.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
}
public function set skinFadeTime(_arg1:int):void{
_skinFadingMaxTime = _arg1;
}
public function get skinFadeTime():int{
return (_skinFadingMaxTime);
}
flvplayback_internal function finishLoad(_arg1:Event):void{
var i:int;
var cachedActivePlayerIndex:int;
var state:String;
var j:int;
var e = _arg1;
try {
skinLoadDelayCount++;
if (skinLoadDelayCount < 2){
return;
} else {
_vc.removeEventListener(Event.ENTER_FRAME, finishLoad);
};
focusRect = isFocusRectActive();
i = 0;
while (i < NUM_CONTROLS) {
if (delayedControls[i] != undefined){
setControl(i, delayedControls[i]);
};
i = (i + 1);
};
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
exitFullScreenTakeOver();
};
layoutSkin();
setupSkinAutoHide(false);
skin_mc.visible = __visible;
_vc.addChild(skin_mc);
_skinReady = true;
_vc.skinLoaded();
cachedActivePlayerIndex = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
state = _vc.state;
j = 0;
while (j < NUM_CONTROLS) {
if (controls[j] == undefined){
} else {
setEnabledAndVisibleForState(j, state);
if (j < NUM_BUTTONS){
skinButtonControl(controls[j]);
};
};
j = (j + 1);
};
_vc.activeVideoPlayerIndex = cachedActivePlayerIndex;
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function downloadSkin():void{
if (skinLoader == null){
skinLoader = new Loader();
skinLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoad);
skinLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadErrorEvent);
skinLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleLoadErrorEvent);
};
skinLoader.load(new URLRequest(_skin));
}
flvplayback_internal function removeSkin():void{
var i:int;
if (skinLoader != null){
try {
skinLoader.close();
} catch(e1:Error) {
};
skinLoader = null;
};
if (skin_mc != null){
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == undefined){
} else {
if (i < NUM_BUTTONS){
removeButtonListeners(controls[i]);
};
delete ctrlDataDict[controls[i]];
delete controls[i];
};
i = (i + 1);
};
try {
skin_mc.parent.removeChild(skin_mc);
} catch(e2:Error) {
};
skin_mc = null;
};
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
}
flvplayback_internal function positionBar(_arg1:Sprite, _arg2:String, _arg3:Number):void{
var ctrl = _arg1;
var type = _arg2;
var percent = _arg3;
try {
if ((((ctrl["positionBar"] is Function)) && (ctrl["positionBar"](type, percent)))){
return;
};
} catch(re2:ReferenceError) {
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
var bar:DisplayObject = ctrlData[(type + "_mc")];
if (bar == null){
return;
};
var barData:ControlData = ctrlDataDict[bar];
if (bar.parent == ctrl){
if (barData.fill_mc == null){
bar.scaleX = ((barData.origScaleX * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
} else {
bar.x = (ctrl.x + barData.leftMargin);
bar.y = (ctrl.y + barData.origY);
if (barData.fill_mc == null){
bar.width = ((((ctrl.width - barData.leftMargin) - barData.rightMargin) * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
};
}
flvplayback_internal function setupButtonSkin(_arg1:int, _arg2:DisplayObject):Sprite{
var _local3:String = skinClassPrefixes[_arg1];
if (_local3 == null){
return (null);
};
var _local4:Sprite = new Sprite();
var _local5:ControlData = new ControlData(this, _local4, null, _arg1);
ctrlDataDict[_local4] = _local5;
_local5.state_mc = new Array();
_local5.state_mc[NORMAL_STATE] = setupButtonSkinState(_local4, skinTemplate, (_local3 + "NormalState"));
_local5.state_mc[NORMAL_STATE].visible = true;
_local5.state_mc[OVER_STATE] = setupButtonSkinState(_local4, skinTemplate, (_local3 + "OverState"), _local5.state_mc[NORMAL_STATE]);
_local5.state_mc[DOWN_STATE] = setupButtonSkinState(_local4, skinTemplate, (_local3 + "DownState"), _local5.state_mc[NORMAL_STATE]);
_local5.disabled_mc = setupButtonSkinState(_local4, skinTemplate, (_local3 + "DisabledState"), _local5.state_mc[NORMAL_STATE]);
if ((_arg2 is InteractiveObject)){
_local4.tabIndex = InteractiveObject(_arg2).tabIndex;
};
return (_local4);
}
public function get skinReady():Boolean{
return (_skinReady);
}
public function get skinAutoHide():Boolean{
return (_skinAutoHide);
}
flvplayback_internal function dispatchMessage(_arg1:int):void{
var ctrl:Sprite;
var ctrlData:ControlData;
var handle:Sprite;
var index = _arg1;
if ((((index == SEEK_BAR_HANDLE)) || ((index == SEEK_BAR_HIT)))){
_vc._scrubStart();
};
var cachedActivePlayerIndex:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (index){
case PAUSE_BUTTON:
_vc.pause();
break;
case PLAY_BUTTON:
_vc.play();
break;
case STOP_BUTTON:
_vc.stop();
break;
case SEEK_BAR_HIT:
case SEEK_BAR_HANDLE:
ctrl = controls[SEEK_BAR];
ctrlData = ctrlDataDict[ctrl];
calcPercentageFromHandle(ctrl);
_lastScrubPos = ctrlData.percentage;
if (index == SEEK_BAR_HIT){
handle = controls[SEEK_BAR_HANDLE];
handle.x = handle.parent.mouseX;
handle.y = handle.parent.mouseY;
};
_vc.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (((_vc.playing) || (_vc.buffering))){
_playAfterScrub = true;
} else {
if (_vc.state != VideoState.SEEKING){
_playAfterScrub = false;
};
};
_seekBarTimer.start();
startHandleDrag(ctrl);
_vc.pause();
break;
case VOLUME_BAR_HIT:
case VOLUME_BAR_HANDLE:
ctrl = controls[VOLUME_BAR];
ctrlData = ctrlDataDict[ctrl];
calcPercentageFromHandle(ctrl);
_lastVolumePos = ctrlData.percentage;
if (index == VOLUME_BAR_HIT){
handle = controls[VOLUME_BAR_HANDLE];
handle.x = handle.parent.mouseX;
handle.y = handle.parent.mouseY;
};
_vc.removeEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_volumeBarTimer.start();
startHandleDrag(ctrl);
break;
case BACK_BUTTON:
_vc.seekToPrevNavCuePoint();
break;
case FORWARD_BUTTON:
_vc.seekToNextNavCuePoint();
break;
case MUTE_ON_BUTTON:
if (!_isMuted){
_isMuted = true;
cachedSoundLevel = _vc.volume;
_vc.volume = 0;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case MUTE_OFF_BUTTON:
if (_isMuted){
_isMuted = false;
_vc.volume = cachedSoundLevel;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case FULL_SCREEN_ON_BUTTON:
if (((!(_fullScreen)) && (!((_vc.stage == null))))){
enterFullScreenDisplayState();
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
case FULL_SCREEN_OFF_BUTTON:
if (((_fullScreen) && (!((_vc.stage == null))))){
try {
_vc.stage.displayState = StageDisplayState.NORMAL;
} catch(se:SecurityError) {
};
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
default:
throw (new Error("Unknown ButtonControl"));
};
_vc.activeVideoPlayerIndex = cachedActivePlayerIndex;
}
flvplayback_internal function handleFullScreenEvent(_arg1:FullScreenEvent):void{
_fullScreen = _arg1.fullScreen;
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
}
flvplayback_internal function handleLayoutEvent(_arg1:LayoutEvent):void{
var _local2:int;
if (((((((_fullScreen) && (_fullScreenTakeOver))) && (_fullScreenAccel))) && (!((_vc.stage == null))))){
if (((((((((!((_vc.registrationX == 0))) || (!((_vc.registrationY == 0))))) || (!((_vc.parent == _vc.stage))))) || (((_fullScreenAccel) && (((!((_vc.registrationWidth == _vc.stage.fullScreenSourceRect.width))) || (!((_vc.registrationHeight == _vc.stage.fullScreenSourceRect.height))))))))) || (((!(_fullScreenAccel)) && (((!((_vc.registrationWidth == _vc.stage.stageWidth))) || (!((_vc.registrationHeight == _vc.stage.stageHeight))))))))){
_vc.stage.displayState = StageDisplayState.NORMAL;
return;
};
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_vc.align != VideoAlign.CENTER){
cacheFLVPlaybackAlign[_vc.visibleVideoPlayerIndex] = _vc.align;
_vc.align = VideoAlign.CENTER;
};
if (_vc.scaleMode != VideoScaleMode.MAINTAIN_ASPECT_RATIO){
cacheFLVPlaybackScaleMode[_vc.visibleVideoPlayerIndex] = _vc.scaleMode;
_vc.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_vc.activeVideoPlayerIndex = _local2;
return;
};
_vc.activeVideoPlayerIndex = _local2;
};
layoutSkin();
setupSkinAutoHide(false);
}
flvplayback_internal function seekBarListener(_arg1:TimerEvent):void{
var _local2:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
var _local3:Sprite = controls[SEEK_BAR];
if (_local3 == null){
return;
};
var _local4:ControlData = ctrlDataDict[_local3];
calcPercentageFromHandle(_local3);
var _local5:Number = _local4.percentage;
if (_arg1 == null){
_seekBarTimer.stop();
if (_local5 != _lastScrubPos){
_vc.seekPercent(_local5);
};
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (_playAfterScrub){
_vc.play();
};
} else {
if (_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING){
} else {
if ((((((((_seekBarScrubTolerance <= 0)) || ((Math.abs((_local5 - _lastScrubPos)) > _seekBarScrubTolerance)))) || ((_local5 < _seekBarScrubTolerance)))) || ((_local5 > (100 - _seekBarScrubTolerance))))){
if (_local5 != _lastScrubPos){
_lastScrubPos = _local5;
_vc.seekPercent(_local5);
};
};
};
};
_vc.activeVideoPlayerIndex = _local2;
}
private function handleMouseFocusChangeEvent(_arg1:FocusEvent):void{
var ctrlData:ControlData;
var focusCtrlData:ControlData;
var ctrl:Sprite;
var setFocusedControl:Function;
var event = _arg1;
try {
ctrlData = ctrlDataDict[event.relatedObject];
} catch(error:ReferenceError) {
};
if (ctrlData == null){
return;
};
var index:int = ctrlData.index;
var currentFocus:InteractiveObject = (event.target.stage.focus as InteractiveObject);
var focusControl:InteractiveObject;
switch (index){
case PLAY_BUTTON:
focusControl = (controls[PAUSE_BUTTON] as InteractiveObject);
break;
case PAUSE_BUTTON:
focusControl = (controls[PLAY_BUTTON] as InteractiveObject);
break;
case STOP_BUTTON:
case BACK_BUTTON:
case FORWARD_BUTTON:
case SEEK_BAR_HANDLE:
case VOLUME_BAR_HANDLE:
focusControl = (controls[event.relatedObject] as InteractiveObject);
break;
case SEEK_BAR_HIT:
focusControl = (controls[SEEK_BAR_HANDLE] as InteractiveObject);
break;
case VOLUME_BAR_HIT:
focusControl = (controls[VOLUME_BAR_HANDLE] as InteractiveObject);
break;
case MUTE_ON_BUTTON:
focusControl = (controls[MUTE_OFF_BUTTON] as InteractiveObject);
break;
case MUTE_OFF_BUTTON:
focusControl = (controls[MUTE_ON_BUTTON] as InteractiveObject);
break;
case FULL_SCREEN_ON_BUTTON:
focusControl = (controls[FULL_SCREEN_OFF_BUTTON] as InteractiveObject);
break;
case FULL_SCREEN_OFF_BUTTON:
focusControl = (controls[FULL_SCREEN_ON_BUTTON] as InteractiveObject);
break;
};
if (focusControl != null){
try {
focusCtrlData = ctrlDataDict[focusControl];
focusCtrlData.cachedFocusRect = focusControl.focusRect;
} catch(error:ReferenceError) {
};
focusControl.focusRect = false;
if (focusControl.visible){
focusControl.stage.focus = focusControl;
focusControl.focusRect = focusCtrlData.cachedFocusRect;
} else {
ctrl = (event.currentTarget as Sprite);
setFocusedControl = function (_arg1:Event):void{
if (_arg1.target.visible){
_arg1.target.stage.focus = _arg1.target;
_arg1.target.focusRect = focusCtrlData.cachedFocusRect;
_arg1.target.removeEventListener(Event.ENTER_FRAME, setFocusedControl);
};
};
focusControl.addEventListener(Event.ENTER_FRAME, setFocusedControl);
};
};
}
public function get seekBarInterval():Number{
return (_seekBarTimer.delay);
}
public function set skinAutoHide(_arg1:Boolean):void{
if (_arg1 == _skinAutoHide){
return;
};
_skinAutoHide = _arg1;
cacheSkinAutoHide = _arg1;
setupSkinAutoHide(true);
}
flvplayback_internal function setCustomClip(_arg1:DisplayObject):void{
var scale9Grid:Rectangle;
var diff:Number;
var numBorderBitmaps:int;
var i:int;
var lastXDim:Number;
var floorLastXDim:Number;
var lastYDim:Number;
var floorLastYDim:Number;
var newRect:Rectangle;
var dispObj = _arg1;
var dCopy:DisplayObject = new (dispObj["constructor"]);
skin_mc.addChild(dCopy);
var ctrlData:ControlData = new ControlData(this, dCopy, null, -1);
ctrlDataDict[dCopy] = ctrlData;
ctrlData.avatar = dispObj;
customClips.push(dCopy);
dCopy.accessibilityProperties = new AccessibilityProperties();
dCopy.accessibilityProperties.silent = true;
if (dispObj.name == "border_mc"){
border_mc = dCopy;
try {
borderCopy = (ctrlData.avatar["colorMe"]) ? new Sprite() : null;
} catch(re:ReferenceError) {
borderCopy = null;
};
if (borderCopy != null){
border_mc.visible = false;
scale9Grid = border_mc.scale9Grid;
scale9Grid.x = Math.round(scale9Grid.x);
scale9Grid.y = Math.round(scale9Grid.y);
scale9Grid.width = Math.round(scale9Grid.width);
diff = ((scale9Grid.x + scale9Grid.width) - border_mc.scale9Grid.right);
if (diff > 0.5){
scale9Grid.width--;
} else {
if (diff < -0.5){
scale9Grid.width++;
};
};
scale9Grid.height = Math.round(scale9Grid.height);
diff = ((scale9Grid.y + scale9Grid.height) - border_mc.scale9Grid.bottom);
if (diff > 0.5){
scale9Grid.height--;
} else {
if (diff < -0.5){
scale9Grid.height++;
};
};
if (scale9Grid != null){
borderScale9Rects = new Array();
lastXDim = (border_mc.width - (scale9Grid.x + scale9Grid.width));
floorLastXDim = Math.floor(lastXDim);
if ((lastXDim - floorLastXDim) < 0.05){
lastXDim = floorLastXDim;
} else {
lastXDim = (floorLastXDim + 1);
};
lastYDim = (border_mc.height - (scale9Grid.y + scale9Grid.height));
floorLastYDim = Math.floor(lastYDim);
if ((lastYDim - floorLastYDim) < 0.05){
lastYDim = floorLastYDim;
} else {
lastYDim = (floorLastYDim + 1);
};
newRect = new Rectangle(0, 0, scale9Grid.x, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, 0, scale9Grid.width, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), 0, lastXDim, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, scale9Grid.y, scale9Grid.x, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, scale9Grid.y, scale9Grid.width, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), scale9Grid.y, lastXDim, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, (scale9Grid.y + scale9Grid.height), scale9Grid.x, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, (scale9Grid.y + scale9Grid.height), scale9Grid.width, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), (scale9Grid.y + scale9Grid.height), lastXDim, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
i = 0;
while (i < borderScale9Rects.length) {
if (borderScale9Rects[i] != null){
break;
};
i = (i + 1);
};
if (i >= borderScale9Rects.length){
borderScale9Rects = null;
};
};
numBorderBitmaps = ((borderScale9Rects)==null) ? 1 : 9;
i = 0;
while (i < numBorderBitmaps) {
if ((((borderScale9Rects == null)) || (!((borderScale9Rects[i] == null))))){
borderCopy.addChild(new Bitmap());
};
i = (i + 1);
};
borderCopy.accessibilityProperties = new AccessibilityProperties();
borderCopy.accessibilityProperties.silent = true;
skin_mc.addChild(borderCopy);
borderPrevRect = null;
};
};
}
public function get fullScreenSkinDelay():int{
return (_skinAutoHideMotionTimeout);
}
flvplayback_internal function doBufferingDelay(_arg1:TimerEvent):void{
_bufferingDelayTimer.reset();
var _local2:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_vc.state == VideoState.BUFFERING){
_bufferingOn = true;
handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.BUFFERING, NaN, _vc.visibleVideoPlayerIndex));
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function volumeBarListener(_arg1:TimerEvent):void{
var _local2:Sprite = controls[VOLUME_BAR];
if (_local2 == null){
return;
};
var _local3:ControlData = ctrlDataDict[_local2];
calcPercentageFromHandle(_local2);
var _local4:Number = _local3.percentage;
var _local5 = (_arg1 == null);
if (_local5){
_volumeBarTimer.stop();
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
};
if (((((((((_local5) || ((_volumeBarScrubTolerance <= 0)))) || ((Math.abs((_local4 - _lastVolumePos)) > _volumeBarScrubTolerance)))) || ((_local4 < _volumeBarScrubTolerance)))) || ((_local4 > (100 - _volumeBarScrubTolerance))))){
if (_local4 != _lastVolumePos){
if (_isMuted){
cachedSoundLevel = (_local4 / 100);
} else {
_vc.volume = (_local4 / 100);
};
_lastVolumePos = _local4;
};
};
}
public function get visible():Boolean{
return (__visible);
}
flvplayback_internal function isFocusRectActive():Boolean{
var i:int;
var doc:DisplayObjectContainer;
var child:DisplayObject;
var classReference:Class;
var c:*;
var o:InteractiveObject = _vc.parent;
while (o) {
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
};
i = 0;
while (i < doc.numChildren) {
try {
child = (doc.getChildAt(i) as DisplayObject);
classReference = (getDefinitionByName("fl.core.UIComponent") as Class);
if (((((!((child == null))) && (!((child == _vc))))) && ((child is classReference)))){
c = (child as classReference);
if (c.focusManager.showFocusIndicator){
return (false);
};
break;
};
} catch(e:Error) {
};
i = (i + 1);
};
o = o.parent;
};
return (true);
}
flvplayback_internal function fixUpBar(_arg1:DisplayObject, _arg2:String, _arg3:DisplayObject, _arg4:String):void{
var bar:DisplayObject;
var definitionHolder = _arg1;
var propPrefix = _arg2;
var ctrl = _arg3;
var name = _arg4;
var ctrlData:ControlData = ctrlDataDict[ctrl];
if (ctrlData[name] != null){
return;
};
try {
bar = ctrl[name];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
try {
bar = createSkin(definitionHolder, (propPrefix + "LinkageID"));
} catch(ve:VideoError) {
bar = null;
};
if (bar == null){
return;
};
if (ctrl.parent != null){
if (getBooleanPropSafe(ctrl, (propPrefix + "Below"))){
ctrl.parent.addChildAt(bar, ctrl.parent.getChildIndex(ctrl));
} else {
ctrl.parent.addChild(bar);
};
};
};
ctrlData[name] = bar;
var barData:ControlData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
}
public function get volumeBarInterval():Number{
return (_volumeBarTimer.delay);
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (_bufferingBarHides);
}
flvplayback_internal function calcLayoutControl(_arg1:DisplayObject):Rectangle{
var ctrl = _arg1;
var rect:Rectangle = new Rectangle();
if (ctrl == null){
return (rect);
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return (rect);
};
if (ctrlData.avatar == null){
return (rect);
};
var anchorRight:Boolean;
var anchorLeft:Boolean;
var anchorTop:Boolean;
var anchorBottom:Boolean;
try {
anchorRight = ctrlData.avatar["anchorRight"];
} catch(re1:ReferenceError) {
anchorRight = false;
};
try {
anchorLeft = ctrlData.avatar["anchorLeft"];
} catch(re1:ReferenceError) {
anchorLeft = true;
};
try {
anchorTop = ctrlData.avatar["anchorTop"];
} catch(re1:ReferenceError) {
anchorTop = false;
};
try {
anchorBottom = ctrlData.avatar["anchorBottom"];
} catch(re1:ReferenceError) {
anchorBottom = true;
};
if (anchorRight){
if (anchorLeft){
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ((((ctrlData.avatar.x + ctrlData.avatar.width) - placeholderRight) + videoRight) - rect.x);
ctrlData.origWidth = NaN;
} else {
rect.x = ((ctrlData.avatar.x - placeholderRight) + videoRight);
rect.width = ctrl.width;
};
} else {
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ctrl.width;
};
if (anchorTop){
if (anchorBottom){
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ((((ctrlData.avatar.y + ctrlData.avatar.height) - placeholderBottom) + videoBottom) - rect.y);
ctrlData.origHeight = NaN;
} else {
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ctrl.height;
};
} else {
rect.y = ((ctrlData.avatar.y - placeholderBottom) + videoBottom);
rect.height = ctrl.height;
};
try {
if ((ctrl["layoutSelf"] is Function)){
rect = ctrl["layoutSelf"](rect);
};
} catch(re3:ReferenceError) {
};
return (rect);
}
flvplayback_internal function skinFadeMore(_arg1:TimerEvent):void{
var _local2:Number;
if (((((!(_skinFadingIn)) && ((skin_mc.alpha <= 0.5)))) || (((_skinFadingIn) && ((skin_mc.alpha >= 0.95)))))){
skin_mc.visible = _skinFadingIn;
skin_mc.alpha = 1;
_skinFadingTimer.stop();
} else {
_local2 = ((getTimer() - _skinFadeStartTime) / _skinFadingMaxTime);
if (!_skinFadingIn){
_local2 = (1 - _local2);
};
if (_local2 < 0){
_local2 = 0;
} else {
if (_local2 > 1){
_local2 = 1;
};
};
skin_mc.alpha = _local2;
};
}
flvplayback_internal function resetPlayPause():void{
if (controls[PLAY_PAUSE_BUTTON] == undefined){
return;
};
var _local1:int = PAUSE_BUTTON;
while (_local1 <= PLAY_BUTTON) {
removeButtonListeners(controls[_local1]);
delete ctrlDataDict[controls[_local1]];
delete controls[_local1];
_local1++;
};
delete ctrlDataDict[controls[PLAY_PAUSE_BUTTON]];
delete controls[PLAY_PAUSE_BUTTON];
}
public function setControl(_arg1:int, _arg2:Sprite):void{
var index = _arg1;
var ctrl = _arg2;
if (ctrl == controls[index]){
return;
};
if (ctrl){
ctrl.tabEnabled = false;
};
switch (index){
case PAUSE_BUTTON:
case PLAY_BUTTON:
resetPlayPause();
break;
case PLAY_PAUSE_BUTTON:
if ((((ctrl == null)) || (!((ctrl.parent == skin_mc))))){
resetPlayPause();
};
if (ctrl != null){
setControl(PAUSE_BUTTON, Sprite(ctrl.getChildByName("pause_mc")));
setControl(PLAY_BUTTON, Sprite(ctrl.getChildByName("play_mc")));
};
break;
case FULL_SCREEN_BUTTON:
if (ctrl != null){
setControl(FULL_SCREEN_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(FULL_SCREEN_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
case MUTE_BUTTON:
if (ctrl != null){
setControl(MUTE_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(MUTE_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
};
if (controls[index] != null){
try {
delete controls[index]["uiMgr"];
} catch(re:ReferenceError) {
};
if (index < NUM_BUTTONS){
removeButtonListeners(controls[index]);
};
delete ctrlDataDict[controls[index]];
delete controls[index];
};
if (ctrl == null){
return;
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
if (ctrlData == null){
ctrlData = new ControlData(this, ctrl, null, index);
ctrlDataDict[ctrl] = ctrlData;
} else {
ctrlData.index = index;
};
if (index >= NUM_BUTTONS){
controls[index] = ctrl;
switch (index){
case SEEK_BAR:
addBarControl(ctrl);
break;
case VOLUME_BAR:
addBarControl(ctrl);
ctrlData.percentage = (_vc.volume * 100);
break;
case BUFFERING_BAR:
if (ctrl.parent == skin_mc){
finishAddBufferingBar();
} else {
ctrl.addEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
break;
};
setEnabledAndVisibleForState(index, _vc.state);
} else {
controls[index] = ctrl;
addButtonControl(ctrl);
};
}
flvplayback_internal function bitmapCopyBorder():void{
var _local2:BitmapData;
var _local3:Matrix;
var _local4:Number;
var _local5:Number;
var _local6:Rectangle;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:Bitmap;
var _local12:Number;
var _local13:Number;
if ((((border_mc == null)) || ((borderCopy == null)))){
return;
};
var _local1:Rectangle = border_mc.getBounds(skin_mc);
if ((((borderPrevRect == null)) || (!(borderPrevRect.equals(_local1))))){
borderCopy.x = _local1.x;
borderCopy.y = _local1.y;
_local3 = new Matrix(border_mc.scaleX, 0, 0, border_mc.scaleY, 0, 0);
if (borderScale9Rects == null){
_local2 = new BitmapData(_local1.width, _local1.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform);
Bitmap(borderCopy.getChildAt(0)).bitmapData = _local2;
} else {
_local4 = 0;
_local5 = 0;
_local6 = new Rectangle(0, 0, 0, 0);
_local7 = 0;
_local8 = 0;
if (borderScale9Rects[3] != null){
_local8 = (_local8 + borderScale9Rects[3].width);
};
if (borderScale9Rects[5] != null){
_local8 = (_local8 + borderScale9Rects[5].width);
};
_local9 = 0;
if (borderScale9Rects[1] != null){
_local9 = (_local9 + borderScale9Rects[1].height);
};
if (borderScale9Rects[7] != null){
_local9 = (_local9 + borderScale9Rects[7].height);
};
_local10 = 0;
while (_local10 < borderScale9Rects.length) {
if ((_local10 % 3) == 0){
_local4 = 0;
_local5 = (_local5 + _local6.height);
};
if (borderScale9Rects[_local10] == null){
} else {
_local6 = Rectangle(borderScale9Rects[_local10]).clone();
_local3.a = 1;
if ((((((_local10 == 1)) || ((_local10 == 4)))) || ((_local10 == 7)))){
_local12 = ((_local1.width - _local8) / _local6.width);
_local6.x = (_local6.x * _local12);
_local6.width = (_local6.width * _local12);
_local6.width = Math.round(_local6.width);
_local3.a = (_local3.a * _local12);
};
_local3.tx = -(_local6.x);
_local6.x = 0;
_local3.d = 1;
if ((((_local10 >= 3)) && ((_local10 <= 5)))){
_local13 = ((_local1.height - _local9) / _local6.height);
_local6.y = (_local6.y * _local13);
_local6.height = (_local6.height * _local13);
_local6.height = Math.round(_local6.height);
_local3.d = (_local3.d * _local13);
};
_local3.ty = -(_local6.y);
_local6.y = 0;
_local2 = new BitmapData(_local6.width, _local6.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform, null, _local6, false);
_local11 = Bitmap(borderCopy.getChildAt(_local7));
_local7++;
_local11.bitmapData = _local2;
_local11.x = _local4;
_local11.y = _local5;
_local4 = (_local4 + _local6.width);
};
_local10++;
};
};
borderPrevRect = _local1;
};
}
flvplayback_internal function createSkin(_arg1:DisplayObject, _arg2:String):DisplayObject{
var stateSkinDesc:*;
var theClass:Class;
var definitionHolder = _arg1;
var skinName = _arg2;
try {
stateSkinDesc = definitionHolder[skinName];
if ((stateSkinDesc is String)){
try {
theClass = Class(definitionHolder.loaderInfo.applicationDomain.getDefinition(stateSkinDesc));
} catch(err1:Error) {
theClass = Class(getDefinitionByName(stateSkinDesc));
};
return (DisplayObject(new (theClass)));
} else {
if ((stateSkinDesc is Class)){
return (new (stateSkinDesc));
} else {
if ((stateSkinDesc is DisplayObject)){
return (stateSkinDesc);
};
};
};
} catch(err2:Error) {
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
return (null);
}
flvplayback_internal function hookUpCustomComponents():void{
var i:int;
var dispObj:DisplayObject;
var name:String;
var index:int;
var ctrl:Sprite;
focusRect = isFocusRectActive();
var searchHash:Object = new Object();
var doTheSearch:Boolean;
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == null){
searchHash[customComponentClassNames[i]] = i;
doTheSearch = true;
};
i = (i + 1);
};
if (!doTheSearch){
return;
};
i = 0;
while (i < _vc.parent.numChildren) {
dispObj = _vc.parent.getChildAt(i);
name = getQualifiedClassName(dispObj);
if (searchHash[name] != undefined){
if (typeof(searchHash[name]) == "number"){
index = int(searchHash[name]);
try {
ctrl = Sprite(dispObj);
if ((((((index >= NUM_BUTTONS)) || ((ctrl["placeholder_mc"] is DisplayObject)))) && ((ctrl["uiMgr"] == null)))){
setControl(index, ctrl);
searchHash[name] = ctrl;
};
} catch(err:Error) {
};
};
};
i = (i + 1);
};
}
flvplayback_internal function addButtonControl(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
var _local2:ControlData = ctrlDataDict[_arg1];
_arg1.buttonMode = true;
_arg1.tabEnabled = true;
_arg1.tabChildren = true;
_arg1.focusRect = focusRect;
_arg1.accessibilityProperties = new AccessibilityProperties();
_arg1.accessibilityProperties.forceSimple = true;
_arg1.accessibilityProperties.silent = true;
if (accessibilityPropertyNames[_local2.index] != null){
_arg1.accessibilityProperties.name = accessibilityPropertyNames[_local2.index];
_arg1.accessibilityProperties.silent = false;
};
if ((((_local2.index == VOLUME_BAR_HIT)) || ((_local2.index == SEEK_BAR_HIT)))){
_arg1.buttonMode = false;
_arg1.tabEnabled = false;
_arg1.tabChildren = false;
_arg1.focusRect = false;
_arg1.accessibilityProperties.silent = true;
};
if ((((_local2.index == VOLUME_BAR_HANDLE)) || ((_local2.index == SEEK_BAR_HANDLE)))){
_arg1.graphics.moveTo(0, -18);
_arg1.graphics.lineStyle(0, 0, 0);
_arg1.graphics.lineTo(0, -18);
_arg1.buttonMode = false;
_arg1.focusRect = true;
_arg1.accessibilityProperties.silent = false;
configureBarAccessibility(_local2.index);
};
_arg1.mouseChildren = false;
var _local3:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local2.state = NORMAL_STATE;
setEnabledAndVisibleForState(_local2.index, _vc.state);
_arg1.addEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.addEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.addEventListener(MouseEvent.CLICK, handleButtonEvent);
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyEvent);
_arg1.addEventListener(KeyboardEvent.KEY_UP, handleKeyEvent);
_arg1.addEventListener(FocusEvent.FOCUS_IN, handleFocusEvent);
_arg1.addEventListener(FocusEvent.FOCUS_OUT, handleFocusEvent);
if (_arg1.parent == skin_mc){
skinButtonControl(_arg1);
} else {
_arg1.addEventListener(Event.ENTER_FRAME, skinButtonControl);
};
_vc.activeVideoPlayerIndex = _local3;
}
flvplayback_internal function exitFullScreenTakeOver():void{
var fullScreenBG:Sprite;
var cacheActiveIndex:int;
var i:int;
var vp:VideoPlayer;
if (cacheFLVPlaybackParent == null){
return;
};
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
try {
if (_fullScreenAccel){
_vc.stage.fullScreenSourceRect = new Rectangle(0, 0, -1, -1);
} else {
_vc.stage.align = cacheStageAlign;
_vc.stage.scaleMode = cacheStageScaleMode;
};
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG != null){
_vc.removeChild(fullScreenBG);
};
if (hitTarget_mc != null){
hitTarget_mc.graphics.clear();
hitTarget_mc.graphics.lineStyle(0, 0, 0);
hitTarget_mc.graphics.drawRect(0, 0, _vc.width, _vc.height);
};
if (_vc.parent != cacheFLVPlaybackParent){
cacheFLVPlaybackParent.addChildAt(_vc, cacheFLVPlaybackIndex);
} else {
cacheFLVPlaybackParent.setChildIndex(_vc, cacheFLVPlaybackIndex);
};
cacheActiveIndex = _vc.activeVideoPlayerIndex;
i = 0;
while (i < _vc.videoPlayers.length) {
vp = (_vc.videoPlayers[i] as VideoPlayer);
if (vp != null){
_vc.activeVideoPlayerIndex = i;
if (cacheFLVPlaybackScaleMode[i] != undefined){
_vc.scaleMode = cacheFLVPlaybackScaleMode[i];
};
if (cacheFLVPlaybackAlign[i]){
_vc.align = cacheFLVPlaybackAlign[i];
};
};
i = (i + 1);
};
_vc.activeVideoPlayerIndex = cacheActiveIndex;
_vc.registrationX = cacheFLVPlaybackLocation.x;
_vc.registrationY = cacheFLVPlaybackLocation.y;
_vc.setSize(cacheFLVPlaybackLocation.width, cacheFLVPlaybackLocation.height);
} catch(err:Error) {
};
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
_fullScreen = false;
_fullScreenAccel = false;
cacheStageAlign = null;
cacheStageScaleMode = null;
cacheFLVPlaybackParent = null;
cacheFLVPlaybackIndex = 0;
cacheFLVPlaybackLocation = null;
cacheFLVPlaybackScaleMode = null;
cacheFLVPlaybackAlign = null;
if (_skinAutoHide != cacheSkinAutoHide){
_skinAutoHide = cacheSkinAutoHide;
setupSkinAutoHide(false);
};
}
flvplayback_internal function positionMaskedFill(_arg1:DisplayObject, _arg2:Number):void{
var ctrlData:ControlData;
var slideReveal:Boolean;
var maskSprite:Sprite;
var barData:ControlData;
var ctrl = _arg1;
var percent = _arg2;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
var fill:DisplayObject = ctrlData.fill_mc;
if (fill == null){
return;
};
var mask:DisplayObject = ctrlData.mask_mc;
if (ctrlData.mask_mc == null){
try {
var _local4 = ctrl["mask_mc"];
mask = _local4;
ctrlData.mask_mc = _local4;
} catch(re:ReferenceError) {
ctrlData.mask_mc = null;
};
if (ctrlData.mask_mc == null){
maskSprite = new Sprite();
_local4 = maskSprite;
mask = _local4;
ctrlData.mask_mc = _local4;
maskSprite.graphics.beginFill(0xFFFFFF);
maskSprite.graphics.drawRect(0, 0, 1, 1);
maskSprite.graphics.endFill();
barData = ctrlDataDict[fill];
maskSprite.x = barData.origX;
maskSprite.y = barData.origY;
maskSprite.width = barData.origWidth;
maskSprite.height = barData.origHeight;
maskSprite.visible = false;
fill.parent.addChild(maskSprite);
fill.mask = maskSprite;
};
if (ctrlData.mask_mc != null){
calcBarMargins(ctrl, "mask", true);
};
};
var fillData:ControlData = ctrlDataDict[fill];
var maskData:ControlData = ctrlDataDict[mask];
try {
slideReveal = fill["slideReveal"];
} catch(re:ReferenceError) {
slideReveal = false;
};
if (fill.parent == ctrl){
if (slideReveal){
fill.x = ((maskData.origX - fillData.origWidth) + ((fillData.origWidth * percent) / 100));
} else {
mask.width = ((fillData.origWidth * percent) / 100);
};
} else {
if (fill.parent == ctrl.parent){
if (slideReveal){
mask.x = (ctrl.x + maskData.leftMargin);
mask.y = (ctrl.y + maskData.topMargin);
mask.width = ((ctrl.width - maskData.rightMargin) - maskData.leftMargin);
mask.height = ((ctrl.height - maskData.topMargin) - maskData.bottomMargin);
fill.x = ((mask.x - fillData.origWidth) + ((maskData.origWidth * percent) / 100));
fill.y = (ctrl.y + fillData.topMargin);
} else {
fill.x = (ctrl.x + fillData.leftMargin);
fill.y = (ctrl.y + fillData.topMargin);
mask.x = fill.x;
mask.y = fill.y;
mask.width = ((((ctrl.width - fillData.rightMargin) - fillData.leftMargin) * percent) / 100);
mask.height = ((ctrl.height - fillData.topMargin) - fillData.bottomMargin);
};
};
};
}
flvplayback_internal function calcPercentageFromHandle(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
var _local2:ControlData = ctrlDataDict[_arg1];
if ((((_arg1["calcPercentageFromHandle"] is Function)) && (_arg1["calcPercentageFromHandle"]()))){
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
return;
};
var _local3:Sprite = _local2.handle_mc;
if (_local3 == null){
return;
};
var _local4:ControlData = ctrlDataDict[_local3];
var _local5:Number = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
var _local6:Number = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
var _local7:Number = (_local3.x - (_arg1.x + _local4.leftMargin));
_local2.percentage = ((_local7 / _local6) * 100);
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function setTwoButtonHolderSkin(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:String, _arg6:DisplayObject):Sprite{
var _local7:Sprite;
var _local8:Sprite;
var _local9:ControlData;
_local8 = new Sprite();
_local9 = new ControlData(this, _local8, null, _arg1);
ctrlDataDict[_local8] = _local9;
skin_mc.addChild(_local8);
_local7 = setupButtonSkin(_arg2, _arg6);
_local7.name = _arg3;
_local7.visible = true;
_local8.addChild(_local7);
_local7 = setupButtonSkin(_arg4, _arg6);
_local7.name = _arg5;
_local7.visible = false;
_local8.addChild(_local7);
return (_local8);
}
flvplayback_internal function handleRelease(_arg1:int):void{
var _local2:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_arg1 == SEEK_BAR){
seekBarListener(null);
} else {
if (_arg1 == VOLUME_BAR){
volumeBarListener(null);
};
};
stopHandleDrag(controls[_arg1]);
_vc.activeVideoPlayerIndex = _local2;
if (_arg1 == SEEK_BAR){
_vc._scrubFinish();
};
}
public function set seekBarInterval(_arg1:Number):void{
if (_seekBarTimer.delay == _arg1){
return;
};
_seekBarTimer.delay = _arg1;
}
flvplayback_internal function skinAutoHideHitTest(_arg1:TimerEvent, _arg2:Boolean=true):void{
var visibleVP:VideoPlayer;
var hit:Boolean;
var e = _arg1;
var doFade = _arg2;
try {
if (!__visible){
skin_mc.visible = false;
if (hitTarget_mc){
hitTarget_mc.accessibilityProperties.name = accessibilityPropertyNames[SHOW_CONTROLS_BUTTON];
};
} else {
if (_vc.stage != null){
visibleVP = _vc.getVideoPlayer(_vc.visibleVideoPlayerIndex);
hit = visibleVP.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((e == null))))){
if ((((_vc.stage.mouseX == _skinAutoHideMouseX)) && ((_vc.stage.mouseY == _skinAutoHideMouseY)))){
if ((getTimer() - _skinAutoHideLastMotionTime) > _skinAutoHideMotionTimeout){
hit = false;
};
} else {
_skinAutoHideLastMotionTime = getTimer();
_skinAutoHideMouseX = _vc.stage.mouseX;
_skinAutoHideMouseY = _vc.stage.mouseY;
};
};
if (((!(hit)) && (!((border_mc == null))))){
hit = border_mc.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((hit) && (_fullScreen))) && (_fullScreenTakeOver))){
_skinAutoHideLastMotionTime = getTimer();
};
};
if (((!(doFade)) || ((_skinFadingMaxTime <= 0)))){
_skinFadingTimer.stop();
skin_mc.visible = hit;
skin_mc.alpha = 1;
} else {
if (((((((hit) && (skin_mc.visible))) && (((!(_skinFadingTimer.running)) || (_skinFadingIn))))) || (((!(hit)) && (((!(skin_mc.visible)) || (((_skinFadingTimer.running) && (!(_skinFadingIn)))))))))){
} else {
_skinFadingTimer.stop();
_skinFadingIn = hit;
if (((_skinFadingIn) && ((skin_mc.alpha == 1)))){
skin_mc.alpha = 0;
};
_skinFadeStartTime = getTimer();
_skinFadingTimer.start();
skin_mc.visible = true;
};
};
if (hitTarget_mc){
hitTarget_mc.accessibilityProperties.name = (hit) ? accessibilityPropertyNames[HIDE_CONTROLS_BUTTON] : accessibilityPropertyNames[SHOW_CONTROLS_BUTTON];
};
};
};
} catch(se:SecurityError) {
_skinAutoHideTimer.stop();
_skinFadingTimer.stop();
skin_mc.visible = __visible;
skin_mc.alpha = 1;
if (hitTarget_mc){
hitTarget_mc.accessibilityProperties.name = accessibilityPropertyNames[HIDE_CONTROLS_BUTTON];
};
};
if (((hitTarget_mc) && (Capabilities.hasAccessibility))){
Accessibility.updateProperties();
};
}
flvplayback_internal function layoutControl(_arg1:DisplayObject):void{
var _local4:Sprite;
var _local5:Rectangle;
if (_arg1 == null){
return;
};
var _local2:ControlData = ctrlDataDict[_arg1];
if (_local2 == null){
return;
};
if (_local2.avatar == null){
return;
};
var _local3:Rectangle = calcLayoutControl(_arg1);
_arg1.x = _local3.x;
_arg1.y = _local3.y;
_arg1.width = _local3.width;
_arg1.height = _local3.height;
switch (_local2.index){
case SEEK_BAR:
case VOLUME_BAR:
if (((!((_local2.hit_mc == null))) && ((_local2.hit_mc.parent == skin_mc)))){
_local4 = _local2.hit_mc;
_local5 = calcLayoutControl(_local4);
_local4.x = _local5.x;
_local4.y = _local5.y;
_local4.width = _local5.width;
_local4.height = _local5.height;
};
if (_local2.progress_mc != null){
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(Sprite(_arg1), "progress", _progressPercent);
};
positionHandle(Sprite(_arg1));
break;
case BUFFERING_BAR:
positionMaskedFill(_arg1, 100);
break;
};
}
public function set fullScreenSkinDelay(_arg1:int):void{
_skinAutoHideMotionTimeout = _arg1;
}
flvplayback_internal function captureMouseEvent(_arg1:MouseEvent):void{
_arg1.stopPropagation();
}
flvplayback_internal function positionHandle(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
if ((((_arg1["positionHandle"] is Function)) && (_arg1["positionHandle"]()))){
return;
};
var _local2:ControlData = ctrlDataDict[_arg1];
var _local3:Sprite = _local2.handle_mc;
if (_local3 == null){
return;
};
var _local4:ControlData = ctrlDataDict[_local3];
var _local5:Number = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
var _local6:Number = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
_local3.x = ((_arg1.x + _local4.leftMargin) + ((_local6 * _local2.percentage) / 100));
_local3.y = (_arg1.y + _local4.origY);
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function handleMouseUp(_arg1:MouseEvent):void{
var _local3:ControlData;
var _local2:Sprite = controls[mouseCaptureCtrl];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.state = (_local2.hitTestPoint(_arg1.stageX, _arg1.stageY, true)) ? OVER_STATE : NORMAL_STATE;
skinButtonControl(_local2);
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
handleRelease(SEEK_BAR);
break;
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
handleRelease(VOLUME_BAR);
break;
case FULL_SCREEN_OFF_BUTTON:
case FULL_SCREEN_ON_BUTTON:
dispatchMessage(_local3.index);
break;
};
};
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
}
public function set visible(_arg1:Boolean):void{
if (__visible == _arg1){
return;
};
__visible = _arg1;
if (!__visible){
skin_mc.visible = false;
} else {
setupSkinAutoHide(false);
};
}
public function get bufferingDelayInterval():Number{
return (_bufferingDelayTimer.delay);
}
flvplayback_internal function handleFocusEvent(_arg1:FocusEvent):void{
var _local2:ControlData = ctrlDataDict[_arg1.currentTarget];
if (_local2 == null){
return;
};
switch (_arg1.type){
case FocusEvent.FOCUS_IN:
switch (_arg1.target){
case controls[SEEK_BAR_HANDLE]:
case controls[VOLUME_BAR_HANDLE]:
_arg1.target.focusRect = false;
break;
};
_local2.state = OVER_STATE;
break;
case FocusEvent.FOCUS_OUT:
switch (_arg1.target){
case controls[SEEK_BAR_HANDLE]:
case controls[VOLUME_BAR_HANDLE]:
_arg1.target.focusRect = true;
break;
case controls[STOP_BUTTON]:
if (!_local2.enabled){
_arg1.target.tabEnabled = false;
};
break;
};
_local2.state = NORMAL_STATE;
break;
};
skinButtonControl(_arg1.currentTarget);
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
if (_fullScreenBgColor != _arg1){
_fullScreenBgColor = _arg1;
if (_vc){
};
};
}
public function get fullScreenTakeOver():Boolean{
return (_fullScreenTakeOver);
}
public function set skin(_arg1:String):void{
var _local2:String;
if (_arg1 == null){
removeSkin();
_skin = null;
_skinReady = true;
} else {
_local2 = String(_arg1);
if (_arg1 == _skin){
return;
};
removeSkin();
_skin = String(_arg1);
_skinReady = (_skin == "");
if (!_skinReady){
downloadSkin();
};
};
}
public function set volumeBarInterval(_arg1:Number):void{
if (_volumeBarTimer.delay == _arg1){
return;
};
_volumeBarTimer.delay = _arg1;
}
flvplayback_internal function setSkin(_arg1:int, _arg2:DisplayObject):void{
var _local3:Sprite;
var _local4:ControlData;
var _local5:String;
if (_arg1 >= NUM_CONTROLS){
return;
};
if (_arg1 < NUM_BUTTONS){
_local3 = setupButtonSkin(_arg1, _arg2);
skin_mc.addChild(_local3);
_local4 = ctrlDataDict[_local3];
} else {
switch (_arg1){
case PLAY_PAUSE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, PLAY_BUTTON, "play_mc", PAUSE_BUTTON, "pause_mc", _arg2);
_local4 = ctrlDataDict[_local3];
break;
case FULL_SCREEN_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, FULL_SCREEN_ON_BUTTON, "on_mc", FULL_SCREEN_OFF_BUTTON, "off_mc", _arg2);
_local4 = ctrlDataDict[_local3];
break;
case MUTE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, MUTE_ON_BUTTON, "on_mc", MUTE_OFF_BUTTON, "off_mc", _arg2);
_local4 = ctrlDataDict[_local3];
break;
case SEEK_BAR:
case VOLUME_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.progress_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Progress"), "progress_mc");
_local4.fullness_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fullness"), "fullness_mc");
_local4.hit_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Hit"), "hit_mc"));
_local4.handle_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Handle"), "handle_mc", true));
_local3.width = _arg2.width;
_local3.height = _arg2.height;
_local3.accessibilityProperties = new AccessibilityProperties();
_local3.accessibilityProperties.silent = true;
};
break;
case BUFFERING_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.fill_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fill"), "fill_mc");
_local3.width = _arg2.width;
_local3.height = _arg2.height;
_local4.fill_mc.accessibilityProperties = new AccessibilityProperties();
_local4.fill_mc.accessibilityProperties.silent = true;
_local3.accessibilityProperties = new AccessibilityProperties();
_local3.accessibilityProperties.silent = true;
};
break;
};
};
_local4.avatar = _arg2;
ctrlDataDict[_local3] = _local4;
delayedControls[_arg1] = _local3;
}
flvplayback_internal function configureBarAccessibility(_arg1:int):void{
switch (_arg1){
case SEEK_BAR_HANDLE:
SeekBarAccImpl.createAccessibilityImplementation(controls[SEEK_BAR_HANDLE]);
break;
case VOLUME_BAR_HANDLE:
VolumeBarAccImpl.createAccessibilityImplementation(controls[VOLUME_BAR_HANDLE]);
break;
};
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
_bufferingBarHides = _arg1;
}
flvplayback_internal function handleSoundEvent(_arg1:SoundEvent):void{
var _local3:ControlData;
if (((_isMuted) && ((_arg1.soundTransform.volume > 0)))){
_isMuted = false;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
var _local2:Sprite = controls[VOLUME_BAR];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.percentage = ((_isMuted) ? cachedSoundLevel : _arg1.soundTransform.volume * 100);
if (_local3.percentage < 0){
_local3.percentage = 0;
} else {
if (_local3.percentage > 100){
_local3.percentage = 100;
};
};
positionHandle(_local2);
};
}
flvplayback_internal function stopHandleDrag(_arg1:Sprite):void{
var ctrl = _arg1;
if (ctrl == null){
return;
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["stopHandleDrag"] is Function)) && (ctrl["stopHandleDrag"]()))){
ctrlData.isDragging = false;
return;
};
} catch(re:ReferenceError) {
};
var handle:Sprite = ctrlData.handle_mc;
if (handle == null){
return;
};
handle.stopDrag();
ctrlData.isDragging = false;
handle.stage.focus = handle;
}
public function set skinBackgroundAlpha(_arg1:Number):void{
if (borderAlpha != _arg1){
borderAlpha = _arg1;
borderColorTransform.alphaOffset = (0xFF * _arg1);
borderPrevRect = null;
layoutSkin();
};
}
public function getControl(_arg1:int):Sprite{
return (controls[_arg1]);
}
public function set skinScaleMaximum(_arg1:Number):void{
_skinScaleMaximum = _arg1;
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
_volumeBarScrubTolerance = _arg1;
}
flvplayback_internal function calcBarMargins(_arg1:DisplayObject, _arg2:String, _arg3:Boolean):void{
var ctrl = _arg1;
var type = _arg2;
var symmetricMargins = _arg3;
if (ctrl == null){
return;
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
var bar:DisplayObject = ctrlData[(type + "_mc")];
if (bar == null){
try {
bar = ctrl[(type + "_mc")];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
return;
};
ctrlData[(type + "_mc")] = bar;
};
var barData:ControlData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
barData.leftMargin = getNumberPropSafe(ctrl, (type + "LeftMargin"));
if (((isNaN(barData.leftMargin)) && ((bar.parent == ctrl.parent)))){
barData.leftMargin = (bar.x - ctrl.x);
};
barData.rightMargin = getNumberPropSafe(ctrl, (type + "RightMargin"));
if (isNaN(barData.rightMargin)){
if (symmetricMargins){
barData.rightMargin = barData.leftMargin;
} else {
if (bar.parent == ctrl.parent){
barData.rightMargin = (((ctrl.width - bar.width) - bar.x) + ctrl.x);
};
};
};
barData.topMargin = getNumberPropSafe(ctrl, (type + "TopMargin"));
if (((isNaN(barData.topMargin)) && ((bar.parent == ctrl.parent)))){
barData.topMargin = (bar.y - ctrl.y);
};
barData.bottomMargin = getNumberPropSafe(ctrl, (type + "BottomMargin"));
if (isNaN(barData.bottomMargin)){
if (symmetricMargins){
barData.bottomMargin = barData.topMargin;
} else {
if (bar.parent == ctrl.parent){
barData.bottomMargin = (((ctrl.height - bar.height) - bar.y) + ctrl.y);
};
};
};
barData.origX = getNumberPropSafe(ctrl, (type + "X"));
if (isNaN(barData.origX)){
if (bar.parent == ctrl.parent){
barData.origX = (bar.x - ctrl.x);
} else {
if (bar.parent == ctrl){
barData.origX = bar.x;
};
};
};
barData.origY = getNumberPropSafe(ctrl, (type + "Y"));
if (isNaN(barData.origY)){
if (bar.parent == ctrl.parent){
barData.origY = (bar.y - ctrl.y);
} else {
if (bar.parent == ctrl){
barData.origY = bar.y;
};
};
};
barData.origWidth = bar.width;
barData.origHeight = bar.height;
barData.origScaleX = bar.scaleX;
barData.origScaleY = bar.scaleY;
}
public function set skinBackgroundColor(_arg1:uint):void{
if (borderColor != _arg1){
borderColor = _arg1;
borderColorTransform.redOffset = ((borderColor >> 16) & 0xFF);
borderColorTransform.greenOffset = ((borderColor >> 8) & 0xFF);
borderColorTransform.blueOffset = (borderColor & 0xFF);
borderPrevRect = null;
layoutSkin();
};
}
flvplayback_internal function handleLoad(_arg1:Event):void{
var i:int;
var dispObj:DisplayObject;
var index:Number;
var e = _arg1;
try {
skin_mc = new Sprite();
if (e != null){
skinTemplate = Sprite(skinLoader.content);
};
layout_mc = skinTemplate;
customClips = new Array();
delayedControls = new Array();
i = 0;
while (i < layout_mc.numChildren) {
dispObj = layout_mc.getChildAt(i);
index = layoutNameToIndexMappings[dispObj.name];
if (!isNaN(index)){
setSkin(int(index), dispObj);
} else {
if (dispObj.name != "video_mc"){
setCustomClip(dispObj);
};
};
i = (i + 1);
};
skinLoadDelayCount = 0;
_vc.addEventListener(Event.ENTER_FRAME, finishLoad);
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function finishAddBufferingBar(_arg1:Event=null):void{
if (_arg1 != null){
_arg1.currentTarget.removeEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
var _local2:Sprite = controls[BUFFERING_BAR];
calcBarMargins(_local2, "fill", true);
fixUpBar(_local2, "fill", _local2, "fill_mc");
positionMaskedFill(_local2, 100);
}
flvplayback_internal function handleButtonEvent(_arg1:MouseEvent):void{
var topLevel:DisplayObject;
var e = _arg1;
var ctrlData:ControlData = ctrlDataDict[e.currentTarget];
switch (e.type){
case MouseEvent.ROLL_OVER:
ctrlData.state = OVER_STATE;
break;
case MouseEvent.ROLL_OUT:
ctrlData.state = NORMAL_STATE;
break;
case MouseEvent.MOUSE_DOWN:
ctrlData.state = DOWN_STATE;
mouseCaptureCtrl = ctrlData.index;
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
dispatchMessage(ctrlData.index);
break;
};
topLevel = _vc.stage;
try {
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
} catch(se:SecurityError) {
topLevel = _vc.root;
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
};
topLevel.addEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
topLevel.addEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
break;
case MouseEvent.CLICK:
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
case FULL_SCREEN_OFF_BUTTON:
case FULL_SCREEN_ON_BUTTON:
break;
default:
dispatchMessage(ctrlData.index);
break;
};
return;
};
skinButtonControl(e.currentTarget);
}
flvplayback_internal function applySkinState(_arg1:ControlData, _arg2:DisplayObject):void{
if (_arg2 != _arg1.currentState_mc){
if (_arg1.currentState_mc != null){
_arg1.currentState_mc.visible = false;
};
_arg1.currentState_mc = _arg2;
_arg1.currentState_mc.visible = true;
};
}
flvplayback_internal function handleLoadErrorEvent(_arg1:ErrorEvent):void{
_skinReady = true;
_vc.skinError(_arg1.toString());
}
flvplayback_internal function addBarControl(_arg1:Sprite):void{
var _local2:ControlData = ctrlDataDict[_arg1];
_local2.isDragging = false;
_local2.percentage = 0;
if ((((_arg1.parent == skin_mc)) && (!((skin_mc == null))))){
finishAddBarControl(_arg1);
} else {
_arg1.addEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle);
_arg1.addEventListener(Event.ENTER_FRAME, finishAddBarControl);
};
}
flvplayback_internal function handleEvent(_arg1:Event):void{
var e = _arg1;
switch (e.type){
case Event.ADDED_TO_STAGE:
_fullScreen = false;
if (_vc.stage != null){
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
if (!_fullScreen){
_fullScreenAccel = false;
};
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
layoutSkin();
setupSkinAutoHide(false);
break;
case Event.REMOVED_FROM_STAGE:
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
break;
};
}
flvplayback_internal function skinButtonControl(_arg1:Object):void{
var ctrl:Sprite;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return;
};
try {
if (ctrl["placeholder_mc"] != undefined){
ctrl.removeChild(ctrl["placeholder_mc"]);
ctrl["placeholder_mc"] = null;
};
} catch(re:ReferenceError) {
};
if (ctrlData.state_mc == null){
ctrlData.state_mc = new Array();
};
if (ctrlData.state_mc[NORMAL_STATE] == undefined){
ctrlData.state_mc[NORMAL_STATE] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[NORMAL_STATE], null);
};
if (((ctrlData.enabled) && (_controlsEnabled))){
if (ctrlData.state_mc[ctrlData.state] == undefined){
ctrlData.state_mc[ctrlData.state] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[ctrlData.state], ctrlData.state_mc[NORMAL_STATE]);
};
if (ctrlData.state_mc[ctrlData.state] != ctrlData.currentState_mc){
if (ctrlData.currentState_mc != null){
ctrlData.currentState_mc.visible = false;
};
ctrlData.currentState_mc = ctrlData.state_mc[ctrlData.state];
ctrlData.currentState_mc.visible = true;
};
applySkinState(ctrlData, ctrlData.state_mc[ctrlData.state]);
} else {
ctrlData.state = NORMAL_STATE;
if (ctrlData.disabled_mc == null){
ctrlData.disabled_mc = setupButtonSkinState(ctrl, ctrl, "disabledLinkageID", ctrlData.state_mc[NORMAL_STATE]);
};
applySkinState(ctrlData, ctrlData.disabled_mc);
};
}
public function set controlsEnabled(_arg1:Boolean):void{
if (_controlsEnabled == _arg1){
return;
};
_controlsEnabled = _arg1;
var _local2:int;
while (_local2 < NUM_BUTTONS) {
skinButtonControl(controls[_local2]);
_local2++;
};
}
flvplayback_internal function setupSkinAutoHide(_arg1:Boolean):void{
var uiMgr:UIManager;
var clickHandler:Function;
var doFade = _arg1;
if (((_skinAutoHide) && (!((skin_mc == null))))){
if (!hitTarget_mc){
hitTarget_mc = new Sprite();
hitTarget_mc.accessibilityProperties = new AccessibilityProperties();
hitTarget_mc.accessibilityProperties.name = accessibilityPropertyNames[SHOW_CONTROLS_BUTTON];
customClips.push(hitTarget_mc);
uiMgr = this;
clickHandler = function (_arg1):void{
if (_arg1.type == FocusEvent.FOCUS_IN){
uiMgr._skinAutoHide = false;
} else {
if (_arg1.type == MouseEvent.CLICK){
uiMgr._skinAutoHide = !(uiMgr._skinAutoHide);
};
};
uiMgr.setupSkinAutoHide(true);
if (uiMgr._skinAutoHide){
_arg1.target.accessibilityProperties.name = accessibilityPropertyNames[SHOW_CONTROLS_BUTTON];
} else {
_arg1.target.accessibilityProperties.name = accessibilityPropertyNames[HIDE_CONTROLS_BUTTON];
};
if (Accessibility.active){
Accessibility.updateProperties();
};
};
hitTarget_mc.useHandCursor = false;
hitTarget_mc.buttonMode = true;
hitTarget_mc.tabEnabled = true;
hitTarget_mc.tabChildren = true;
hitTarget_mc.focusRect = true;
hitTarget_mc.addEventListener(FocusEvent.FOCUS_IN, clickHandler);
hitTarget_mc.addEventListener(MouseEvent.CLICK, clickHandler);
hitTarget_mc.accessibilityProperties.silent = _fullScreen;
hitTarget_mc.tabEnabled = !(_fullScreen);
if (Accessibility.active){
Accessibility.updateProperties();
};
_vc.addChild(hitTarget_mc);
};
hitTarget_mc.graphics.clear();
hitTarget_mc.graphics.lineStyle(0, 0xFF0000, 0);
hitTarget_mc.graphics.drawRect(0, 0, _vc.width, _vc.height);
skinAutoHideHitTest(null, doFade);
_skinAutoHideTimer.start();
} else {
if (skin_mc != null){
if (((((((doFade) && ((_skinFadingMaxTime > 0)))) && (((!(skin_mc.visible)) || ((skin_mc.alpha < 1)))))) && (__visible))){
_skinFadingTimer.stop();
_skinFadeStartTime = getTimer();
_skinFadingIn = true;
if (skin_mc.alpha == 1){
skin_mc.alpha = 0;
};
_skinFadingTimer.start();
} else {
if (_skinFadingMaxTime <= 0){
_skinFadingTimer.stop();
skin_mc.alpha = 1;
};
};
skin_mc.visible = __visible;
};
_skinAutoHideTimer.stop();
};
}
public function get skin():String{
return (_skin);
}
flvplayback_internal function finishAddBarControl(_arg1:Object):void{
var ctrl:Sprite;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
try {
if ((ctrl["addBarControl"] is Function)){
var _local3 = ctrl;
_local3["addBarControl"]();
};
} catch(re:ReferenceError) {
};
ctrlData.origWidth = ctrl.width;
ctrlData.origHeight = ctrl.height;
fixUpBar(ctrl, "progress", ctrl, "progress_mc");
calcBarMargins(ctrl, "progress", false);
if (ctrlData.progress_mc != null){
fixUpBar(ctrl, "progressBarFill", ctrlData.progress_mc, "fill_mc");
calcBarMargins(ctrlData.progress_mc, "fill", false);
calcBarMargins(ctrlData.progress_mc, "mask", false);
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(ctrl, "progress", _progressPercent);
};
fixUpBar(ctrl, "fullness", ctrl, "fullness_mc");
calcBarMargins(ctrl, "fullness", false);
if (ctrlData.fullness_mc != null){
fixUpBar(ctrl, "fullnessBarFill", ctrlData.fullness_mc, "fill_mc");
calcBarMargins(ctrlData.fullness_mc, "fill", false);
calcBarMargins(ctrlData.fullness_mc, "mask", false);
};
fixUpBar(ctrl, "hit", ctrl, "hit_mc");
fixUpBar(ctrl, "handle", ctrl, "handle_mc");
calcBarMargins(ctrl, "handle", true);
switch (ctrlData.index){
case SEEK_BAR:
setControl(SEEK_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(SEEK_BAR_HIT, ctrlData.hit_mc);
};
break;
case VOLUME_BAR:
setControl(VOLUME_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(VOLUME_BAR_HIT, ctrlData.hit_mc);
};
break;
};
positionHandle(ctrl);
ctrl.accessibilityProperties = new AccessibilityProperties();
ctrl.accessibilityProperties.silent = true;
}
public function get fullScreenBackgroundColor():uint{
return (_fullScreenBgColor);
}
public function enterFullScreenDisplayState():void{
var theRect:Rectangle;
var vp:VideoPlayer;
var effectiveWidth:int;
var effectiveHeight:int;
var videoAspectRatio:Number;
var screenAspectRatio:Number;
var effectiveMinWidth:int;
var effectiveMinHeight:int;
var skinScaleMinWidth:int;
var skinScaleMinHeight:int;
if (((!(_fullScreen)) && (!((_vc.stage == null))))){
if (_fullScreenTakeOver){
try {
theRect = _vc.stage.fullScreenSourceRect;
_fullScreenAccel = true;
vp = _vc.getVideoPlayer(_vc.visibleVideoPlayerIndex);
effectiveWidth = vp.videoWidth;
effectiveHeight = vp.videoHeight;
videoAspectRatio = (effectiveWidth / effectiveHeight);
screenAspectRatio = (_vc.stage.fullScreenWidth / _vc.stage.fullScreenHeight);
if (videoAspectRatio > screenAspectRatio){
effectiveHeight = (effectiveWidth / screenAspectRatio);
} else {
if (videoAspectRatio < screenAspectRatio){
effectiveWidth = (effectiveHeight * screenAspectRatio);
};
};
effectiveMinWidth = fullScreenSourceRectMinWidth;
effectiveMinHeight = fullScreenSourceRectMinHeight;
if (fullScreenSourceRectMinAspectRatio > screenAspectRatio){
effectiveMinHeight = (effectiveMinWidth / screenAspectRatio);
} else {
if (fullScreenSourceRectMinAspectRatio < screenAspectRatio){
effectiveMinWidth = (effectiveMinHeight * screenAspectRatio);
};
};
skinScaleMinWidth = (_vc.stage.fullScreenWidth / _skinScaleMaximum);
skinScaleMinHeight = (_vc.stage.fullScreenHeight / _skinScaleMaximum);
if ((((effectiveMinWidth < skinScaleMinWidth)) || ((effectiveMinHeight < skinScaleMinHeight)))){
effectiveMinWidth = skinScaleMinWidth;
effectiveMinHeight = skinScaleMinHeight;
};
if ((((effectiveWidth < effectiveMinWidth)) || ((effectiveHeight < effectiveMinHeight)))){
effectiveWidth = effectiveMinWidth;
effectiveHeight = effectiveMinHeight;
};
_vc.stage.fullScreenSourceRect = new Rectangle(0, 0, effectiveWidth, effectiveHeight);
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
} catch(re:ReferenceError) {
_fullScreenAccel = false;
} catch(re:SecurityError) {
_fullScreenAccel = false;
};
};
try {
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
} catch(se:SecurityError) {
};
};
}
flvplayback_internal function setupBarSkinPart(_arg1:Sprite, _arg2:DisplayObject, _arg3:Sprite, _arg4:String, _arg5:String, _arg6:Boolean=false):DisplayObject{
var part:DisplayObject;
var partAvatar:DisplayObject;
var ctrlData:ControlData;
var partData:ControlData;
var ctrl = _arg1;
var avatar = _arg2;
var definitionHolder = _arg3;
var skinName = _arg4;
var partName = _arg5;
var required = _arg6;
try {
part = ctrl[partName];
} catch(re:ReferenceError) {
part = null;
};
if (part == null){
try {
part = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (required){
throw (ve);
};
};
if (part != null){
skin_mc.addChild(part);
part.x = ctrl.x;
part.y = ctrl.y;
partAvatar = layout_mc.getChildByName((skinName + "_mc"));
if (partAvatar != null){
if (partName == "hit_mc"){
ctrlData = ctrlDataDict[ctrl];
partData = new ControlData(this, part, controls[ctrlData.index], -1);
partData.avatar = partAvatar;
ctrlDataDict[part] = partData;
} else {
part.x = (part.x + (partAvatar.x - avatar.x));
part.y = (part.y + (partAvatar.y - avatar.y));
part.width = partAvatar.width;
part.height = partAvatar.height;
};
if ((((part is InteractiveObject)) && ((partAvatar is InteractiveObject)))){
InteractiveObject(part).tabIndex = InteractiveObject(partAvatar).tabIndex;
};
};
};
};
if (((required) && ((part == null)))){
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
if (part != null){
part.accessibilityProperties = new AccessibilityProperties();
part.accessibilityProperties.silent = true;
};
return (part);
}
flvplayback_internal function startHandleDrag(_arg1:Sprite):void{
var ctrl = _arg1;
if (ctrl == null){
return;
};
var ctrlData:ControlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["startHandleDrag"] is Function)) && (ctrl["startHandleDrag"]()))){
ctrlData.isDragging = true;
return;
};
} catch(re:ReferenceError) {
};
var handle:Sprite = ctrlData.handle_mc;
if (handle == null){
return;
};
var handleData:ControlData = ctrlDataDict[handle];
var theY:Number = (ctrl.y + handleData.origY);
var theWidth:Number = (isNaN(ctrlData.origWidth)) ? ctrl.width : ctrlData.origWidth;
var bounds:Rectangle = new Rectangle((ctrl.x + handleData.leftMargin), theY, (theWidth - handleData.rightMargin), 0);
handle.startDrag(false, bounds);
ctrlData.isDragging = true;
handle.focusRect = false;
handle.stage.focus = handle;
}
public function get skinBackgroundAlpha():Number{
return (borderAlpha);
}
public function get volumeBarScrubTolerance():Number{
return (_volumeBarScrubTolerance);
}
public function get skinScaleMaximum():Number{
return (_skinScaleMaximum);
}
public function get skinBackgroundColor():uint{
return (borderColor);
}
public function get controlsEnabled():Boolean{
return (_controlsEnabled);
}
flvplayback_internal function handleKeyEvent(_arg1:KeyboardEvent):void{
var ctrlData:ControlData;
var focusControl:InteractiveObject;
var percent:Number;
var nearestCuePoint:Object;
var nextCuePoint:Object;
var wasMuted:Boolean;
var num:Number;
var ctrl:Sprite;
var setFocusedControl:Function;
var event = _arg1;
ctrlData = ctrlDataDict[event.currentTarget];
var k:int = event.keyCode;
var ka:int = event.charCode;
var kaBool:Boolean = (((ka >= 48)) && ((ka <= 57)));
ka = int(String.fromCharCode(event.charCode));
switch (event.type){
case KeyboardEvent.KEY_DOWN:
switch (event.target){
case controls[SEEK_BAR_HANDLE]:
case controls[VOLUME_BAR_HANDLE]:
if (((!((k == Keyboard.TAB))) && ((((((((((((((((((k == Keyboard.UP)) || ((k == Keyboard.DOWN)))) || ((k == Keyboard.LEFT)))) || ((k == Keyboard.RIGHT)))) || ((k == Keyboard.PAGE_UP)))) || ((k == Keyboard.PAGE_DOWN)))) || ((k == Keyboard.HOME)))) || ((k == Keyboard.END)))) || (((!(isNaN(ka))) && (kaBool))))))){
focusControl = (event.target as InteractiveObject);
focusControl.stage.focus = focusControl;
if (event.target == controls[SEEK_BAR_HANDLE]){
percent = _vc.playheadPercentage;
nearestCuePoint = _vc.findNearestCuePoint(_vc.playheadTime);
if ((((k == Keyboard.LEFT)) || ((k == Keyboard.DOWN)))){
percent = (percent - (_vc.seekBarScrubTolerance * 2));
_vc.playheadPercentage = Math.max(percent, 0);
} else {
if ((((k == Keyboard.RIGHT)) || ((k == Keyboard.UP)))){
if (_vc.playheadPercentage >= 99){
return;
};
if (((!((nearestCuePoint == null))) && ((nearestCuePoint.index < ((nearestCuePoint.array as Array).length - 1))))){
try {
nextCuePoint = _vc.findCuePoint(nearestCuePoint.array[(nearestCuePoint.index + 1)]);
if (((nextCuePoint) && (_vc.isFLVCuePointEnabled(nextCuePoint)))){
if (isNaN(Number(_vc.metadata.videocodecid))){
_vc.playheadPercentage = Math.max(((nextCuePoint.time / _vc.totalTime) * 100), Math.min(99, (_vc.playheadPercentage + (_vc.seekBarScrubTolerance * 2))));
} else {
_vc.playheadTime = nextCuePoint.time;
};
};
} catch(err:Error) {
};
} else {
percent = (percent + _vc.seekBarScrubTolerance);
_vc.playheadPercentage = Math.min(99, percent);
};
} else {
if ((((k == Keyboard.PAGE_UP)) || ((k == Keyboard.HOME)))){
_vc.playheadPercentage = 0;
} else {
if ((((k == Keyboard.PAGE_DOWN)) || ((k == Keyboard.END)))){
_vc.playheadPercentage = 99;
};
};
};
};
} else {
wasMuted = _isMuted;
num = (_isMuted) ? (Math.round((cachedSoundLevel * 1000)) / 100) : (Math.round((_vc.volume * 1000)) / 100);
if ((((k == Keyboard.LEFT)) || ((k == Keyboard.DOWN)))){
if (Math.floor(num) != num){
_vc.volume = (Math.floor(num) / 10);
} else {
_vc.volume = Math.max(0, ((num - 1) / 10));
};
} else {
if ((((k == Keyboard.RIGHT)) || ((k == Keyboard.UP)))){
if (Math.round(num) != num){
_vc.volume = (Math.round(num) / 10);
} else {
_vc.volume = Math.min(1, ((num + 1) / 10));
};
} else {
if ((((k == Keyboard.PAGE_UP)) || ((k == Keyboard.HOME)))){
_vc.volume = 1;
} else {
if ((((k == Keyboard.PAGE_DOWN)) || ((k == Keyboard.END)))){
_vc.volume = 0;
} else {
if (((!(isNaN(ka))) && (kaBool))){
_vc.volume = Math.min(1, ((ka + 1) / 10));
};
};
};
};
};
cachedSoundLevel = _vc.volume;
if (wasMuted){
_isMuted = true;
cachedSoundLevel = _vc.volume;
_vc.volume = 0;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
};
};
break;
case controls[PAUSE_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
if (!event.target.focusRect){
dispatchMessage(ctrlData.index);
};
focusControl = (controls[PLAY_BUTTON] as InteractiveObject);
};
break;
case controls[PLAY_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
if (!event.target.focusRect){
dispatchMessage(ctrlData.index);
};
focusControl = (controls[PAUSE_BUTTON] as InteractiveObject);
};
break;
case controls[STOP_BUTTON]:
case controls[BACK_BUTTON]:
case controls[FORWARD_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
event.target.tabEnabled = true;
if (!event.target.focusRect){
dispatchMessage(ctrlData.index);
};
focusControl = (event.target as InteractiveObject);
};
break;
case controls[MUTE_ON_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
if (!event.target.focusRect){
dispatchMessage(ctrlData.index);
};
focusControl = (controls[MUTE_OFF_BUTTON] as InteractiveObject);
};
break;
case controls[MUTE_OFF_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
if (!event.target.focusRect){
dispatchMessage(ctrlData.index);
};
focusControl = (controls[MUTE_ON_BUTTON] as InteractiveObject);
};
break;
case controls[FULL_SCREEN_ON_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
dispatchMessage(FULL_SCREEN_ON_BUTTON);
};
break;
case controls[FULL_SCREEN_OFF_BUTTON]:
if ((((k == Keyboard.SPACE)) || ((k == Keyboard.ENTER)))){
ctrlData.state = DOWN_STATE;
dispatchMessage(FULL_SCREEN_OFF_BUTTON);
};
break;
};
skinButtonControl(event.currentTarget);
break;
case KeyboardEvent.KEY_UP:
switch (event.target){
case controls[SEEK_BAR_HANDLE]:
case controls[VOLUME_BAR_HANDLE]:
if (((!((k == Keyboard.TAB))) && ((((((((((((((((k == Keyboard.UP)) || ((k == Keyboard.DOWN)))) || ((k == Keyboard.LEFT)))) || ((k == Keyboard.RIGHT)))) || ((k == Keyboard.PAGE_UP)))) || ((k == Keyboard.PAGE_DOWN)))) || ((k == Keyboard.HOME)))) || ((k == Keyboard.END)))))){
focusControl = (event.target as InteractiveObject);
focusControl.stage.focus = focusControl;
};
break;
default:
ctrlData.state = OVER_STATE;
break;
};
break;
};
if (focusControl != null){
if (focusControl.visible){
ctrlData.state = NORMAL_STATE;
if (!focusControl.tabEnabled){
focusControl.tabEnabled = true;
};
focusControl.stage.focus = focusControl;
} else {
ctrl = (event.currentTarget as Sprite);
setFocusedControl = function (_arg1:Event):void{
if (_arg1.target.visible){
ctrlData.state = NORMAL_STATE;
if (!_arg1.target.tabEnabled){
_arg1.target.tabEnabled = true;
};
_arg1.target.stage.focus = _arg1.target;
_arg1.target.removeEventListener(Event.ENTER_FRAME, setFocusedControl);
};
};
focusControl.addEventListener(Event.ENTER_FRAME, setFocusedControl);
};
};
}
flvplayback_internal function handleIVPEvent(_arg1:IVPEvent):void{
var _local3:int;
var _local4:VideoEvent;
var _local5:Sprite;
var _local6:ControlData;
var _local7:VideoProgressEvent;
var _local8:VideoPlayerState;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (_arg1.vp != _vc.visibleVideoPlayerIndex){
return;
};
var _local2:uint = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (_arg1.type){
case VideoEvent.STATE_CHANGE:
_local4 = VideoEvent(_arg1);
if (_local4.state == VideoState.BUFFERING){
if (!_bufferingOn){
_bufferingDelayTimer.reset();
_bufferingDelayTimer.start();
};
} else {
_bufferingDelayTimer.reset();
_bufferingOn = false;
};
if (_local4.state == VideoState.LOADING){
_progressPercent = (_vc.getVideoPlayer(_arg1.vp).isRTMP) ? 100 : 0;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (controls[_local3] == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _local4.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
break;
case VideoEvent.READY:
case MetadataEvent.METADATA_RECEIVED:
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _vc.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
if (_vc.getVideoPlayer(_arg1.vp).isRTMP){
_progressPercent = 100;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
break;
case VideoEvent.PLAYHEAD_UPDATE:
if (((((((!((controls[SEEK_BAR] == undefined))) && (!(_vc.isLive)))) && (!(isNaN(_vc.totalTime))))) && (!((_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING))))){
_local4 = VideoEvent(_arg1);
_local10 = ((_local4.playheadTime / _vc.totalTime) * 100);
if (_local10 < 0){
_local10 = 0;
} else {
if (_local10 > 100){
_local10 = 100;
};
};
_local5 = controls[SEEK_BAR];
_local6 = ctrlDataDict[_local5];
_local6.percentage = _local10;
positionHandle(_local5);
};
break;
case VideoProgressEvent.PROGRESS:
_local7 = VideoProgressEvent(_arg1);
_progressPercent = ((_local7.bytesTotal)<=0) ? 100 : ((_local7.bytesLoaded / _local7.bytesTotal) * 100);
_local8 = _vc.videoPlayerStates[_arg1.vp];
_local9 = _local8.minProgressPercent;
if (((!(isNaN(_local9))) && ((_local9 > _progressPercent)))){
_progressPercent = _local9;
};
if (!isNaN(_vc.totalTime)){
_local11 = ((_vc.playheadTime / _vc.totalTime) * 100);
if (_local11 > _progressPercent){
_progressPercent = _local11;
_local8.minProgressPercent = _progressPercent;
};
};
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
break;
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function layoutSkin():void{
var i:int;
var borderRect:Rectangle;
var forceSkinAutoHide:Boolean;
var minWidth:Number;
var vidWidth:Number;
var minHeight:Number;
var vidHeight:Number;
if (layout_mc == null){
return;
};
if (skinLoadDelayCount < 2){
return;
};
var video_mc:DisplayObject = layout_mc["video_mc"];
if (video_mc == null){
throw (new Error("No layout_mc.video_mc"));
};
placeholderLeft = video_mc.x;
placeholderRight = (video_mc.x + video_mc.width);
placeholderTop = video_mc.y;
placeholderBottom = (video_mc.y + video_mc.height);
videoLeft = (_vc.x - _vc.registrationX);
videoRight = (videoLeft + _vc.width);
videoTop = (_vc.y - _vc.registrationY);
videoBottom = (videoTop + _vc.height);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((border_mc == null))))){
borderRect = calcLayoutControl(border_mc);
forceSkinAutoHide = false;
if ((((borderRect.width > 0)) && ((borderRect.height > 0)))){
if (borderRect.x < 0){
placeholderLeft = (placeholderLeft + (videoLeft - borderRect.x));
forceSkinAutoHide = true;
};
if ((borderRect.x + borderRect.width) > _vc.registrationWidth){
placeholderRight = (placeholderRight + ((borderRect.x + borderRect.width) - videoRight));
forceSkinAutoHide = true;
};
if (borderRect.y < 0){
placeholderTop = (placeholderTop + (videoTop - borderRect.y));
forceSkinAutoHide = true;
};
if ((borderRect.y + borderRect.height) > _vc.registrationHeight){
placeholderBottom = (placeholderBottom + ((borderRect.y + borderRect.height) - videoBottom));
forceSkinAutoHide = true;
};
if (forceSkinAutoHide){
_skinAutoHide = true;
setupSkinAutoHide(true);
};
};
};
try {
if (!isNaN(layout_mc["minWidth"])){
minWidth = layout_mc["minWidth"];
vidWidth = (videoRight - videoLeft);
if ((((minWidth > 0)) && ((minWidth > vidWidth)))){
videoLeft = (videoLeft - ((minWidth - vidWidth) / 2));
videoRight = (minWidth + videoLeft);
};
};
} catch(re1:ReferenceError) {
};
try {
if (!isNaN(layout_mc["minHeight"])){
minHeight = layout_mc["minHeight"];
vidHeight = (videoBottom - videoTop);
if ((((minHeight > 0)) && ((minHeight > vidHeight)))){
videoTop = (videoTop - ((minHeight - vidHeight) / 2));
videoBottom = (minHeight + videoTop);
};
};
} catch(re2:ReferenceError) {
};
i = 0;
while (i < customClips.length) {
layoutControl(customClips[i]);
if (customClips[i] == border_mc){
bitmapCopyBorder();
};
i = (i + 1);
};
i = 0;
while (i < NUM_CONTROLS) {
layoutControl(controls[i]);
i = (i + 1);
};
}
public function set bufferingDelayInterval(_arg1:Number):void{
if (_bufferingDelayTimer.delay == _arg1){
return;
};
_bufferingDelayTimer.delay = _arg1;
}
flvplayback_internal function setupButtonSkinState(_arg1:Sprite, _arg2:Sprite, _arg3:String, _arg4:DisplayObject=null):DisplayObject{
var stateSkin:DisplayObject;
var ctrl = _arg1;
var definitionHolder = _arg2;
var skinName = _arg3;
var defaultSkin = _arg4;
try {
stateSkin = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (defaultSkin != null){
stateSkin = null;
} else {
throw (ve);
};
};
if (stateSkin != null){
stateSkin.visible = false;
ctrl.addChild(stateSkin);
} else {
if (defaultSkin != null){
stateSkin = defaultSkin;
};
};
return (stateSkin);
}
flvplayback_internal function setEnabledAndVisibleForState(_arg1:int, _arg2:String):void{
var _local6:ControlData;
var _local7:Boolean;
var _local8:ControlData;
var _local9:ControlData;
var _local10:ControlData;
var _local11:ControlData;
var _local3:int = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
var _local4:String = _arg2;
if ((((_local4 == VideoState.BUFFERING)) && (!(_bufferingOn)))){
_local4 = VideoState.PLAYING;
};
var _local5:Sprite = controls[_arg1];
if (_local5 == null){
return;
};
_local6 = ctrlDataDict[_local5];
if (_local6 == null){
return;
};
switch (_arg1){
case VOLUME_BAR:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
_local6.enabled = true;
break;
case FULL_SCREEN_ON_BUTTON:
_local6.enabled = !(_fullScreen);
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case FULL_SCREEN_OFF_BUTTON:
_local6.enabled = _fullScreen;
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_ON_BUTTON:
_local6.enabled = !(_isMuted);
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_OFF_BUTTON:
_local6.enabled = _isMuted;
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
default:
switch (_local4){
case VideoState.LOADING:
case VideoState.CONNECTION_ERROR:
_local6.enabled = false;
break;
case VideoState.DISCONNECTED:
_local6.enabled = ((!((_vc.source == null))) && (!((_vc.source == ""))));
break;
case VideoState.SEEKING:
break;
default:
_local6.enabled = true;
break;
};
break;
};
switch (_arg1){
case SEEK_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
default:
_local6.enabled = false;
break;
};
if (_local6.enabled){
_local6.enabled = !(isNaN(_vc.totalTime));
};
if (_local6.handle_mc != null){
_local8 = ctrlDataDict[_local6.handle_mc];
_local8.enabled = _local6.enabled;
_local6.handle_mc.visible = _local8.enabled;
};
if (_local6.hit_mc != null){
_local9 = ctrlDataDict[_local6.hit_mc];
_local9.enabled = _local6.enabled;
_local6.hit_mc.visible = _local9.enabled;
};
_local7 = ((((((!(_bufferingBarHides)) || (_local6.enabled))) || ((controls[BUFFERING_BAR] == undefined)))) || (!(controls[BUFFERING_BAR].visible)));
_local5.visible = _local7;
if (_local6.progress_mc != null){
_local6.progress_mc.visible = _local7;
_local10 = ctrlDataDict[_local6.progress_mc];
if (_local10.fill_mc != null){
_local10.fill_mc.visible = _local7;
};
};
if (_local6.fullness_mc != null){
_local6.fullness_mc.visible = _local7;
_local11 = ctrlDataDict[_local6.fullness_mc];
if (_local11.fill_mc != null){
_local11.fill_mc.visible = _local7;
};
};
break;
case BUFFERING_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = false;
break;
default:
_local6.enabled = true;
break;
};
_local5.visible = _local6.enabled;
if (_local6.fill_mc != null){
_local6.fill_mc.visible = _local6.enabled;
};
break;
case PAUSE_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.REWINDING:
_local6.enabled = false;
break;
case VideoState.PLAYING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case PLAY_BUTTON:
switch (_local4){
case VideoState.PLAYING:
_local6.enabled = false;
break;
case VideoState.STOPPED:
case VideoState.PAUSED:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = !(controls[PAUSE_BUTTON].visible);
};
break;
case STOP_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
_local6.enabled = false;
_local5.tabEnabled = false;
break;
case VideoState.PAUSED:
case VideoState.PLAYING:
case VideoState.BUFFERING:
_local6.enabled = true;
_local5.tabEnabled = true;
break;
};
break;
case BACK_BUTTON:
case FORWARD_BUTTON:
switch (_local4){
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
_local5.tabEnabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
};
_local5.mouseEnabled = _local6.enabled;
_vc.activeVideoPlayerIndex = _local3;
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
var v = _arg1;
if (_fullScreenTakeOver != v){
_fullScreenTakeOver = v;
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
if (((((!((_vc.stage == null))) && (_fullScreen))) && (_fullScreenAccel))){
try {
_vc.stage.displayState = StageDisplayState.NORMAL;
} catch(se:SecurityError) {
};
};
exitFullScreenTakeOver();
};
};
}
flvplayback_internal function enterFullScreenTakeOver():void{
var i:int;
var fullScreenBG:Sprite;
var vp:VideoPlayer;
if (((!(_fullScreen)) || (!((cacheFLVPlaybackParent == null))))){
return;
};
_vc.removeEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.removeEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
try {
cacheFLVPlaybackScaleMode = new Array();
cacheFLVPlaybackAlign = new Array();
i = 0;
while (i < _vc.videoPlayers.length) {
vp = (_vc.videoPlayers[i] as VideoPlayer);
if (vp != null){
cacheFLVPlaybackScaleMode[i] = vp.scaleMode;
cacheFLVPlaybackAlign[i] = vp.align;
};
i = (i + 1);
};
cacheFLVPlaybackParent = _vc.parent;
cacheFLVPlaybackIndex = _vc.parent.getChildIndex(_vc);
cacheFLVPlaybackLocation = new Rectangle(_vc.registrationX, _vc.registrationY, _vc.registrationWidth, _vc.registrationHeight);
if (!_fullScreenAccel){
cacheStageAlign = _vc.stage.align;
cacheStageScaleMode = _vc.stage.scaleMode;
_vc.stage.align = StageAlign.TOP_LEFT;
_vc.stage.scaleMode = StageScaleMode.NO_SCALE;
};
_vc.align = VideoAlign.CENTER;
_vc.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_vc.registrationX = 0;
_vc.registrationY = 0;
if (_fullScreenAccel){
_vc.setSize(_vc.stage.fullScreenSourceRect.width, _vc.stage.fullScreenSourceRect.height);
} else {
_vc.setSize(_vc.stage.stageWidth, _vc.stage.stageHeight);
};
if (_vc.stage != _vc.parent){
_vc.stage.addChild(_vc);
} else {
_vc.stage.setChildIndex(_vc, (_vc.stage.numChildren - 1));
};
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG == null){
fullScreenBG = new Sprite();
fullScreenBG.name = "fullScreenBG";
_vc.addChildAt(fullScreenBG, 0);
} else {
_vc.setChildIndex(fullScreenBG, 0);
};
fullScreenBG.graphics.beginFill(_fullScreenBgColor);
if (_fullScreenAccel){
fullScreenBG.graphics.drawRect(0, 0, _vc.stage.fullScreenSourceRect.width, _vc.stage.fullScreenSourceRect.height);
} else {
fullScreenBG.graphics.drawRect(0, 0, _vc.stage.stageWidth, _vc.stage.stageHeight);
};
layoutSkin();
setupSkinAutoHide(false);
if (hitTarget_mc != null){
hitTarget_mc.graphics.clear();
hitTarget_mc.graphics.lineStyle(0, 0, 0);
if (_fullScreenAccel){
hitTarget_mc.graphics.drawRect(0, 0, _vc.stage.fullScreenSourceRect.width, _vc.stage.fullScreenSourceRect.height);
} else {
hitTarget_mc.graphics.drawRect(0, 0, _vc.stage.stageWidth, _vc.stage.stageHeight);
};
};
} catch(err:Error) {
cacheFLVPlaybackParent = null;
};
_vc.addEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
}
public function set seekBarScrubTolerance(_arg1:Number):void{
_seekBarScrubTolerance = _arg1;
}
flvplayback_internal function cleanupHandle(_arg1:Object):void{
var e:Event;
var ctrl:Sprite;
var ctrlData:ControlData;
var ctrlOrEvent = _arg1;
try {
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
};
ctrl = ((e == null)) ? Sprite(ctrlOrEvent) : Sprite(e.currentTarget);
ctrlData = ctrlDataDict[ctrl];
if ((((ctrlData == null)) || ((e == null)))){
ctrl.removeEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle, false);
if (ctrlData == null){
return;
};
};
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
if (ctrlData.handle_mc != null){
if (ctrlData.handle_mc.parent != null){
ctrlData.handle_mc.parent.removeChild(ctrlData.handle_mc);
};
delete ctrlDataDict[ctrlData.handle_mc];
ctrlData.handle_mc = null;
};
if (ctrlData.hit_mc != null){
if (ctrlData.hit_mc.parent != null){
ctrlData.hit_mc.parent.removeChild(ctrlData.hit_mc);
};
delete ctrlDataDict[ctrlData.hit_mc];
ctrlData.hit_mc = null;
};
} catch(err:Error) {
};
}
flvplayback_internal function assignTabIndexes(_arg1:int):int{
var controlsSlice:Array;
var customSlice:Array;
var sortedControls:Array;
var i:int;
var ctrl:Sprite;
var startTabbing = _arg1;
if (startTabbing){
startTabIndex = startTabbing;
endTabIndex = (startTabIndex + 1);
} else {
if (_vc.tabIndex){
startTabIndex = _vc.tabIndex;
endTabIndex = (startTabIndex + 1);
} else {
return (endTabIndex);
};
};
var sortByPosition:Function = function (_arg1:DisplayObject, _arg2:DisplayObject):int{
var _local3:Rectangle = _arg1.getBounds(_vc);
var _local4:Rectangle = _arg2.getBounds(_vc);
if (_local3.x > _local4.x){
return (1);
};
if (_local3.x < _local4.x){
return (-1);
};
if (_local3.y > _local4.y){
return (-1);
};
if (_local3.y < _local4.y){
return (1);
};
return (0);
};
try {
controlsSlice = controls.slice();
if (((customClips) && ((customClips.length > 0)))){
customSlice = customClips.slice();
};
sortedControls = (customSlice) ? controlsSlice.concat(customSlice) : controlsSlice;
sortedControls.sort(sortByPosition);
while (i < sortedControls.length) {
ctrl = (sortedControls[i] as Sprite);
ctrl.tabIndex = ++endTabIndex;
if (!ctrl.tabEnabled){
ctrl.tabEnabled = false;
};
i = (i + 1);
};
} catch(err:Error) {
};
return (++endTabIndex);
}
flvplayback_internal static function getNumberPropSafe(_arg1:Object, _arg2:String):Number{
var numProp:*;
var obj = _arg1;
var propName = _arg2;
try {
numProp = obj[propName];
return (Number(numProp));
} catch(re:ReferenceError) {
};
return (NaN);
}
flvplayback_internal static function getBooleanPropSafe(_arg1:Object, _arg2:String):Boolean{
var boolProp:*;
var obj = _arg1;
var propName = _arg2;
try {
boolProp = obj[propName];
return (Boolean(boolProp));
} catch(re:ReferenceError) {
};
return (false);
}
flvplayback_internal static function initLayoutNameToIndexMappings():void{
layoutNameToIndexMappings = new Object();
var _local1:int;
while (_local1 < layoutNameArray.length) {
if (layoutNameArray[_local1] != null){
layoutNameToIndexMappings[layoutNameArray[_local1]] = _local1;
};
_local1++;
};
}
}
}//package fl.video
Section 58
//VideoAlign (fl.video.VideoAlign)
package fl.video {
public final class VideoAlign {
public static const CENTER:String = "center";
public static const LEFT:String = "left";
public static const BOTTOM_RIGHT:String = "bottomRight";
public static const BOTTOM:String = "bottom";
public static const TOP_LEFT:String = "topLeft";
public static const TOP_RIGHT:String = "topRight";
public static const TOP:String = "top";
public static const BOTTOM_LEFT:String = "bottomLeft";
public static const RIGHT:String = "right";
}
}//package fl.video
Section 59
//VideoError (fl.video.VideoError)
package fl.video {
public class VideoError extends Error {
private var _code:uint;
public static const INVALID_SOURCE:uint = 1004;
flvplayback_internal static const ERROR_MSG:Array = ["Unable to make connection to server or to find FLV on server", "No matching cue point found", "Illegal cue point", "Invalid seek", "Invalid source", "Invalid xml", "No bitrate match, must be no default flv", "Cannot delete default VideoPlayer", "VideoPlayer.iNCManagerClass has not been set or its value is invalid", "Null url parameter sent to load()", "Skin is missing a required style definition or its value is invalid", "Unsupported property", "VideoPlayer.netStreamClientClass has not been set or its value is invalid"];
public static const NULL_URL_LOAD:uint = 1009;
public static const INVALID_XML:uint = 1005;
flvplayback_internal static const BASE_ERROR_CODE:uint = 1000;
public static const DELETE_DEFAULT_PLAYER:uint = 1007;
public static const SHORT_VERSION:String = "2.1";
public static const UNSUPPORTED_PROPERTY:uint = 1011;
public static const ILLEGAL_CUE_POINT:uint = 1002;
public static const INVALID_SEEK:uint = 1003;
public static const NO_CONNECTION:uint = 1000;
public static const MISSING_SKIN_STYLE:uint = 1010;
public static const INCMANAGER_CLASS_UNSET:uint = 1008;
public static const NO_BITRATE_MATCH:uint = 1006;
public static const NETSTREAM_CLIENT_CLASS_UNSET:uint = 1012;
public static const VERSION:String = "2.1.0.20";
public function VideoError(_arg1:uint, _arg2:String=null){
super((((("" + _arg1) + ": ") + ERROR_MSG[(_arg1 - BASE_ERROR_CODE)]) + ((_arg2)==null) ? "" : (": " + _arg2)));
name = "VideoError";
_code = _arg1;
}
public function get code():uint{
return (_code);
}
}
}//package fl.video
Section 60
//VideoEvent (fl.video.VideoEvent)
package fl.video {
import flash.events.*;
public class VideoEvent extends Event implements IVPEvent {
private var _playheadTime:Number;
private var _vp:uint;
private var _state:String;
public static const FAST_FORWARD:String = "fastForward";
public static const READY:String = "ready";
public static const SKIN_LOADED:String = "skinLoaded";
public static const SCRUB_FINISH:String = "scrubFinish";
public static const BUFFERING_STATE_ENTERED:String = "bufferingStateEntered";
public static const STOPPED_STATE_ENTERED:String = "stoppedStateEntered";
public static const AUTO_REWOUND:String = "autoRewound";
public static const SCRUB_START:String = "scrubStart";
public static const PLAYHEAD_UPDATE:String = "playheadUpdate";
public static const SEEKED:String = "seeked";
public static const PLAYING_STATE_ENTERED:String = "playingStateEntered";
public static const CLOSE:String = "close";
public static const PAUSED_STATE_ENTERED:String = "pausedStateEntered";
public static const COMPLETE:String = "complete";
public static const REWIND:String = "rewind";
public static const STATE_CHANGE:String = "stateChange";
public function VideoEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:Number=NaN, _arg6:uint=0){
super(_arg1, _arg2, _arg3);
_state = _arg4;
_playheadTime = _arg5;
_vp = _arg6;
}
public function get playheadTime():Number{
return (_playheadTime);
}
public function set playheadTime(_arg1:Number):void{
_playheadTime = _arg1;
}
public function set state(_arg1:String):void{
_state = _arg1;
}
public function get state():String{
return (_state);
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
override public function clone():Event{
return (new VideoEvent(type, bubbles, cancelable, state, playheadTime, vp));
}
}
}//package fl.video
Section 61
//VideoPlayer (fl.video.VideoPlayer)
package fl.video {
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class VideoPlayer extends Video {
protected var _align:String;
protected var _registrationWidth:Number;
flvplayback_internal var _updateProgressTimer:Timer;
flvplayback_internal var _atEndCheckPlayhead:Number;
flvplayback_internal var _hiddenForResize:Boolean;
flvplayback_internal var startProgressTime:Number;
protected var _volume:Number;
flvplayback_internal var _invalidSeekTime:Boolean;
protected var _isLive:Boolean;
flvplayback_internal var _readyDispatched:Boolean;
flvplayback_internal var lastUpdateTimeStuckCount:Number;
protected var _ns:NetStream;
protected var _streamLength:Number;
flvplayback_internal var _bufferState:String;
flvplayback_internal var _rtmpDoSeekTimer:Timer;
flvplayback_internal var lastUpdateTimeStuckCountMax:int;// = 10
protected var _contentPath:String;
flvplayback_internal var _lastUpdateTime:Number;
protected var _metadata:Object;
protected var __visible:Boolean;
flvplayback_internal var autoResizeMetadataDelayMax:Number;// = 5
protected var _scaleMode:String;
flvplayback_internal var _sawPlayStop:Boolean;
flvplayback_internal var _atEnd:Boolean;
flvplayback_internal var _sawSeekNotify:Boolean;
flvplayback_internal var _idleTimeoutTimer:Timer;
flvplayback_internal var _prevVideoWidth:int;
protected var _registrationX:Number;
protected var _registrationY:Number;
protected var _bufferTime:Number;
flvplayback_internal var _cachedState:String;
flvplayback_internal var totalDownloadTime:Number;
flvplayback_internal var _cachedPlayheadTime:Number;
protected var _autoPlay:Boolean;
protected var _autoRewind:Boolean;
flvplayback_internal var _invalidSeekRecovery:Boolean;
flvplayback_internal var _hiddenRewindPlayheadTime:Number;
flvplayback_internal var _prevVideoHeight:int;
protected var _ncMgr:INCManager;
protected var _soundTransform:SoundTransform;
flvplayback_internal var _httpDoSeekCount:Number;
flvplayback_internal var oldRegistrationBounds:Rectangle;
flvplayback_internal var _cmdQueue:Array;
flvplayback_internal var _updateTimeTimer:Timer;
flvplayback_internal var _startingPlay:Boolean;
flvplayback_internal var httpDoSeekMaxCount:Number;// = 4
flvplayback_internal var _httpDoSeekTimer:Timer;
flvplayback_internal var baselineProgressTime:Number;
flvplayback_internal var _autoResizeTimer:Timer;
flvplayback_internal var _autoResizeDone:Boolean;
protected var _state:String;
protected var _videoWidth:int;
flvplayback_internal var _finishAutoResizeTimer:Timer;
flvplayback_internal var _resizeImmediatelyOnMetadata:Boolean;
flvplayback_internal var _currentPos:Number;
flvplayback_internal var oldBounds:Rectangle;
protected var _videoHeight:int;
flvplayback_internal var _delayedBufferingTimer:Timer;
flvplayback_internal var waitingForEnough:Boolean;
flvplayback_internal var _hiddenForResizeMetadataDelay:Number;
protected var _registrationHeight:Number;
flvplayback_internal var autoResizePlayheadTimeout:Number;// = 0.5
flvplayback_internal var _rtmpDoStopAtEndTimer:Timer;
flvplayback_internal var _lastSeekTime:Number;
flvplayback_internal var totalProgressTime:Number;
flvplayback_internal static const FINISH_AUTO_RESIZE_INTERVAL:Number = 250;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_PLAYHEAD_TIMEOUT:Number = 0.5;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_METADATA_DELAY_MAX:Number = 5;
public static const SHORT_VERSION:String = "2.1";
flvplayback_internal static const HTTP_DO_SEEK_INTERVAL:Number = 250;
flvplayback_internal static const DEFAULT_HTTP_DO_SEEK_MAX_COUNT:Number = 4;
flvplayback_internal static const RTMP_DO_SEEK_INTERVAL:Number = 100;
flvplayback_internal static const HTTP_DELAYED_BUFFERING_INTERVAL:Number = 100;
public static const DEFAULT_UPDATE_TIME_INTERVAL:Number = 250;
flvplayback_internal static const AUTO_RESIZE_INTERVAL:Number = 100;
public static const DEFAULT_IDLE_TIMEOUT_INTERVAL:Number = 300000;
flvplayback_internal static const DEFAULT_LAST_UPDATE_TIME_STUCK_COUNT_MAX:int = 10;
flvplayback_internal static const RTMP_DO_STOP_AT_END_INTERVAL:Number = 500;
public static const VERSION:String = "2.1.0.20";
public static const DEFAULT_UPDATE_PROGRESS_INTERVAL:Number = 250;
public static var netStreamClientClass:Object = VideoPlayerClient;
public static var iNCManagerClass:Object = "fl.video.NCManager";
flvplayback_internal static var BUFFER_FLUSH:String = "bufferFlush";
flvplayback_internal static var BUFFER_FULL:String = "bufferFull";
flvplayback_internal static var BUFFER_EMPTY:String = "bufferEmpty";
public function VideoPlayer(_arg1:int=320, _arg2:int=240){
super(_arg1, _arg2);
_registrationX = x;
_registrationY = y;
_registrationWidth = _arg1;
_registrationHeight = _arg2;
_state = VideoState.DISCONNECTED;
_cachedState = _state;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_cachedPlayheadTime = 0;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_currentPos = 0;
_atEnd = false;
_streamLength = 0;
_cmdQueue = new Array();
_readyDispatched = false;
_autoResizeDone = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
_hiddenForResize = false;
_hiddenForResizeMetadataDelay = 0;
_resizeImmediatelyOnMetadata = false;
_videoWidth = -1;
_videoHeight = -1;
_prevVideoWidth = 0;
_prevVideoHeight = 0;
_updateTimeTimer = new Timer(DEFAULT_UPDATE_TIME_INTERVAL);
_updateTimeTimer.addEventListener(TimerEvent.TIMER, doUpdateTime);
_updateProgressTimer = new Timer(DEFAULT_UPDATE_PROGRESS_INTERVAL);
_updateProgressTimer.addEventListener(TimerEvent.TIMER, doUpdateProgress);
_idleTimeoutTimer = new Timer(DEFAULT_IDLE_TIMEOUT_INTERVAL, 1);
_idleTimeoutTimer.addEventListener(TimerEvent.TIMER, doIdleTimeout);
_autoResizeTimer = new Timer(AUTO_RESIZE_INTERVAL);
_autoResizeTimer.addEventListener(TimerEvent.TIMER, doAutoResize);
_rtmpDoStopAtEndTimer = new Timer(RTMP_DO_STOP_AT_END_INTERVAL);
_rtmpDoStopAtEndTimer.addEventListener(TimerEvent.TIMER, rtmpDoStopAtEnd);
_rtmpDoSeekTimer = new Timer(RTMP_DO_SEEK_INTERVAL);
_rtmpDoSeekTimer.addEventListener(TimerEvent.TIMER, rtmpDoSeek);
_httpDoSeekTimer = new Timer(HTTP_DO_SEEK_INTERVAL);
_httpDoSeekTimer.addEventListener(TimerEvent.TIMER, httpDoSeek);
_httpDoSeekCount = 0;
_finishAutoResizeTimer = new Timer(FINISH_AUTO_RESIZE_INTERVAL, 1);
_finishAutoResizeTimer.addEventListener(TimerEvent.TIMER, finishAutoResize);
_delayedBufferingTimer = new Timer(HTTP_DELAYED_BUFFERING_INTERVAL);
_delayedBufferingTimer.addEventListener(TimerEvent.TIMER, doDelayedBuffering);
_isLive = false;
_align = VideoAlign.CENTER;
_scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_autoPlay = true;
_autoRewind = false;
_bufferTime = 0.1;
_soundTransform = new SoundTransform();
_volume = _soundTransform.volume;
__visible = true;
_contentPath = "";
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
}
public function get playheadTime():Number{
var _local1:Number = ((_ns)==null) ? _currentPos : _ns.time;
if (((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))){
_local1 = (_local1 - _metadata.audiodelay);
if (_local1 < 0){
_local1 = 0;
};
};
return (_local1);
}
public function stop():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.STOP);
return;
};
execQueuedCmds();
};
};
if ((((_state == VideoState.STOPPED)) || ((_ns == null)))){
return;
};
if (_ncMgr.isRTMP){
if (((_autoRewind) && (!(_isLive)))){
_currentPos = 0;
_play(0, 0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
closeNS(true);
setState(VideoState.STOPPED);
};
} else {
_pause(true);
if (_autoRewind){
_seek(0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
setState(VideoState.STOPPED);
};
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
super.scaleX = _arg1;
super.scaleY = _arg2;
_registrationWidth = width;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
override public function get videoWidth():int{
if (_videoWidth > 0){
return (_videoWidth);
};
if (((((!((_metadata == null))) && (!(isNaN(_metadata.width))))) && (!(isNaN(_metadata.height))))){
if ((((_metadata.width == _metadata.height)) && (_readyDispatched))){
return (super.videoWidth);
};
return (int(_metadata.width));
};
if (_readyDispatched){
return (super.videoWidth);
};
return (-1);
}
public function get scaleMode():String{
return (_scaleMode);
}
public function get progressInterval():Number{
return (_updateProgressTimer.delay);
}
public function set align(_arg1:String):void{
if (_align != _arg1){
switch (_arg1){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.LEFT:
case VideoAlign.BOTTOM:
case VideoAlign.RIGHT:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
break;
default:
return;
};
_align = _arg1;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
};
}
public function set scaleMode(_arg1:String):void{
if (_scaleMode != _arg1){
switch (_arg1){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
case VideoScaleMode.EXACT_FIT:
break;
default:
return;
};
if ((((((_scaleMode == VideoScaleMode.EXACT_FIT)) && (_resizeImmediatelyOnMetadata))) && ((((_videoWidth < 0)) || ((_videoHeight < 0)))))){
_resizeImmediatelyOnMetadata = false;
};
_scaleMode = _arg1;
startAutoResize();
};
}
public function get source():String{
return (_contentPath);
}
flvplayback_internal function doUpdateTime(_arg1:TimerEvent=null):void{
var _local2:Number = playheadTime;
if (_local2 != _atEndCheckPlayhead){
_atEndCheckPlayhead = NaN;
};
switch (_state){
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_updateTimeTimer.stop();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
if (((((((((!((_ncMgr == null))) && (!(_ncMgr.isRTMP)))) && ((_lastUpdateTime == _local2)))) && (!((_ns == null))))) && ((_ns.bytesLoaded == _ns.bytesTotal)))){
if (lastUpdateTimeStuckCount > lastUpdateTimeStuckCountMax){
lastUpdateTimeStuckCount = 0;
httpDoStopAtEnd();
} else {
lastUpdateTimeStuckCount++;
};
};
};
if (_lastUpdateTime != _local2){
dispatchEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, _state, _local2));
_lastUpdateTime = _local2;
lastUpdateTimeStuckCount = 0;
};
}
flvplayback_internal function rtmpNetStatus(_arg1:NetStatusEvent):void{
if (_state == VideoState.CONNECTION_ERROR){
return;
};
switch (_arg1.info.code){
case "NetStream.Play.Stop":
if (_startingPlay){
return;
};
switch (_state){
case VideoState.RESIZING:
if (_hiddenForResize){
finishAutoResize();
};
break;
case VideoState.LOADING:
case VideoState.STOPPED:
case VideoState.PAUSED:
break;
default:
_sawPlayStop = true;
if (((!(_rtmpDoStopAtEndTimer.running)) && ((((_bufferState == BUFFER_FLUSH)) || ((((_ns.bufferTime <= 0.1)) && ((_ns.bufferLength <= 0.1)))))))){
_cachedPlayheadTime = playheadTime;
_rtmpDoStopAtEndTimer.reset();
_rtmpDoStopAtEndTimer.start();
};
break;
};
break;
case "NetStream.Buffer.Empty":
switch (_bufferState){
case BUFFER_FULL:
if (_sawPlayStop){
rtmpDoStopAtEnd();
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
};
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
break;
case "NetStream.Buffer.Flush":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
if (((((!(_rtmpDoStopAtEndTimer.running)) && (_sawPlayStop))) && ((((_bufferState == BUFFER_EMPTY)) || ((((_ns.bufferTime <= 0.1)) && ((_ns.bufferLength <= 0.1)))))))){
_cachedPlayheadTime = playheadTime;
_rtmpDoStopAtEndTimer.reset();
_rtmpDoStopAtEndTimer.start();
};
switch (_bufferState){
case BUFFER_EMPTY:
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
_bufferState = BUFFER_FLUSH;
break;
default:
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
};
break;
case "NetStream.Buffer.Full":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
switch (_bufferState){
case BUFFER_EMPTY:
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
};
break;
case BUFFER_FLUSH:
_bufferState = BUFFER_FULL;
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
break;
};
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
case "NetStream.Pause.Notify":
if ((((_state == VideoState.RESIZING)) && (_hiddenForResize))){
finishAutoResize();
};
break;
case "NetStream.Unpause.Notify":
if (_state == VideoState.PAUSED){
_state = VideoState.PLAYING;
setState(VideoState.BUFFERING);
} else {
_cachedState = VideoState.PLAYING;
};
break;
case "NetStream.Play.Start":
_rtmpDoStopAtEndTimer.reset();
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
if (_startingPlay){
_startingPlay = false;
_cachedPlayheadTime = playheadTime;
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
case "NetStream.Play.Reset":
_rtmpDoStopAtEndTimer.reset();
if (_state == VideoState.REWINDING){
_rtmpDoSeekTimer.reset();
if ((((playheadTime == 0)) || ((playheadTime < _cachedPlayheadTime)))){
setStateFromCachedState();
} else {
_cachedPlayheadTime = playheadTime;
_rtmpDoSeekTimer.start();
};
};
break;
case "NetStream.Seek.Notify":
if (playheadTime != _cachedPlayheadTime){
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
} else {
_sawSeekNotify = true;
_rtmpDoSeekTimer.start();
};
break;
case "Netstream.Play.UnpublishNotify":
break;
case "Netstream.Play.PublishNotify":
break;
case "NetStream.Play.StreamNotFound":
closeNS(false);
if (!_ncMgr.connectAgain()){
setState(VideoState.CONNECTION_ERROR);
};
break;
case "NetStream.Play.Failed":
case "NetStream.Failed":
case "NetStream.Play.FileStructureInvalid":
case "NetStream.Play.NoSupportedTrackFound":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
public function get ncMgr():INCManager{
if (_ncMgr == null){
createINCManager();
};
return (_ncMgr);
}
public function set progressInterval(_arg1:Number):void{
_updateProgressTimer.delay = _arg1;
}
flvplayback_internal function createINCManager():void{
var theClass:Class;
try {
if ((iNCManagerClass is String)){
theClass = Class(getDefinitionByName(String(iNCManagerClass)));
} else {
if ((iNCManagerClass is Class)){
theClass = Class(iNCManagerClass);
};
};
} catch(e:Error) {
theClass = null;
};
if (theClass == null){
throw (new VideoError(VideoError.INCMANAGER_CLASS_UNSET, ((iNCManagerClass)==null) ? "null" : iNCManagerClass.toString()));
};
_ncMgr = new (theClass);
_ncMgr.videoPlayer = this;
}
flvplayback_internal function doAutoResize(_arg1:TimerEvent=null):void{
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
if (_autoResizeTimer.running){
switch (_state){
case VideoState.RESIZING:
case VideoState.LOADING:
break;
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_autoResizeTimer.reset();
return;
default:
if (!stateResponsive){
return;
};
};
if (((((((((!((super.videoWidth == _prevVideoWidth))) || (!((super.videoHeight == _prevVideoHeight))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))){
if (((((_hiddenForResize) && (!(_ns.client.ready)))) && ((_hiddenForResizeMetadataDelay < autoResizeMetadataDelayMax)))){
_hiddenForResizeMetadataDelay++;
return;
};
_autoResizeTimer.reset();
} else {
return;
};
};
if (_autoResizeDone){
setState(_cachedState);
return;
};
oldBounds = new Rectangle(x, y, width, height);
oldRegistrationBounds = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
_autoResizeDone = true;
var _local2:Boolean = _readyDispatched;
_readyDispatched = true;
_local3 = videoWidth;
_local4 = videoHeight;
_readyDispatched = _local2;
switch (_scaleMode){
case VideoScaleMode.NO_SCALE:
super.width = Math.round(_local3);
super.height = Math.round(_local4);
break;
case VideoScaleMode.EXACT_FIT:
super.width = registrationWidth;
super.height = registrationHeight;
break;
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
default:
_local5 = ((_local3 * _registrationHeight) / _local4);
_local6 = ((_local4 * _registrationWidth) / _local3);
if (_local6 < _registrationHeight){
super.width = _registrationWidth;
super.height = _local6;
} else {
if (_local5 < _registrationWidth){
super.width = _local5;
super.height = _registrationHeight;
} else {
super.width = _registrationWidth;
super.height = _registrationHeight;
};
};
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.BOTTOM:
default:
super.x = Math.round((_registrationX + ((_registrationWidth - width) / 2)));
break;
case VideoAlign.LEFT:
case VideoAlign.TOP_LEFT:
case VideoAlign.BOTTOM_LEFT:
super.x = Math.round(_registrationX);
break;
case VideoAlign.RIGHT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_RIGHT:
super.x = Math.round((_registrationX + (_registrationWidth - width)));
break;
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.LEFT:
case VideoAlign.RIGHT:
default:
super.y = Math.round((_registrationY + ((_registrationHeight - height) / 2)));
break;
case VideoAlign.TOP:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
super.y = Math.round(_registrationY);
break;
case VideoAlign.BOTTOM:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
super.y = Math.round((_registrationY + (_registrationHeight - height)));
break;
};
if (_hiddenForResize){
_hiddenRewindPlayheadTime = playheadTime;
if (_state == VideoState.LOADING){
_cachedState = VideoState.PLAYING;
};
if (!_ncMgr.isRTMP){
_pause(true);
_seek(0);
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
if (!_isLive){
_currentPos = 0;
_play(0, 0);
setState(VideoState.RESIZING);
} else {
if (_autoPlay){
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
finishAutoResize();
};
};
};
} else {
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
};
}
public function get totalTime():Number{
return (_streamLength);
}
public function set volume(_arg1:Number):void{
var _local2:SoundTransform = soundTransform;
_local2.volume = _arg1;
soundTransform = _local2;
}
flvplayback_internal function _play(_arg1:int=0, _arg2:int=-1):void{
waitingForEnough = false;
_rtmpDoStopAtEndTimer.reset();
_startingPlay = true;
_ns.play(_ncMgr.streamName, (_isLive) ? -1 : _arg1, _arg2);
}
flvplayback_internal function finishAutoResize(_arg1:TimerEvent=null):void{
if (stateResponsive){
return;
};
_hiddenForResize = false;
super.visible = __visible;
volume = _volume;
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
if (_autoPlay){
if (_ncMgr.isRTMP){
if (!_isLive){
_currentPos = 0;
_play(0);
};
if (_state == VideoState.RESIZING){
setState(VideoState.LOADING);
_cachedState = VideoState.PLAYING;
};
} else {
waitingForEnough = true;
_cachedState = _state;
_state = VideoState.PAUSED;
checkReadyForPlay(bytesLoaded, bytesTotal);
if (waitingForEnough){
_state = _cachedState;
setState(VideoState.PAUSED);
} else {
_cachedState = VideoState.PLAYING;
};
};
} else {
setState(VideoState.STOPPED);
};
}
public function set soundTransform(_arg1:SoundTransform):void{
if (_arg1 == null){
return;
};
if (_hiddenForResize){
_volume = _arg1.volume;
};
_soundTransform = new SoundTransform();
_soundTransform.volume = (_hiddenForResize) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
if (_ns != null){
_ns.soundTransform = _soundTransform;
};
}
flvplayback_internal function onCuePoint(_arg1:Object):void{
if (((!(_hiddenForResize)) || (((!(isNaN(_hiddenRewindPlayheadTime))) && ((playheadTime < _hiddenRewindPlayheadTime)))))){
dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, _arg1));
};
}
flvplayback_internal function httpNetStatus(_arg1:NetStatusEvent):void{
switch (_arg1.info.code){
case "NetStream.Play.Stop":
_delayedBufferingTimer.reset();
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
setState(_cachedState);
seek(playheadTime);
} else {
switch (_state){
case VideoState.SEEKING:
httpDoSeek(null);
case VideoState.PLAYING:
case VideoState.BUFFERING:
httpDoStopAtEnd();
break;
};
};
break;
case "NetStream.Seek.InvalidTime":
if (_invalidSeekRecovery){
_invalidSeekTime = false;
_invalidSeekRecovery = false;
setState(_cachedState);
seek(0);
} else {
_invalidSeekTime = true;
_httpDoSeekCount = 0;
_httpDoSeekTimer.start();
};
break;
case "NetStream.Buffer.Empty":
_bufferState = BUFFER_EMPTY;
if (_state == VideoState.PLAYING){
_delayedBufferingTimer.reset();
_delayedBufferingTimer.start();
};
break;
case "NetStream.Buffer.Full":
case "NetStream.Buffer.Flush":
_delayedBufferingTimer.reset();
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
break;
case "NetStream.Seek.Notify":
_invalidSeekRecovery = false;
switch (_state){
case VideoState.SEEKING:
case VideoState.REWINDING:
_httpDoSeekCount = 0;
_httpDoSeekTimer.start();
break;
};
break;
case "NetStream.Play.StreamNotFound":
case "NetStream.Play.FileStructureInvalid":
case "NetStream.Play.NoSupportedTrackFound":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
flvplayback_internal function httpDoSeek(_arg1:TimerEvent):void{
var _local2:Boolean = (((_state == VideoState.REWINDING)) || ((_state == VideoState.SEEKING)));
if (((((_local2) && ((_httpDoSeekCount < httpDoSeekMaxCount)))) && ((((_cachedPlayheadTime == playheadTime)) || (_invalidSeekTime))))){
_httpDoSeekCount++;
return;
};
_httpDoSeekCount = 0;
_httpDoSeekTimer.reset();
if (!_local2){
return;
};
setStateFromCachedState(false);
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
seek(playheadTime);
} else {
doUpdateTime();
_lastSeekTime = playheadTime;
execQueuedCmds();
};
}
override public function set height(_arg1:Number):void{
super.height = (_registrationHeight = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.height = _arg1;
break;
};
}
public function get bytesLoaded():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MIN_VALUE);
};
return (_ns.bytesLoaded);
}
public function set bufferTime(_arg1:Number):void{
_bufferTime = _arg1;
if (_ns != null){
_ns.bufferTime = _bufferTime;
};
}
public function get netConnection():NetConnection{
if (_ncMgr != null){
return (_ncMgr.netConnection);
};
return (null);
}
flvplayback_internal function onMetaData(_arg1:Object):void{
if (_metadata != null){
return;
};
_metadata = _arg1;
if (isNaN(_streamLength)){
_streamLength = _arg1.duration;
};
if (((_resizeImmediatelyOnMetadata) && (_ns.client.ready))){
_resizeImmediatelyOnMetadata = false;
_autoResizeTimer.reset();
_autoResizeDone = false;
doAutoResize();
};
dispatchEvent(new MetadataEvent(MetadataEvent.METADATA_RECEIVED, false, false, _arg1));
}
flvplayback_internal function queueCmd(_arg1:Number, _arg2:String=null, _arg3:Boolean=false, _arg4:Number=NaN):void{
_cmdQueue.push(new QueuedCommand(_arg1, _arg2, _arg3, _arg4));
}
public function seek(_arg1:Number):void{
if (_invalidSeekTime){
return;
};
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
if (((_atEnd) && ((_arg1 < playheadTime)))){
_atEnd = false;
};
switch (_state){
case VideoState.PLAYING:
_state = VideoState.BUFFERING;
case VideoState.BUFFERING:
case VideoState.PAUSED:
_seek(_arg1);
setState(VideoState.SEEKING);
break;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
_play(0);
_pause(true);
};
_seek(_arg1);
_state = VideoState.PAUSED;
setState(VideoState.SEEKING);
break;
};
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
override public function get visible():Boolean{
if (!_hiddenForResize){
__visible = super.visible;
};
return (__visible);
}
public function get registrationWidth():Number{
return (_registrationWidth);
}
public function get state():String{
return (_state);
}
public function set autoRewind(_arg1:Boolean):void{
_autoRewind = _arg1;
}
override public function set scaleX(_arg1:Number):void{
super.scaleX = _arg1;
_registrationWidth = width;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
override public function set scaleY(_arg1:Number):void{
super.scaleY = _arg1;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
flvplayback_internal function flushQueuedCmds():void{
while (_cmdQueue.length > 0) {
_cmdQueue.pop();
};
}
public function get registrationX():Number{
return (_registrationX);
}
flvplayback_internal function _setUpStream():void{
if (((!(isNaN(_ncMgr.streamLength))) && ((_ncMgr.streamLength >= 0)))){
_streamLength = _ncMgr.streamLength;
};
_videoWidth = ((_ncMgr.streamWidth)>=0) ? _ncMgr.streamWidth : -1;
_videoHeight = ((_ncMgr.streamHeight)>=0) ? _ncMgr.streamHeight : -1;
_resizeImmediatelyOnMetadata = (((((_videoWidth >= 0)) && ((_videoHeight >= 0)))) || ((_scaleMode == VideoScaleMode.EXACT_FIT)));
if (!_hiddenForResize){
__visible = super.visible;
super.visible = false;
_volume = volume;
volume = 0;
_hiddenForResize = true;
};
_hiddenForResizeMetadataDelay = 0;
_play(0);
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
_autoResizeTimer.reset();
_autoResizeTimer.start();
}
public function get registrationY():Number{
return (_registrationY);
}
flvplayback_internal function httpDoStopAtEnd():void{
if ((((((_atEndCheckPlayhead == playheadTime)) && (!((_atEndCheckPlayhead == _lastUpdateTime))))) && (!((playheadTime == 0))))){
_atEnd = false;
_seek(0);
return;
};
_atEndCheckPlayhead = NaN;
_atEnd = true;
if (isNaN(_streamLength)){
_streamLength = _ns.time;
};
_pause(true);
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (_autoRewind){
_atEnd = false;
_pause(true);
_seek(0);
setState(VideoState.REWINDING);
};
}
public function ncConnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
if (_ns == null){
_createStream();
_setUpStream();
};
};
}
override public function set visible(_arg1:Boolean):void{
__visible = _arg1;
if (!_hiddenForResize){
super.visible = __visible;
};
}
public function get idleTimeout():Number{
return (_idleTimeoutTimer.delay);
}
public function get playheadUpdateInterval():Number{
return (_updateTimeTimer.delay);
}
override public function set y(_arg1:Number):void{
var _local2:Number;
if (this.y != _arg1){
_local2 = (_arg1 - this.y);
super.y = _arg1;
_registrationY = (_registrationY + _local2);
};
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 == null){
throw (new VideoError(VideoError.NULL_URL_LOAD));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.LOAD, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = false;
_load(_arg1, _arg2, _arg3);
}
override public function set x(_arg1:Number):void{
var _local2:Number;
if (this.x != _arg1){
_local2 = (_arg1 - this.x);
super.x = _arg1;
_registrationX = (_registrationX + _local2);
};
}
flvplayback_internal function doDelayedBuffering(_arg1:TimerEvent):void{
switch (_state){
case VideoState.LOADING:
case VideoState.RESIZING:
break;
case VideoState.PLAYING:
_delayedBufferingTimer.reset();
if (((((((((!(isNaN(totalTime))) && ((totalTime > 0)))) && ((bytesLoaded > 0)))) && ((bytesLoaded < uint.MAX_VALUE)))) && ((bytesLoaded < bytesTotal)))){
pause();
if (_state == VideoState.PAUSED){
waitingForEnough = true;
playWhenEnoughDownloaded();
};
} else {
setState(VideoState.BUFFERING);
};
break;
default:
_delayedBufferingTimer.reset();
break;
};
}
flvplayback_internal function _pause(_arg1:Boolean):void{
_atEndCheckPlayhead = playheadTime;
_rtmpDoStopAtEndTimer.reset();
if (_arg1){
_ns.pause();
} else {
_ns.resume();
};
}
flvplayback_internal function createNetStreamClient():Object{
var theClass:Class;
var theInst:Object;
try {
if ((netStreamClientClass is String)){
theClass = Class(getDefinitionByName(String(netStreamClientClass)));
} else {
if ((netStreamClientClass is Class)){
theClass = Class(netStreamClientClass);
};
};
if (theClass != null){
theInst = new theClass(this);
};
} catch(e:Error) {
theClass = null;
theInst = null;
};
if (theInst == null){
throw (new VideoError(VideoError.NETSTREAM_CLIENT_CLASS_UNSET, ((netStreamClientClass)==null) ? "null" : netStreamClientClass.toString()));
};
return (theInst);
}
public function get align():String{
return (_align);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
public function get soundTransform():SoundTransform{
if (_ns != null){
_soundTransform = _ns.soundTransform;
};
var _local1:SoundTransform = new SoundTransform();
_local1.volume = (_hiddenForResize) ? _volume : _soundTransform.volume;
_local1.leftToLeft = _soundTransform.leftToLeft;
_local1.leftToRight = _soundTransform.leftToRight;
_local1.rightToLeft = _soundTransform.rightToLeft;
_local1.rightToRight = _soundTransform.rightToRight;
return (_local1);
}
public function get volume():Number{
return (soundTransform.volume);
}
public function get stateResponsive():Boolean{
switch (_state){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
return (true);
default:
return (false);
};
}
public function get bufferTime():Number{
if (_ns != null){
_bufferTime = _ns.bufferTime;
};
return (_bufferTime);
}
public function get metadata():Object{
return (_metadata);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 != null){
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.PLAY, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = true;
_load(_arg1, _arg2, _arg3);
return;
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.PLAY);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
switch (_state){
case VideoState.BUFFERING:
if (_ncMgr.isRTMP){
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
};
};
case VideoState.PLAYING:
return;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
if (_isLive){
_play(-1);
setState(VideoState.BUFFERING);
} else {
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
setState(VideoState.BUFFERING);
} else {
setState(VideoState.BUFFERING);
};
};
};
} else {
_pause(false);
if (_atEnd){
_atEnd = false;
_seek(0);
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
};
};
break;
case VideoState.PAUSED:
_pause(false);
if (!_ncMgr.isRTMP){
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
} else {
setState(VideoState.BUFFERING);
};
break;
};
}
public function get isLive():Boolean{
return (_isLive);
}
flvplayback_internal function setStateFromCachedState(_arg1:Boolean=true):void{
switch (_cachedState){
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
setState(_cachedState, _arg1);
break;
default:
setState(VideoState.STOPPED, _arg1);
break;
};
}
public function ncReconnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
_ns = null;
_state = VideoState.STOPPED;
execQueuedCmds();
};
}
public function get registrationHeight():Number{
return (_registrationHeight);
}
public function get autoRewind():Boolean{
return (_autoRewind);
}
flvplayback_internal function startAutoResize():void{
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
return;
default:
if (_ns == null){
return;
};
_autoResizeDone = false;
if (((stateResponsive) && (((((((((!((super.videoWidth == 0))) || (!((super.videoHeight == 0))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))))){
doAutoResize();
} else {
_autoResizeTimer.reset();
_autoResizeTimer.start();
};
break;
};
}
flvplayback_internal function setState(_arg1:String, _arg2:Boolean=true):void{
if (_arg1 == _state){
return;
};
_hiddenRewindPlayheadTime = NaN;
_cachedState = _state;
_cachedPlayheadTime = playheadTime;
_state = _arg1;
var _local3:String = _state;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local3, playheadTime));
if (!_readyDispatched){
switch (_local3){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
_readyDispatched = true;
dispatchEvent(new VideoEvent(VideoEvent.READY, false, false, _local3, playheadTime));
break;
};
};
switch (_cachedState){
case VideoState.REWINDING:
dispatchEvent(new VideoEvent(VideoEvent.AUTO_REWOUND, false, false, _local3, playheadTime));
if (((_ncMgr.isRTMP) && ((_local3 == VideoState.STOPPED)))){
closeNS();
};
break;
};
switch (_local3){
case VideoState.STOPPED:
case VideoState.PAUSED:
if (_ncMgr.isRTMP){
_idleTimeoutTimer.reset();
_idleTimeoutTimer.start();
};
break;
case VideoState.SEEKING:
case VideoState.REWINDING:
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_idleTimeoutTimer.reset();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
_updateTimeTimer.start();
_idleTimeoutTimer.reset();
break;
case VideoState.LOADING:
case VideoState.RESIZING:
_idleTimeoutTimer.reset();
break;
};
if (_arg2){
execQueuedCmds();
};
}
flvplayback_internal function _seek(_arg1:Number):void{
_rtmpDoStopAtEndTimer.reset();
if (((((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))) && (((isNaN(_streamLength)) || (((_arg1 + _metadata.audiodelay) < _streamLength)))))){
_arg1 = (_arg1 + _metadata.audiodelay);
};
_ns.seek(_arg1);
_lastSeekTime = _arg1;
_invalidSeekTime = false;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_sawSeekNotify = false;
}
flvplayback_internal function doIdleTimeout(_arg1:TimerEvent):void{
close();
}
public function playWhenEnoughDownloaded():void{
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
play();
return;
};
if (!isXnOK()){
throw (new VideoError(VideoError.NO_CONNECTION));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY_WHEN_ENOUGH);
return;
};
execQueuedCmds();
};
waitingForEnough = true;
checkReadyForPlay(bytesLoaded, bytesTotal);
}
flvplayback_internal function rtmpDoSeek(_arg1:TimerEvent):void{
if (((!((_state == VideoState.REWINDING))) && (!((_state == VideoState.SEEKING))))){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
} else {
if (playheadTime != _cachedPlayheadTime){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
setStateFromCachedState(false);
doUpdateTime();
_lastSeekTime = playheadTime;
execQueuedCmds();
};
};
}
public function get netStream():NetStream{
return (_ns);
}
public function set registrationX(_arg1:Number):void{
var _local2:Number;
if (_registrationX != _arg1){
_local2 = (_arg1 - _registrationX);
_registrationX = _arg1;
this.x = (this.x + _local2);
};
}
flvplayback_internal function doUpdateProgress(_arg1:TimerEvent):void{
if (_ns == null){
return;
};
var _local2:uint = _ns.bytesLoaded;
var _local3:uint = _ns.bytesTotal;
if (_local3 < uint.MAX_VALUE){
dispatchEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, _local2, _local3));
};
if ((((((_state == VideoState.DISCONNECTED)) || ((_state == VideoState.CONNECTION_ERROR)))) || ((_local2 >= _local3)))){
_updateProgressTimer.stop();
};
checkEnoughDownloaded(_local2, _local3);
}
public function set registrationY(_arg1:Number):void{
var _local2:Number;
if (_registrationY != _arg1){
_local2 = (_arg1 - _registrationY);
_registrationY = _arg1;
this.y = (this.y + _local2);
};
}
override public function get videoHeight():int{
if (_videoHeight > 0){
return (_videoHeight);
};
if (((((!((_metadata == null))) && (!(isNaN(_metadata.width))))) && (!(isNaN(_metadata.height))))){
if ((((_metadata.width == _metadata.height)) && (_readyDispatched))){
return (super.videoHeight);
};
return (int(_metadata.height));
};
if (_readyDispatched){
return (super.videoHeight);
};
return (-1);
}
public function setSize(_arg1:Number, _arg2:Number):void{
super.width = (_registrationWidth = _arg1);
super.height = (_registrationHeight = _arg2);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
public function get isRTMP():Boolean{
if (_ncMgr == null){
return (false);
};
return (_ncMgr.isRTMP);
}
override public function set width(_arg1:Number):void{
super.width = (_registrationWidth = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.width = _arg1;
break;
};
}
public function get bytesTotal():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MAX_VALUE);
};
return (_ns.bytesTotal);
}
flvplayback_internal function isXnOK():Boolean{
if (_state == VideoState.LOADING){
return (true);
};
if (_state == VideoState.CONNECTION_ERROR){
return (false);
};
if (_state != VideoState.DISCONNECTED){
if ((((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))) || (((_ncMgr.isRTMP) && (!(_ncMgr.netConnection.connected)))))){
setState(VideoState.DISCONNECTED);
return (false);
};
return (true);
};
return (false);
}
flvplayback_internal function _createStream():void{
_ns = null;
var _local1:NetStream = new NetStream(_ncMgr.netConnection);
if (_ncMgr.isRTMP){
_local1.addEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
} else {
_local1.addEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
};
_local1.client = createNetStreamClient();
_local1.bufferTime = _bufferTime;
_local1.soundTransform = soundTransform;
_ns = _local1;
attachNetStream(_ns);
}
flvplayback_internal function checkReadyForPlay(_arg1:uint, _arg2:uint):void{
var _local3:Number;
if (_arg1 >= _arg2){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
return;
};
if (isNaN(baselineProgressTime)){
return;
};
if (((isNaN(totalTime)) || ((totalTime < 0)))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
} else {
if (totalDownloadTime > 1.5){
_local3 = ((totalProgressTime - baselineProgressTime) / totalDownloadTime);
if ((totalTime - playheadTime) > ((totalTime - totalProgressTime) / _local3)){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
};
};
}
flvplayback_internal function closeNS(_arg1:Boolean=false):void{
if (_ns != null){
if (_arg1){
doUpdateTime();
_currentPos = _ns.time;
};
_updateTimeTimer.reset();
_updateProgressTimer.reset();
_idleTimeoutTimer.reset();
_autoResizeTimer.reset();
_rtmpDoStopAtEndTimer.reset();
_rtmpDoSeekTimer.reset();
_httpDoSeekTimer.reset();
_finishAutoResizeTimer.reset();
_delayedBufferingTimer.reset();
_ns.removeEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
_ns.removeEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
_ns.close();
_ns = null;
};
}
public function set playheadUpdateInterval(_arg1:Number):void{
_updateTimeTimer.delay = _arg1;
}
flvplayback_internal function _load(_arg1:String, _arg2:Number, _arg3:Boolean):void{
_prevVideoWidth = super.videoWidth;
_prevVideoHeight = super.videoHeight;
_autoResizeDone = false;
_cachedPlayheadTime = 0;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_isLive = _arg3;
_contentPath = _arg1;
_currentPos = 0;
_streamLength = (((isNaN(_arg2)) || ((_arg2 <= 0)))) ? NaN : _arg2;
_atEnd = false;
_readyDispatched = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
_httpDoSeekCount = 0;
_updateTimeTimer.reset();
_updateProgressTimer.reset();
_idleTimeoutTimer.reset();
_autoResizeTimer.reset();
_rtmpDoStopAtEndTimer.reset();
_rtmpDoSeekTimer.reset();
_httpDoSeekTimer.reset();
_finishAutoResizeTimer.reset();
_delayedBufferingTimer.reset();
closeNS(false);
if (_ncMgr == null){
createINCManager();
};
var _local4:Boolean = _ncMgr.connectToURL(_contentPath);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
if (_local4){
_createStream();
_setUpStream();
};
if (!_ncMgr.isRTMP){
_updateProgressTimer.start();
};
}
flvplayback_internal function rtmpDoStopAtEnd(_arg1:TimerEvent=null):void{
if (_rtmpDoStopAtEndTimer.running){
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_rtmpDoStopAtEndTimer.reset();
return;
};
if ((((_arg1 == null)) || ((_cachedPlayheadTime == playheadTime)))){
_rtmpDoStopAtEndTimer.reset();
} else {
_cachedPlayheadTime = playheadTime;
return;
};
};
if ((((((((_atEndCheckPlayhead == playheadTime)) && (!((_atEndCheckPlayhead == _lastSeekTime))))) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0);
return;
};
_atEndCheckPlayhead = NaN;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_atEnd = true;
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (((((_autoRewind) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0, 0);
setState(VideoState.REWINDING);
} else {
closeNS();
};
}
public function set idleTimeout(_arg1:Number):void{
_idleTimeoutTimer.delay = _arg1;
}
flvplayback_internal function checkEnoughDownloaded(_arg1:uint, _arg2:uint):void{
if ((((_arg1 == 0)) || ((_arg2 == uint.MAX_VALUE)))){
return;
};
if (((isNaN(totalTime)) || ((totalTime <= 0)))){
if (((waitingForEnough) && (stateResponsive))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (_arg1 >= _arg2){
if (waitingForEnough){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (isNaN(baselineProgressTime)){
baselineProgressTime = ((_arg1 / _arg2) * totalTime);
};
if (isNaN(startProgressTime)){
startProgressTime = getTimer();
} else {
totalDownloadTime = ((getTimer() - startProgressTime) / 1000);
totalProgressTime = ((_arg1 / _arg2) * totalTime);
if (waitingForEnough){
checkReadyForPlay(_arg1, _arg2);
};
};
}
public function pause():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PAUSE);
return;
};
execQueuedCmds();
};
};
if ((((((_state == VideoState.PAUSED)) || ((_state == VideoState.STOPPED)))) || ((_ns == null)))){
return;
};
_pause(true);
setState(VideoState.PAUSED);
}
public function close():void{
closeNS(true);
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
_ncMgr.close();
};
setState(VideoState.DISCONNECTED);
dispatchEvent(new VideoEvent(VideoEvent.CLOSE, false, false, _state, playheadTime));
}
flvplayback_internal function execQueuedCmds():void{
var nextCmd:Object;
while ((((((_cmdQueue.length > 0)) && (((((stateResponsive) || ((_state == VideoState.DISCONNECTED)))) || ((_state == VideoState.CONNECTION_ERROR)))))) && (((!((_cmdQueue[0].url == null))) || (((!((_state == VideoState.DISCONNECTED))) && (!((_state == VideoState.CONNECTION_ERROR))))))))) {
try {
nextCmd = _cmdQueue.shift();
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
switch (nextCmd.type){
case QueuedCommand.PLAY:
play(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.LOAD:
load(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.PAUSE:
pause();
break;
case QueuedCommand.STOP:
stop();
break;
case QueuedCommand.SEEK:
seek(nextCmd.time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
playWhenEnoughDownloaded();
break;
};
} finally {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
};
};
};
}
}
}//package fl.video
Section 62
//VideoPlayerClient (fl.video.VideoPlayerClient)
package fl.video {
public dynamic class VideoPlayerClient {
protected var _owner:VideoPlayer;
protected var gotMetadata:Boolean;
public function VideoPlayerClient(_arg1:VideoPlayer){
_owner = _arg1;
gotMetadata = false;
}
public function get ready():Boolean{
return (gotMetadata);
}
public function get owner():VideoPlayer{
return (_owner);
}
public function onCuePoint(_arg1:Object, ... _args):void{
_arg1.name;
_arg1.time;
_arg1.type;
_owner.onCuePoint(_arg1);
}
public function onMetaData(_arg1:Object, ... _args):void{
_arg1.duration;
_arg1.width;
_arg1.height;
_owner.onMetaData(_arg1);
gotMetadata = true;
}
}
}//package fl.video
Section 63
//VideoPlayerState (fl.video.VideoPlayerState)
package fl.video {
public class VideoPlayerState {
public var autoPlay:Boolean;
public var isWaiting:Boolean;
public var isLiveSet:Boolean;
public var index:int;
public var prevState:String;
public var preSeekTime:Number;
public var minProgressPercent:Number;
public var url:String;
public var totalTimeSet:Boolean;
public var owner:VideoPlayer;
public var isLive:Boolean;
public var cmdQueue:Array;
public var totalTime:Number;
public function VideoPlayerState(_arg1:VideoPlayer, _arg2:int){
this.owner = _arg1;
this.index = _arg2;
this.url = "";
this.isLive = false;
this.isLiveSet = true;
this.totalTime = NaN;
this.totalTimeSet = true;
this.autoPlay = (_arg2 == 0);
this.isWaiting = false;
this.preSeekTime = NaN;
this.cmdQueue = null;
}
}
}//package fl.video
Section 64
//VideoProgressEvent (fl.video.VideoProgressEvent)
package fl.video {
import flash.events.*;
public class VideoProgressEvent extends ProgressEvent implements IVPEvent {
private var _vp:uint;
public static const PROGRESS:String = "progress";
public function VideoProgressEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
override public function clone():Event{
return (new VideoProgressEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, vp));
}
}
}//package fl.video
Section 65
//VideoScaleMode (fl.video.VideoScaleMode)
package fl.video {
public final class VideoScaleMode {
public static const EXACT_FIT:String = "exactFit";
public static const MAINTAIN_ASPECT_RATIO:String = "maintainAspectRatio";
public static const NO_SCALE:String = "noScale";
}
}//package fl.video
Section 66
//VideoState (fl.video.VideoState)
package fl.video {
public final class VideoState {
public static const CONNECTION_ERROR:String = "connectionError";
public static const BUFFERING:String = "buffering";
public static const SEEKING:String = "seeking";
public static const STOPPED:String = "stopped";
public static const PAUSED:String = "paused";
public static const RESIZING:String = "resizing";
public static const PLAYING:String = "playing";
public static const DISCONNECTED:String = "disconnected";
public static const LOADING:String = "loading";
public static const REWINDING:String = "rewinding";
flvplayback_internal static var EXEC_QUEUED_CMD:String = "execQueuedCmd";
}
}//package fl.video
Section 67
//VolumeBarAccImpl (fl.video.VolumeBarAccImpl)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.accessibility.*;
public class VolumeBarAccImpl extends AccessibilityImplementation {
protected var master:Sprite;
protected var role:uint;
private var _vc:FLVPlayback;
private static const ROLE_SYSTEM_INDICATOR:uint = 39;
private static const ROLE_SLIDER:uint = 51;
private static const STATE_SYSTEM_FOCUSABLE:uint = 0x100000;
private static const EVENT_OBJECT_SELECTION:uint = 32774;
private static const ROLE_SYSTEM_PUSHBUTTON:uint = 43;
private static const STATE_SYSTEM_FOCUSED:uint = 4;
private static const STATE_SYSTEM_SELECTABLE:uint = 0x200000;
private static const ROLE_WINDOW:uint = 9;
private static const EVENT_OBJECT_FOCUS:uint = 32773;
private static const STATE_SYSTEM_SELECTED:uint = 2;
private static const EVENT_OBJECT_VALUECHANGE:uint = 32782;
private static const EVENT_OBJECT_LOCATIONCHANGE:uint = 32779;
private static const STATE_SYSTEM_NORMAL:uint = 0;
private static const STATE_SYSTEM_UNAVAILABLE:uint = 1;
public function VolumeBarAccImpl(_arg1:Sprite){
var n:int;
var i:int;
var sprite = _arg1;
super();
stub = false;
master = sprite;
if (!master.accessibilityProperties){
master.accessibilityProperties = new AccessibilityProperties();
};
master.accessibilityProperties.forceSimple = true;
var events:Array = eventsToHandle;
if (events){
n = events.length;
i = 0;
while (i < n) {
master.addEventListener(events[i], eventHandler);
i = (i + 1);
};
};
master.addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
try {
_vc = Object(master).uiMgr._vc;
_vc.addEventListener(SoundEvent.SOUND_UPDATE, eventHandler);
} catch(e:Error) {
};
role = VolumeBarAccImpl.ROLE_SLIDER;
}
override public function get_accState(_arg1:uint):uint{
var _local2:uint = getState(_arg1);
return (_local2);
}
protected function getName(_arg1:uint):String{
var _local2 = "";
switch (_arg1){
case 1:
_local2 = "Page Left";
break;
case 2:
_local2 = "Position";
break;
case 3:
_local2 = "Page Right";
break;
case 0:
_local2 = "";
break;
};
return (_local2);
}
override public function get_accName(_arg1:uint):String{
var _local2 = "";
if ((((((((_arg1 == 0)) && (master.accessibilityProperties))) && (master.accessibilityProperties.name))) && (!((master.accessibilityProperties.name == ""))))){
_local2 = (_local2 + (master.accessibilityProperties.name + " "));
};
_local2 = (_local2 + (getName(_arg1) + getStatusName()));
return ((((!((_local2 == null))) && (!((_local2 == ""))))) ? _local2 : null);
}
override public function get_accDefaultAction(_arg1:uint):String{
if ((((_arg1 == 1)) || ((_arg1 == 3)))){
return ("Press");
};
return (null);
}
protected function getState(_arg1:uint):uint{
var _local2:uint = STATE_SYSTEM_NORMAL;
if (_arg1 == 0){
if (((!(master.mouseEnabled)) || (!(master.tabEnabled)))){
_local2 = (_local2 | STATE_SYSTEM_UNAVAILABLE);
} else {
_local2 = (_local2 | STATE_SYSTEM_FOCUSABLE);
};
if (Sprite(master).stage.focus == master){
_local2 = (_local2 | STATE_SYSTEM_FOCUSED);
};
};
return (_local2);
}
override public function accDoDefaultAction(_arg1:uint):void{
var _local2:UIManager = (_vc.uiMgr as UIManager);
var _local3:Boolean = _local2._isMuted;
var _local4:Number = (_local3) ? (Math.round((_local2.cachedSoundLevel * 1000)) / 100) : (Math.round((_vc.volume * 1000)) / 100);
if (_arg1 == 1){
if (Math.floor(_local4) != _local4){
_vc.volume = (Math.floor(_local4) / 10);
} else {
_vc.volume = Math.max(0, ((_local4 - 1) / 10));
};
} else {
if (_arg1 == 3){
if (Math.round(_local4) != _local4){
_vc.volume = (Math.round(_local4) / 10);
} else {
_vc.volume = Math.min(1, ((_local4 + 1) / 10));
};
};
};
_local2.cachedSoundLevel = _vc.volume;
if (_local3){
_local2._isMuted = true;
_local2.cachedSoundLevel = _vc.volume;
_vc.volume = 0;
_local2.setEnabledAndVisibleForState(UIManager.MUTE_OFF_BUTTON, VideoState.PLAYING);
_local2.skinButtonControl(_local2.controls[UIManager.MUTE_OFF_BUTTON]);
_local2.setEnabledAndVisibleForState(UIManager.MUTE_ON_BUTTON, VideoState.PLAYING);
_local2.skinButtonControl(_local2.controls[UIManager.MUTE_ON_BUTTON]);
};
}
private function focusInHandler(_arg1:Event):void{
if (Accessibility.active){
Accessibility.sendEvent(master, 0, EVENT_OBJECT_FOCUS);
Accessibility.sendEvent(master, 0, EVENT_OBJECT_VALUECHANGE, true);
};
}
override public function get_accRole(_arg1:uint):uint{
if (_arg1 == 0){
return (role);
};
if (_arg1 == 2){
return (ROLE_SYSTEM_INDICATOR);
};
return (ROLE_SYSTEM_PUSHBUTTON);
}
protected function eventHandler(_arg1:Event):void{
if (_arg1.type == SoundEvent.SOUND_UPDATE){
if (Accessibility.active){
Accessibility.sendEvent(master, 0, EVENT_OBJECT_SELECTION);
Accessibility.sendEvent(master, 0, EVENT_OBJECT_VALUECHANGE, true);
};
};
}
override public function get_accValue(_arg1:uint):String{
var _local2:Number;
if (_arg1 == 0){
_local2 = (Math.round((_vc.volume * 10000)) / 100);
return ((String(_local2) + "%"));
};
return (null);
}
private function getStatusName():String{
return ("");
}
protected function get eventsToHandle():Array{
return ([]);
}
override public function accLocation(_arg1:uint){
var _local7:DisplayObject;
var _local2:Object = master;
var _local3:UIManager = (_vc.uiMgr as UIManager);
var _local4:DisplayObject = (_local3.controls[UIManager.VOLUME_BAR] as DisplayObject);
var _local5:Dictionary = (UIManager(_local3).ctrlDataDict as Dictionary);
var _local6:ControlData = _local5[_local4];
if (_local5[_local6.fullness_mc].mask_mc){
_local7 = DisplayObject(_local5[_local6.fullness_mc].mask_mc);
};
switch (_arg1){
case 1:
case 3:
if (_local7){
_local2 = _local7;
};
break;
default:
break;
};
return (_local2);
}
override public function getChildIDArray():Array{
var _local1:Array = [];
var _local2:uint;
while (_local2 < 3) {
_local1[_local2] = (_local2 + 1);
_local2++;
};
return (_local1);
}
public static function createAccessibilityImplementation(_arg1:Sprite):void{
_arg1.accessibilityImplementation = new VolumeBarAccImpl(_arg1);
}
public static function enableAccessibility():void{
}
}
}//package fl.video
Section 68
//BaddieWalking (game.activeobjects.enemies.BaddieWalking)
package game.activeobjects.enemies {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import sound.*;
import caurina.transitions.*;
import game.activeobjects.*;
import events.*;
import game.activeobjects.objects.*;
import config.*;
import caurina.transitions.properties.*;
import game.view.*;
public class BaddieWalking extends MovieClip {
protected const DEFAULT_SPEED:Number = 1.5;
protected const LABEL_ATTACK:String = "attack";
protected const STATE_BOUNCE:int = 2;
protected const STATE_DIE:int = 3;
protected const FRAMES_AMOUNT_DIE:int = 22;
protected const DEFAULT_DAMAGE:Number = 0.1;
protected const LABEL_BOUNCE:String = "bounce";
protected const STATE_ATTACK:int = 1;
protected const STATE_WALK:int = 0;
protected const LABEL_MOVE:String = "move";
protected const DEFAULT_ENERGY:int = 30;
protected const PROTECTION_TIME:int = 5;
protected const LABEL_DIE:String = "die";
protected var m_gridX:int;
protected var m_gridY:int;
protected var m_speedY:Number;
protected var m_hero:Hero;
protected var m_damage:Number;
protected var m_protectionCounter:int;// = 0
protected var m_posY:Number;
protected var m_posX:Number;
protected var m_energy:int;
protected var m_bounceDir:int;
protected var m_shotsList:Array;
protected var m_counter:int;
protected var m_label:String;
protected var m_controlLeft:int;
protected var m_walkSpeed:Number;
protected var m_dir:int;
protected var m_state:int;
protected var m_attackTime:int;
protected var m_controlRight:int;
protected var m_isDestroyed:Boolean;// = false
public var m_mcAnim:MovieClip;
protected var m_groundY:Number;
protected var m_dieFrames:int;
protected var m_speed:Number;
protected var m_bombsList:Array;
public static const EVENT_ON_SCREEN:String = "onBaddieOnScreen";
public static const DIR_LEFT:int = -1;
public static const DIR_RIGHT:int = 1;
public function BaddieWalking(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int, _arg6:Hero){
stop();
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_groundY = m_posY;
m_dir = _arg5;
m_controlLeft = ((_arg3 + 0.5) * View.TILE_SIZE);
m_controlRight = ((_arg4 + 0.5) * View.TILE_SIZE);
m_damage = DEFAULT_DAMAGE;
m_energy = DEFAULT_ENERGY;
m_walkSpeed = DEFAULT_SPEED;
m_speed = m_walkSpeed;
m_hero = _arg6;
m_state = STATE_WALK;
m_dieFrames = FRAMES_AMOUNT_DIE;
m_shotsList = new Array();
m_bombsList = new Array();
ColorShortcuts.init();
draw();
}
public function get posY():Number{
return (m_posY);
}
public function draw():void{
scaleX = m_dir;
x = m_posX;
y = m_posY;
m_mcAnim.nextFrame();
if ((((m_state == STATE_WALK)) || ((m_state == STATE_BOUNCE)))){
setLabel(LABEL_MOVE);
} else {
if (m_state == STATE_ATTACK){
setLabel(LABEL_ATTACK);
} else {
if (m_state == STATE_DIE){
setLabel(LABEL_DIE);
};
};
};
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
m_mcAnim.stop();
delete ??getglobalscope
[this];
}
protected function bounceBack():void{
if ((((m_state == STATE_ATTACK)) && (m_mcAnim.m_doBody))){
m_posY = (m_posY + m_mcAnim.m_doBody.y);
};
m_speed = m_walkSpeed;
m_state = STATE_BOUNCE;
var _local1:int = (m_hero.posX - m_posX);
m_bounceDir = ((_local1 > 0)) ? DIR_LEFT : DIR_RIGHT;
m_speedY = -3;
}
protected function checkBorders():void{
if (m_state == STATE_WALK){
if (m_posX < m_controlLeft){
m_dir = DIR_RIGHT;
} else {
if (m_posX > m_controlRight){
m_dir = DIR_LEFT;
};
};
};
}
public function get destroyed():Boolean{
return (m_isDestroyed);
}
protected function checkCollisionWithHero():void{
if (m_state == STATE_ATTACK){
checkCollisionWhenAttack();
} else {
if (m_state == STATE_WALK){
if (((m_hero.isSlideAttack()) && (hitTestObject(m_hero.m_doHitArea)))){
getDamage(Hero.DAMAGE_SLIDE);
} else {
if (!m_hero.isProtected()){
if (hitTestObject(m_hero.m_doHitArea)){
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, (m_damage * 0.5), HeroEvent.SIDE_BOTTOM));
};
};
};
};
};
}
protected function checkAttackZone():void{
}
public function setBombs(_arg1:Array):void{
m_bombsList = _arg1;
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local7:ShotHero;
var _local8:Point;
var _local9:int;
if (m_state == STATE_DIE){
m_counter--;
if (m_counter <= 0){
m_isDestroyed = true;
remove();
};
return;
};
var _local5:int;
while (_local5 < m_shotsList.length) {
_local7 = (m_shotsList[_local5] as ShotHero);
_local8 = new Point();
_local8 = _local7.localToGlobal(_local8);
globalToLocal(_local8);
if (hitTestPoint(_local8.x, _local8.y, true)){
_local7.remove();
getDamage(ShotHero.DAMAGE);
_local9 = ((m_posX - m_hero.posX) * m_dir);
if ((((((((m_state == STATE_WALK)) && ((_local9 > 0)))) && ((m_posX > m_controlLeft)))) && ((m_posX < m_controlRight)))){
m_dir = -(m_dir);
};
};
_local5++;
};
if (m_protectionCounter > 0){
m_protectionCounter--;
};
if (m_state == STATE_BOUNCE){
m_posX = (m_posX + ((2 * m_speed) * m_bounceDir));
m_posY = (m_posY + m_speedY);
m_speedY = (m_speedY + Config.GRAVITY);
if (m_posY > m_groundY){
m_posY = m_groundY;
m_speed = m_walkSpeed;
m_state = STATE_WALK;
};
};
m_posX = (m_posX + (m_dir * m_speed));
checkBorders();
if (m_state == STATE_WALK){
if (m_counter > 0){
m_counter--;
} else {
checkAttackZone();
};
} else {
if (m_state == STATE_ATTACK){
stepStateAttack();
};
};
_local9 = ((m_posX - m_hero.posX) * m_hero.dir);
var _local6:int = Math.abs((m_hero.posY - m_posY));
if ((((((_local9 > 0)) && ((_local9 < 60)))) && ((_local6 < 30)))){
dispatchEvent(new HeroEvent(HeroEvent.ENEMY_CLOSE));
};
if ((((((((m_posX > (_arg1 + (1 * View.TILE_SIZE)))) && ((m_posX < (_arg3 * View.TILE_SIZE))))) && ((m_posY > (_arg2 * View.TILE_SIZE))))) && ((m_posY < (_arg4 * View.TILE_SIZE))))){
checkCollisionWithHero();
dispatchEvent(new Event(EVENT_ON_SCREEN));
};
}
protected function setLabel(_arg1:String):void{
if (m_label != _arg1){
m_label = _arg1;
gotoAndStop(m_label);
};
}
protected function stepStateAttack():void{
}
public function get posX():Number{
return (m_posX);
}
protected function getDamage(_arg1:int):void{
if (m_protectionCounter <= 0){
m_protectionCounter = PROTECTION_TIME;
m_energy = (m_energy - _arg1);
if (m_energy <= 0){
_arg1 = (_arg1 + m_energy);
m_state = STATE_DIE;
m_counter = m_dieFrames;
SoundManager.getInstance().playSound(SoundConfig.SFX_BADDIE_DESTROYED);
} else {
Tweener.addTween(this, {_brightness:1, time:0.1});
Tweener.addTween(this, {_brightness:0, time:0.1, delay:0.1});
};
dispatchEvent(new HeroEvent(HeroEvent.HIT_ENEMY, _arg1));
};
}
protected function checkCollisionWhenAttack():void{
}
public function setShots(_arg1:Array):void{
m_shotsList = _arg1;
}
}
}//package game.activeobjects.enemies
Section 69
//SickCloud (game.activeobjects.enemies.SickCloud)
package game.activeobjects.enemies {
import flash.utils.*;
import game.activeobjects.*;
import events.*;
public class SickCloud extends BaddieWalking {
private const FRAMES_AMOUNT_ATTACK:int = 83;
private const DELAY_BETWEEN_ATTACKS:int = 30;
private const DAMAGE:Number = 0.2;
public static const ENERGY:int = 150;
public function SickCloud(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int, _arg6:Hero){
addFrameScript(29, frame30);
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
m_energy = ENERGY;
m_damage = DAMAGE;
m_dieFrames = 53;
}
override public function draw():void{
super.draw();
if ((((((m_state == STATE_ATTACK)) && (m_mcAnim))) && (m_mcAnim.mcBelch))){
m_mcAnim.mcBelch.nextFrame();
};
}
override protected function checkCollisionWhenAttack():void{
var _local1:int;
if (m_mcAnim.mcBelch){
if (m_mcAnim.mcBelch.hitTestObject(m_hero.m_doHitArea)){
if (!m_hero.isProtected()){
if (m_hero.isSlideAttack()){
_local1 = (m_dir * (m_hero.posX - m_posX));
if (_local1 < 0){
getDamage(Hero.DAMAGE_SLIDE);
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, m_damage, HeroEvent.SIDE_BOTTOM));
};
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, m_damage, HeroEvent.SIDE_BOTTOM));
};
};
};
};
if (m_mcAnim.mcBelch){
m_mcAnim.mcBelch.visible = false;
};
if (hitTestObject(m_hero.m_doHitArea)){
if (!m_hero.isProtected()){
if (m_hero.isSlideAttack()){
_local1 = (m_dir * (m_hero.posX - m_posX));
if (_local1 < 0){
getDamage(Hero.DAMAGE_SLIDE);
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, (m_damage * 0.5), HeroEvent.SIDE_BOTTOM));
};
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, (m_damage * 0.5), HeroEvent.SIDE_BOTTOM));
};
};
};
if (m_mcAnim.mcBelch){
m_mcAnim.mcBelch.visible = true;
};
}
function frame30(){
stop();
}
override protected function checkAttackZone():void{
var _local1:int = (m_dir * (m_hero.posX - m_posX));
var _local2:int = (m_posY - m_hero.posY);
if ((((((((_local1 > 0)) && ((_local1 < 150)))) && ((_local2 < 60)))) && ((_local2 > -5)))){
m_state = STATE_ATTACK;
m_counter = FRAMES_AMOUNT_ATTACK;
m_speed = 0;
m_attackTime = getTimer();
};
}
override protected function stepStateAttack():void{
m_counter--;
if (m_counter <= 0){
m_state = STATE_WALK;
m_counter = DELAY_BETWEEN_ATTACKS;
m_speed = m_walkSpeed;
};
}
}
}//package game.activeobjects.enemies
Section 70
//StormCloud (game.activeobjects.enemies.StormCloud)
package game.activeobjects.enemies {
import flash.utils.*;
import sound.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
public class StormCloud extends BaddieWalking {
private const DAMAGE:Number = 0.2;
public static const ENERGY:int = 80;
public function StormCloud(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int, _arg6:Hero){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
m_energy = ENERGY;
m_damage = DAMAGE;
m_dieFrames = 53;
var _local7:FrameScriptManager = new FrameScriptManager(this);
_local7.setFrameScript(LABEL_ATTACK, onFrameAttack);
}
private function onAttackFrameLoop():void{
SoundManager.getInstance().playSound(SoundConfig.SFX_THUNDER);
}
override protected function checkBorders():void{
if (m_posX < m_controlLeft){
m_dir = DIR_RIGHT;
} else {
if (m_posX > m_controlRight){
m_dir = DIR_LEFT;
};
};
}
private function onAttackFrameEndLoop():void{
m_state = STATE_WALK;
checkAttackZone();
if (m_state == STATE_ATTACK){
m_mcAnim.gotoAndStop("loop");
};
}
override protected function checkCollisionWithHero():void{
if (m_state == STATE_ATTACK){
checkCollisionWhenAttack();
};
}
override protected function checkAttackZone():void{
var _local1:int = (m_posX - m_hero.posX);
var _local2:int = (m_posY - m_hero.posY);
if ((((((((_local1 > -90)) && ((_local1 < 90)))) && ((_local2 < 0)))) && ((_local2 > -120)))){
m_state = STATE_ATTACK;
};
}
override protected function checkCollisionWhenAttack():void{
if (m_mcAnim.mcLightning){
if (!m_hero.isProtected()){
if (m_mcAnim.mcLightning.hitTestObject(m_hero.m_doHitArea)){
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, m_damage, HeroEvent.SIDE_BOTTOM));
};
};
};
}
private function onFrameAttack():void{
var _local1:FrameScriptManager = new FrameScriptManager(m_mcAnim);
_local1.setFrameScript("loop", onAttackFrameLoop);
_local1.setFrameScript("loop_end", onAttackFrameEndLoop);
}
}
}//package game.activeobjects.enemies
Section 71
//Item (game.activeobjects.items.Item)
package game.activeobjects.items {
import flash.display.*;
import flash.geom.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Item extends MovieClip {
protected var m_gridX:int;
protected var m_gridY:int;
protected var m_hero:Hero;
protected var m_posX:Number;
protected var m_posY:Number;
protected var m_type:int;
protected var m_isLocked:Boolean;
protected var m_isCollected:Boolean;
protected var m_point:Point;
public static const TYPE_LIFE:int = 5;
public static const TYPE_MARBLE_KEY:int = 2;
public static const TYPE_EXIT_KEY:int = 6;
public static const TYPE_SPECIAL_MARBLE:int = 1;
public static const TYPE_MARBLE:int = 0;
public static const TYPE_ENERGY:int = 4;
public static const TYPE_LEGO_BRICK:int = 3;
public static const TYPE_BONUS:int = 7;
public function Item(_arg1:int, _arg2:int, _arg3:Hero){
cacheAsBitmap = true;
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_point = new Point();
m_isCollected = false;
m_isLocked = false;
draw();
}
public function remove():void{
parent.removeChild(this);
stop();
dispatchEvent(new ItemEvent(ItemEvent.REMOVED, m_type, m_gridX, m_gridY));
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_isCollected){
nextFrame();
};
}
public function move(_arg1:int, _arg2:int):void{
m_posX = _arg1;
m_posY = _arg2;
m_gridX = int((m_posX / View.TILE_SIZE));
m_gridY = int((m_posY / View.TILE_SIZE));
}
public function get gridX():int{
return (m_gridX);
}
public function get gridY():int{
return (m_gridY);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (m_isCollected){
return;
};
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
if (!m_isLocked){
remove();
};
} else {
m_point.x = 0;
m_point.y = 0;
m_point = localToGlobal(m_point);
if (m_hero.hitTestPoint(m_point.x, m_point.y)){
dispatchEvent(new ItemEvent(ItemEvent.COLLECTED, m_type, m_gridX, m_gridY));
onCollected();
};
};
}
protected function onCollected():void{
m_isCollected = true;
remove();
}
public function lock():void{
m_isLocked = true;
}
}
}//package game.activeobjects.items
Section 72
//ItemBonus (game.activeobjects.items.ItemBonus)
package game.activeobjects.items {
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemBonus extends Item {
public function ItemBonus(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_BONUS;
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 73
//ItemDoorKey (game.activeobjects.items.ItemDoorKey)
package game.activeobjects.items {
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemDoorKey extends Item {
public function ItemDoorKey(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_EXIT_KEY;
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 74
//ItemEnergy (game.activeobjects.items.ItemEnergy)
package game.activeobjects.items {
import game.activeobjects.*;
public class ItemEnergy extends Item {
public function ItemEnergy(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3);
m_type = TYPE_ENERGY;
}
override protected function onCollected():void{
remove();
}
}
}//package game.activeobjects.items
Section 75
//ItemLegoBrick (game.activeobjects.items.ItemLegoBrick)
package game.activeobjects.items {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
public class ItemLegoBrick extends Item {
public var m_mcBrick:MovieClip;
public function ItemLegoBrick(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_LEGO_BRICK;
m_mcBrick.gotoAndStop((1 + ((_arg1 + _arg2) % 5)));
}
override public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (m_isCollected){
return;
};
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
if (!m_isLocked){
remove();
};
} else {
if (hitTestObject(m_hero.m_doHitArea)){
dispatchEvent(new ItemEvent(ItemEvent.COLLECTED, m_type, m_gridX, m_gridY));
onCollected();
};
};
}
private function onFrameOutEnd():void{
remove();
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
}
}//package game.activeobjects.items
Section 76
//ItemLife (game.activeobjects.items.ItemLife)
package game.activeobjects.items {
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemLife extends Item {
public function ItemLife(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_LIFE;
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 77
//ItemMarble (game.activeobjects.items.ItemMarble)
package game.activeobjects.items {
import flash.display.*;
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemMarble extends Item {
public var m_mcMarb:MovieClip;
public function ItemMarble(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_MARBLE;
m_mcMarb.gotoAndStop((1 + ((_arg1 + _arg2) % 5)));
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 78
//ItemMarbleKey (game.activeobjects.items.ItemMarbleKey)
package game.activeobjects.items {
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemMarbleKey extends Item {
public function ItemMarbleKey(_arg1:int, _arg2:int, _arg3:Hero){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_MARBLE_KEY;
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 79
//ItemSpecialMarble (game.activeobjects.items.ItemSpecialMarble)
package game.activeobjects.items {
import game.activeobjects.*;
import com.gskinner.utils.*;
public class ItemSpecialMarble extends Item {
private var m_id:int;
public function ItemSpecialMarble(_arg1:int, _arg2:int, _arg3:Hero, _arg4:int){
stop();
super(_arg1, _arg2, _arg3);
m_type = TYPE_SPECIAL_MARBLE;
m_id = _arg4;
}
public function get id():int{
return (m_id);
}
override protected function onCollected():void{
m_isCollected = true;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("out_end", onFrameOutEnd);
gotoAndPlay("out");
}
private function onFrameOutEnd():void{
remove();
}
}
}//package game.activeobjects.items
Section 80
//ItemSpecialMarble1 (game.activeobjects.items.ItemSpecialMarble1)
package game.activeobjects.items {
import game.activeobjects.*;
public class ItemSpecialMarble1 extends ItemSpecialMarble {
public function ItemSpecialMarble1(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3, 0);
}
}
}//package game.activeobjects.items
Section 81
//ItemSpecialMarble2 (game.activeobjects.items.ItemSpecialMarble2)
package game.activeobjects.items {
import game.activeobjects.*;
public class ItemSpecialMarble2 extends ItemSpecialMarble {
public function ItemSpecialMarble2(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3, 1);
}
}
}//package game.activeobjects.items
Section 82
//Acid (game.activeobjects.objects.Acid)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Acid extends MovieClip {
private const DAMAGE:Number = 0.5;
private var m_gridX:int;
private var m_gridY:int;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
public function Acid(_arg1:int, _arg2:int, _arg3:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
blendMode = BlendMode.HARDLIGHT;
gotoAndPlay((1 + int((totalFrames * Math.random()))));
draw();
}
public function remove():void{
parent.removeChild(this);
stop();
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
var _local7:int;
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (((m_hero.isProtected()) && (!(m_hero.isSeaHorse)))){
return;
};
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((Math.abs(_local5) < 16)) && ((Math.abs(_local6) < 16)))){
if (m_hero.isSeaHorse){
_local7 = 100;
if ((this is AcidTop)){
_local7 = (_local6 + 16);
};
m_hero.isInAcid(_local7);
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, DAMAGE, HeroEvent.SIDE_BOTTOM));
};
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
}
}
}//package game.activeobjects.objects
Section 83
//AcidBottom (game.activeobjects.objects.AcidBottom)
package game.activeobjects.objects {
import game.activeobjects.*;
public class AcidBottom extends Acid {
public function AcidBottom(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3);
}
}
}//package game.activeobjects.objects
Section 84
//AcidTop (game.activeobjects.objects.AcidTop)
package game.activeobjects.objects {
import game.activeobjects.*;
public class AcidTop extends Acid {
public function AcidTop(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3);
}
}
}//package game.activeobjects.objects
Section 85
//AlienCage (game.activeobjects.objects.AlienCage)
package game.activeobjects.objects {
import flash.display.*;
import flash.geom.*;
import sound.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
import game.view.*;
public class AlienCage extends MovieClip {
private const LABEL_OPEN:String = "open";
private const LABEL_COLLECT_END:String = "collect_end";
private const LABEL_COLLECT:String = "collect";
private const LABEL_LOOP_END:String = "loop_end";
private const LABEL_LOOP:String = "loop";
private var m_gridX:Number;
private var m_gridY:Number;
public var m_mcCage:MovieClip;
private var m_cageId:int;
protected var m_point:Point;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
private var m_isOpen:Boolean;
private var m_isCollected:Boolean;
public var m_mcAlien:MovieClip;
public static const EVENT_COLLECT_ALIEN:String = "onCollectAlien";
public function AlienCage(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Hero){
addFrameScript(38, frame39);
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_cageId = _arg3;
m_hero = _arg4;
m_isOpen = false;
m_isCollected = false;
m_point = new Point();
stop();
var _local5:FrameScriptManager = new FrameScriptManager(this);
_local5.setFrameScript(LABEL_LOOP_END, onFrameLoopEnd);
_local5.setFrameScript(LABEL_COLLECT_END, onFrameCollectEnd);
}
private function onFrameCollectEnd():void{
stop();
}
public function open():void{
m_isOpen = true;
gotoAndPlay(LABEL_OPEN);
SoundManager.getInstance().playSound(SoundConfig.SFX_DOOR_OPEN);
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function get posY():Number{
return (m_posY);
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_isOpen){
nextFrame();
};
}
function frame39(){
gotoAndStop("loop");
}
public function get isOpen():Boolean{
return (m_isOpen);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if ((((((((m_gridX > (_arg1 - 2))) && ((m_gridX < (_arg3 + 2))))) && ((m_gridY > (_arg2 - 1))))) && ((m_gridY < (_arg4 + 3))))){
visible = true;
if (((m_isOpen) && (!(m_isCollected)))){
m_point.x = 0;
m_point.y = 0;
m_point = localToGlobal(m_point);
if (m_hero.hitTestPoint(m_point.x, m_point.y)){
dispatchEvent(new ObjectEvent(EVENT_COLLECT_ALIEN, {gridX:m_gridX, gridY:m_gridY}));
m_isCollected = true;
gotoAndPlay(LABEL_COLLECT);
};
};
} else {
visible = false;
};
}
private function onFrameLoopEnd():void{
gotoAndStop(LABEL_LOOP);
}
public function get posX():Number{
return (m_posX);
}
public function isOnScreen(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Boolean{
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
return (true);
};
return (false);
}
}
}//package game.activeobjects.objects
Section 86
//AlienCageTrigger (game.activeobjects.objects.AlienCageTrigger)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class AlienCageTrigger extends MovieClip {
private const FRAMES_AMOUNT:int = 11;
private var m_gridX:Number;
private var m_gridY:Number;
private var m_isPressed:Boolean;// = false
private var m_hero:Hero;
private var m_cageId:int;
private var m_posX:Number;
private var m_posY:Number;
public function AlienCageTrigger(_arg1:int, _arg2:int, _arg3:Hero, _arg4:int){
cacheAsBitmap = true;
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_cageId = _arg4;
stop();
draw();
}
public function remove():void{
if (parent){
parent.removeChild(this);
};
stop();
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
if (((m_isPressed) && ((currentFrame < FRAMES_AMOUNT)))){
nextFrame();
if (currentFrame == FRAMES_AMOUNT){
stop();
dispatchEvent(new TriggerEvent(TriggerEvent.PRESSED, m_cageId));
};
};
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
if (m_isPressed){
return;
};
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
if (hitTestObject(m_hero.m_doHitArea)){
_local5 = (m_hero.posX - m_posX);
if ((((_local5 > -10)) && ((_local5 < 10)))){
m_isPressed = true;
gotoAndStop("press");
};
};
};
}
}
}//package game.activeobjects.objects
Section 87
//Brick (game.activeobjects.objects.Brick)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import game.view.*;
public class Brick extends MovieClip {
private const LABEL_CRUSH:String = "crush";
private const LABEL_END:String = "end";
private var m_gridX:Number;
private var m_gridY:Number;
private var m_hero:Hero;
private var m_posX:Number;
private var m_isDestroyed:Boolean;// = false
private var m_posY:Number;
public function Brick(_arg1:int, _arg2:int, _arg3:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
draw();
stop();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
private function onFrameEnd():void{
remove();
}
public function get destroyed():Boolean{
return (m_isDestroyed);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:FrameScriptManager;
if (m_isDestroyed){
return;
};
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (((hitTestObject(m_hero.m_doHitArea)) && ((m_hero.action == Hero.ACTION_ATTACK_SLIDE)))){
dispatchEvent(new BrickEvent(BrickEvent.CRUSH));
m_isDestroyed = true;
_local5 = new FrameScriptManager(this);
_local5.setFrameScript(LABEL_END, onFrameEnd);
gotoAndPlay(LABEL_CRUSH);
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
}
}
}//package game.activeobjects.objects
Section 88
//Brick2 (game.activeobjects.objects.Brick2)
package game.activeobjects.objects {
import game.activeobjects.*;
public class Brick2 extends Brick {
public function Brick2(_arg1:int, _arg2:int, _arg3:Hero){
super(_arg1, _arg2, _arg3);
}
}
}//package game.activeobjects.objects
Section 89
//Bumper (game.activeobjects.objects.Bumper)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Bumper extends MovieClip {
private const SPEED_X:Number = 0;
private const SPEED_Y:Number = -23;
private const FRAMES_AMOUNT:int = 15;
private var m_lastFrame:int;// = 1
private var m_gridY:Number;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
private var m_gridX:Number;
public function Bumper(_arg1:int, _arg2:int, _arg3:Hero){
addFrameScript(0, frame1);
cacheAsBitmap = true;
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
function frame1(){
stop();
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (((m_hero.isHurted) || ((m_hero.speedY < 0)))){
return;
};
if (hitTestObject(m_hero.m_doHitArea)){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((_local6 < 0)) && ((_local5 > -24)))) && ((_local5 < 24)))){
dispatchEvent(new BumperEvent(BumperEvent.BUMP, SPEED_X, SPEED_Y));
gotoAndStop(1);
m_lastFrame = FRAMES_AMOUNT;
};
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_lastFrame > 1){
if (currentFrame < m_lastFrame){
nextFrame();
} else {
gotoAndStop(1);
m_lastFrame = 1;
};
};
}
}
}//package game.activeobjects.objects
Section 90
//BumperDiagonal (game.activeobjects.objects.BumperDiagonal)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.*;
import game.view.*;
public class BumperDiagonal extends MovieClip {
private const SPEED_X:Number = 10;
private const SPEED_Y:Number = -20;
private const FRAMES_AMOUNT:int = 7;
private var m_gridY:Number;
private var m_hero:Hero;
public var m_doAnim:MovieClip;
private var m_posX:Number;
private var m_posY:Number;
private var m_gridX:Number;
private var m_lastFrame:int;// = 1
private var m_dir:int;
public function BumperDiagonal(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_dir = _arg3;
m_hero = _arg4;
if (m_dir == Game.TILE_DIR_LEFT){
gotoAndStop(2);
} else {
gotoAndStop(1);
};
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
m_doAnim.stop();
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_lastFrame > 1){
if (m_doAnim.currentFrame < m_lastFrame){
m_doAnim.nextFrame();
} else {
m_doAnim.gotoAndStop(1);
m_lastFrame = 1;
};
};
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (hitTestObject(m_hero.m_doHitArea)){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((((m_dir == Game.TILE_DIR_RIGHT)) && ((_local6 < 1)))) && ((_local5 > -17)))) || ((((((m_dir == Game.TILE_DIR_LEFT)) && ((_local6 < 1)))) && ((_local5 < 17)))))){
dispatchEvent(new BumperEvent(BumperEvent.BUMP, ((m_dir == Game.TILE_DIR_RIGHT)) ? SPEED_X : -(SPEED_X), SPEED_Y));
m_doAnim.gotoAndStop(1);
m_lastFrame = FRAMES_AMOUNT;
};
};
};
}
}
}//package game.activeobjects.objects
Section 91
//Cloud (game.activeobjects.objects.Cloud)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Cloud extends MovieClip {
private const WIDTH:Number = 96.4;
private var m_gridX:int;
private var m_gridY:int;
public var m_mcCloud:MovieClip;
private var m_posX:Number;
private var m_posY:Number;
private var m_hero:Hero;
private var m_animPlayed:Boolean;
public function Cloud(_arg1:Number, _arg2:Number, _arg3:Hero){
addFrameScript(0, frame1);
cacheAsBitmap = true;
stop();
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_animPlayed = false;
m_mcCloud.gotoAndStop((1 + (int(((_arg1 + _arg2) / 2)) % 3)));
draw();
}
function frame1(){
stop();
}
public function draw():void{
x = m_posX;
y = m_posY;
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:*;
var _local6:*;
var _local7:Number;
var _local8:Number;
if ((((((((m_gridX < (_arg1 - 1))) || ((m_gridX > (_arg3 + 1))))) || ((m_gridY < (_arg2 - 1))))) || ((m_gridY > _arg4)))){
remove();
} else {
_local5 = m_hero.posX;
_local6 = m_hero.posY;
_local7 = Math.abs((_local5 - m_posX));
_local8 = (((_local6 + View.TILE_SIZE) - m_posY) - (m_mcCloud.y - 16));
if (_local7 < (WIDTH / 2)){
if ((((((m_hero.speedY >= 0)) && ((_local8 >= -4)))) && ((_local8 <= (m_hero.speedY + 8))))){
dispatchEvent(new PlatformEvent(PlatformEvent.STAND, _local8, 0, 0));
if (!m_animPlayed){
m_animPlayed = true;
gotoAndPlay("on");
};
} else {
m_animPlayed = false;
};
} else {
m_animPlayed = false;
};
};
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
}
}//package game.activeobjects.objects
Section 92
//Door (game.activeobjects.objects.Door)
package game.activeobjects.objects {
import flash.display.*;
import flash.events.*;
import sound.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
import game.view.*;
public class Door extends EventDispatcher {
private const LABEL_CLOSED:String = "closed";
private const LABEL_OPEN:String = "open";
private var m_gridX:Number;
private var m_gridY:Number;
private var m_areOpen:Boolean;
private var m_keyId:int;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
private var m_doFrontPart:MovieClip;
private var m_doBackPart:MovieClip;
private var m_doorId:int;
public function Door(_arg1:Number, _arg2:Number, _arg3:MovieClip, _arg4:MovieClip, _arg5:Hero, _arg6:int=-1){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 1) * View.TILE_SIZE);
m_doorId = _arg6;
m_doBackPart = _arg3;
m_doFrontPart = _arg4;
m_hero = _arg5;
m_areOpen = false;
m_doBackPart.gotoAndStop(LABEL_CLOSED);
m_doBackPart.m_doAnim.mask = m_doBackPart.m_doMask;
m_doFrontPart.gotoAndStop(LABEL_CLOSED);
m_doFrontPart.m_doMask.x = 0;
m_doFrontPart.m_doAnim.mask = m_doFrontPart.m_doMask;
}
public function get posY():Number{
return (m_posY);
}
public function open():void{
m_areOpen = true;
var _local1:FrameScriptManager = new FrameScriptManager(m_doBackPart);
_local1.setFrameScript(LABEL_OPEN, setBackMask);
m_doBackPart.gotoAndStop(LABEL_OPEN);
_local1 = new FrameScriptManager(m_doFrontPart);
_local1.setFrameScript(LABEL_OPEN, setFrontMask);
m_doFrontPart.gotoAndStop(LABEL_OPEN);
SoundManager.getInstance().playSound(SoundConfig.SFX_DOOR_OPEN);
}
public function remove():void{
m_doBackPart.parent.removeChild(m_doBackPart);
m_doFrontPart.parent.removeChild(m_doFrontPart);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function get areOpen():Boolean{
return (m_areOpen);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (!m_areOpen){
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((Math.abs(_local5) < 33)) && ((_local6 < 16)))) && ((_local6 > -130)))){
_local7 = ((_local5 < 0)) ? -1 : 1;
dispatchEvent(new DoorEvent(DoorEvent.NEXT_TO_DOOR, m_posX, _local7, m_doorId));
};
};
};
}
public function draw():void{
m_doBackPart.x = m_posX;
m_doBackPart.y = m_posY;
m_doFrontPart.x = m_posX;
m_doFrontPart.y = m_posY;
}
private function setFrontMask():void{
m_doFrontPart.m_doAnim.mask = m_doFrontPart.m_doMask;
}
public function areOnScreen(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Boolean{
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
return (true);
};
return (false);
}
public function get posX():Number{
return (m_posX);
}
public function close():void{
m_areOpen = false;
var _local1:FrameScriptManager = new FrameScriptManager(m_doBackPart);
_local1.setFrameScript(LABEL_CLOSED, setBackMask);
m_doBackPart.gotoAndStop(LABEL_CLOSED);
_local1 = new FrameScriptManager(m_doFrontPart);
_local1.setFrameScript(LABEL_CLOSED, setFrontMask);
m_doFrontPart.gotoAndStop(LABEL_CLOSED);
}
private function setBackMask():void{
m_doBackPart.m_doAnim.mask = m_doBackPart.m_doMask;
}
}
}//package game.activeobjects.objects
Section 93
//Exit (game.activeobjects.objects.Exit)
package game.activeobjects.objects {
import flash.display.*;
import flash.events.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Exit extends MovieClip {
private var m_gridX:Number;
private var m_gridY:Number;
private var m_canOpen:Boolean;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
public static const EVENT_NEXT_TO_EXIT:String = "onNextToExit";
public static const EVENT_DOOR_OPENED:String = "onDoorOpened";
public function Exit(_arg1:Number, _arg2:Number, _arg3:Hero){
addFrameScript(94, frame95);
cacheAsBitmap = true;
stop();
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_canOpen = false;
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
function frame95(){
stop();
}
public function open():void{
m_canOpen = true;
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((Math.abs(_local5) < 30)) && ((_local6 < 2)))) && ((_local6 > -2)))){
dispatchEvent(new Event(EVENT_NEXT_TO_EXIT));
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_canOpen){
if (currentFrame < totalFrames){
nextFrame();
} else {
dispatchEvent(new Event(EVENT_DOOR_OPENED));
};
};
}
}
}//package game.activeobjects.objects
Section 94
//FallingPlatform (game.activeobjects.objects.FallingPlatform)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import game.view.*;
public class FallingPlatform extends MovieClip {
private const LABEL_OUT:String = "out";
private const STATE_FADE:int = 2;
private const STATE_OUT:int = 1;
private const WIDTH:Number = 96.2;
private const LABEL_ON:String = "on";
private const STATE_ON:int = 0;
private var m_gridY:int;
private var m_gridX:int;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
public var m_doPlatform:MovieClip;
private var m_state:int;
public function FallingPlatform(_arg1:Number, _arg2:Number, _arg3:Hero){
cacheAsBitmap = true;
m_doPlatform.stop();
m_state = STATE_ON;
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
var _local4:FrameScriptManager = new FrameScriptManager(m_doPlatform);
_local4.setFrameScript(LABEL_ON, onFrameOn);
_local4.setFrameScript(LABEL_OUT, onFrameOut);
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_state == STATE_FADE){
m_doPlatform.nextFrame();
} else {
if (m_state == STATE_OUT){
m_doPlatform.nextFrame();
if (m_doPlatform.currentFrame == m_doPlatform.totalFrames){
m_doPlatform.gotoAndStop(1);
};
};
};
}
private function onFrameOn():void{
m_state = STATE_ON;
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:*;
var _local6:*;
var _local7:Number;
var _local8:Number;
if (m_state == STATE_OUT){
return;
};
if ((((((((m_gridX < (_arg1 - 1))) || ((m_gridX > (_arg3 + 1))))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
_local5 = m_hero.posX;
_local6 = m_hero.posY;
_local7 = Math.abs((_local5 - m_posX));
_local8 = ((_local6 + View.TILE_SIZE) - m_posY);
if (_local7 < (WIDTH / 2)){
if ((((((m_hero.speedY >= 0)) && ((_local8 > -1)))) && ((_local8 < (m_hero.speedY + 2))))){
dispatchEvent(new PlatformEvent(PlatformEvent.STAND, _local8, 0, 0));
m_state = STATE_FADE;
};
};
};
}
private function onFrameOut():void{
m_state = STATE_OUT;
}
}
}//package game.activeobjects.objects
Section 95
//LegoBrickPlaceholder (game.activeobjects.objects.LegoBrickPlaceholder)
package game.activeobjects.objects {
import flash.display.*;
import flash.events.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class LegoBrickPlaceholder extends MovieClip {
protected var m_gridX:int;
protected var m_gridY:int;
private var m_isEnabled:Boolean;
private var m_isLocked:Boolean;
protected var m_hero:Hero;
protected var m_posX:Number;
protected var m_posY:Number;
public static const EVENT_LOCK_LEGO:String = "onLockLego";
public static const EVENT_HERO_NEXT_TO_LEGO:String = "onHeroNextToLego";
public function LegoBrickPlaceholder(_arg1:int, _arg2:int, _arg3:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_isEnabled = false;
stop();
draw();
}
public function enable():void{
gotoAndStop("on");
m_isEnabled = true;
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
}
public function get gridX():int{
return (m_gridX);
}
public function get isLocked():Boolean{
return (m_isLocked);
}
public function get gridY():int{
return (m_gridY);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
if (!m_isEnabled){
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((((_local5 > -16)) && ((_local5 < 48)))) && ((_local6 < 17)))) && ((_local6 > -16)))){
dispatchEvent(new ObjectEvent(EVENT_HERO_NEXT_TO_LEGO, {gridX:m_gridX, gridY:m_gridY}));
};
};
} else {
if (!m_isLocked){
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
if (!hitTestObject(m_hero.m_doHitArea)){
dispatchEvent(new Event(EVENT_LOCK_LEGO));
m_isLocked = true;
gotoAndStop("locked");
};
};
};
};
}
}
}//package game.activeobjects.objects
Section 96
//MarbleCage (game.activeobjects.objects.MarbleCage)
package game.activeobjects.objects {
import flash.display.*;
import flash.events.*;
import sound.*;
import game.activeobjects.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
import game.view.*;
public class MarbleCage extends MovieClip {
private const LABEL_MARB:String = "marb";
private const LABEL_OPEN:String = "open";
private const LABEL_ANIM_END:String = "anim_end";
private var m_gridX:Number;
private var m_gridY:Number;
private var m_marbId:int;
public var m_mcMarb:MovieClip;
private var m_posX:Number;
private var m_posY:Number;
private var m_hero:Hero;
private var m_isOpen:Boolean;
public var m_mcMask:MovieClip;
public static const EVENT_NEXT_TO_CAGE:String = "onHeroNextToMarbleCage";
public static const EVENT_MARBLE_RELEASED:String = "onReleaseMarble";
public function MarbleCage(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_marbId = _arg3;
m_hero = _arg4;
m_isOpen = false;
var _local5:FrameScriptManager = new FrameScriptManager(this);
_local5.setFrameScript(LABEL_MARB, onFrameMarb);
_local5.setFrameScript(LABEL_ANIM_END, onFrameAnimEnd);
stop();
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function get posY():Number{
return (m_posY);
}
public function open():void{
m_isOpen = true;
gotoAndStop(LABEL_OPEN);
SoundManager.getInstance().playSound(SoundConfig.SFX_DOOR_OPEN);
}
public function draw():void{
x = m_posX;
y = m_posY;
if (m_isOpen){
nextFrame();
};
}
public function get isOpen():Boolean{
return (m_isOpen);
}
public function get posX():Number{
return (m_posX);
}
private function onFrameAnimEnd():void{
stop();
dispatchEvent(new ObjectEvent(EVENT_MARBLE_RELEASED, {gridX:m_gridX, gridY:(m_gridY - 2), marbId:m_marbId}));
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
if (!m_isOpen){
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
_local5 = (m_hero.posX - m_posX);
_local6 = (m_hero.posY - m_posY);
if ((((((Math.abs(_local5) < 33)) && ((_local6 < 17)))) && ((_local6 > -26)))){
dispatchEvent(new Event(EVENT_NEXT_TO_CAGE));
};
};
};
}
private function onFrameMarb():void{
m_mcMarb.mask = m_mcMask;
m_mcMarb.gotoAndStop((m_marbId + 1));
}
public function isOnScreen(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Boolean{
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
return (true);
};
return (false);
}
}
}//package game.activeobjects.objects
Section 97
//MovingPlatform (game.activeobjects.objects.MovingPlatform)
package game.activeobjects.objects {
import flash.display.*;
import flash.geom.*;
import game.activeobjects.*;
import events.*;
import game.activeobjects.items.*;
import game.view.*;
public class MovingPlatform extends MovieClip {
private const SPEEDS:Array;
private const WIDTH:Number = 43;
private var m_gridX:int;
private var m_gridY:int;
private var m_dirX:int;
private var m_hero:Hero;
private var m_controlPointBR:Point;
private var m_posX:Number;
private var m_posY:Number;
private var m_item:Item;
private var m_speed:int;
private var m_controlPointTL:Point;
private var m_dirY:int;
public static var TYPE_HORIZONTAL:int = 1;
public static var TYPE_VERTICAL:int = 0;
public function MovingPlatform(_arg1:Number, _arg2:Number, _arg3:Point, _arg4:Point, _arg5:int, _arg6:int, _arg7:int, _arg8:Hero, _arg9:Item){
SPEEDS = [1, 2, 3, 4, 5];
super();
cacheAsBitmap = true;
stop();
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_dirX = _arg5;
m_dirY = _arg6;
m_controlPointTL = new Point(((_arg3.x + 0.5) * View.TILE_SIZE), ((_arg3.y + 0.5) * View.TILE_SIZE));
m_controlPointBR = new Point(((_arg4.x + 0.5) * View.TILE_SIZE), ((_arg4.y + 0.5) * View.TILE_SIZE));
m_speed = SPEEDS[_arg7];
m_hero = _arg8;
m_item = _arg9;
if (m_item){
m_item.lock();
};
draw();
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local8:*;
var _local9:*;
var _local10:Number;
var _local11:Number;
_local5 = m_dirX;
var _local6:Number = m_dirY;
m_posX = (m_posX + (m_dirX * m_speed));
m_posY = (m_posY + (m_dirY * m_speed));
var _local7:Number = 0;
if ((((m_posX < m_controlPointTL.x)) || ((m_posY < m_controlPointTL.y)))){
_local7 = (-(m_speed) + (m_controlPointTL.x - m_posX));
m_posX = m_controlPointTL.x;
m_posY = m_controlPointTL.y;
m_dirX = -(m_dirX);
m_dirY = -(m_dirY);
} else {
if ((((m_posX > m_controlPointBR.x)) || ((m_posY > m_controlPointBR.y)))){
_local7 = (m_speed - (m_posX - m_controlPointBR.x));
m_posX = m_controlPointBR.x;
m_posY = m_controlPointBR.y;
m_dirX = -(m_dirX);
m_dirY = -(m_dirY);
};
};
if ((((((((m_posX > ((_arg1 * View.TILE_SIZE) - 60))) && ((m_posX < ((_arg3 * View.TILE_SIZE) + 60))))) && ((m_posY > (_arg2 * View.TILE_SIZE))))) && ((m_posY < ((_arg4 * View.TILE_SIZE) + 40))))){
visible = true;
_local8 = m_hero.posX;
_local9 = m_hero.posY;
_local10 = Math.abs((_local8 - m_posX));
_local11 = ((_local9 + View.TILE_SIZE) - m_posY);
if (_local10 < WIDTH){
if ((((((((m_hero.speedY >= 0)) && ((_local11 > (-(m_speed) - 1))))) && ((_local11 < (m_hero.speedY + 1))))) || ((((((((((m_dirY < 0)) || ((_local6 < 0)))) && ((m_hero.speedY < 0)))) && ((_local11 < (m_speed + 1))))) && ((_local11 > (-(m_speed) - 1))))))){
if (_local5 != m_dirX){
dispatchEvent(new PlatformEvent(PlatformEvent.STAND, _local11, _local7, 0));
} else {
dispatchEvent(new PlatformEvent(PlatformEvent.STAND, _local11, (m_dirX * m_speed), (m_dirY * m_speed)));
};
};
};
} else {
visible = false;
};
if (m_item){
m_item.move(m_posX, (m_posY - View.TILE_SIZE));
};
}
public function draw():void{
x = m_posX;
y = m_posY;
}
}
}//package game.activeobjects.objects
Section 98
//Obstacle (game.activeobjects.objects.Obstacle)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Obstacle extends MovieClip {
private const DAMAGE:Number = 0.1;
protected var m_gridX:int;
protected var m_gridY:int;
protected var m_damage:Number;
protected var m_hero:Hero;
protected var m_posX:Number;
protected var m_posY:Number;
protected var m_dir:int;
public function Obstacle(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_dir = _arg3;
m_hero = _arg4;
m_damage = DAMAGE;
gotoAndStop((m_dir + 1));
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (m_hero.isProtected()){
return;
};
if (hitTestObject(m_hero.m_doHitArea)){
_local5 = (m_hero.posY - m_posY);
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, m_damage, ((_local5 < 16)) ? HeroEvent.SIDE_BOTTOM : HeroEvent.SIDE_TOP));
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
}
}
}//package game.activeobjects.objects
Section 99
//Savepoint (game.activeobjects.objects.Savepoint)
package game.activeobjects.objects {
import flash.display.*;
import sound.*;
import game.activeobjects.*;
import events.*;
import config.*;
import game.view.*;
public class Savepoint extends MovieClip {
private const LABEl_ON:String = "on";
private var m_gridX:Number;
private var m_gridY:Number;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
private var m_isOn:Boolean;
public function Savepoint(_arg1:Number, _arg2:Number, _arg3:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_hero = _arg3;
m_isOn = false;
stop();
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (m_isOn){
return;
};
if ((((((((m_gridX > _arg1)) && ((m_gridX < _arg3)))) && ((m_gridY > _arg2)))) && ((m_gridY < _arg4)))){
if (m_hero.isProtected()){
return;
};
if (hitTestObject(m_hero.m_doHitArea)){
m_isOn = true;
gotoAndStop(LABEl_ON);
dispatchEvent(new SavepointEvent(SavepointEvent.ACTIVATE, m_gridX, m_gridY, m_hero.dir));
SoundManager.getInstance().playSound(SoundConfig.SFX_SAVEPOINT);
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
}
}
}//package game.activeobjects.objects
Section 100
//ShotEnemy (game.activeobjects.objects.ShotEnemy)
package game.activeobjects.objects {
import flash.display.*;
import flash.geom.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class ShotEnemy extends MovieClip {
private const SPEED:int = 10;
private var m_gridX:int;
private var m_gridY:int;
private var m_speedX:int;
private var m_speedY:int;
private var m_bmdShot:BitmapData;
private var m_hero:Hero;
private var m_bmdGround:BitmapData;
private var m_posX:Number;
private var m_posY:Number;
private var m_cameraTop:int;
private var m_dir:int;
private var m_point:Point;
public static const DAMAGE:Number = 0.2;
public function ShotEnemy(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero){
m_hero = _arg4;
m_posX = _arg1;
m_posY = _arg2;
m_gridX = int((m_posX / View.TILE_SIZE));
m_gridY = int((m_posY / View.TILE_SIZE));
m_speedX = (SPEED * Math.cos(((Math.PI * _arg3) / 180)));
m_speedY = (-(SPEED) * Math.sin(((Math.PI * _arg3) / 180)));
m_bmdShot = new BitmapData(width, height, true, 0);
var _local5:Matrix = new Matrix(1, 0, 0, 1, (width >> 1), (height >> 1));
m_bmdShot.draw(this, _local5);
m_point = new Point(0, 0);
draw();
}
public function get posY():Number{
return (m_posY);
}
public function setGround(_arg1:BitmapData):void{
m_bmdGround = _arg1;
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED));
dispatchEvent(new ShotEvent(ShotEvent.REMOVE));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
m_posX = (m_posX + m_speedX);
m_posY = (m_posY + m_speedY);
m_gridX = int((m_posX / View.TILE_SIZE));
m_gridY = int((m_posY / View.TILE_SIZE));
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
_local5 = (_arg1 * View.TILE_SIZE);
_local6 = (_arg2 * View.TILE_SIZE);
if (m_bmdGround.hitTest(m_point, 50, new Point((m_posX - _local5), (m_posY - m_cameraTop)))){
remove();
} else {
if (hitTestObject(m_hero.m_doHitArea)){
if (m_hero.isDefending()){
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, (DAMAGE * 0.3), HeroEvent.SIDE_BOTTOM));
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, DAMAGE, HeroEvent.SIDE_BOTTOM));
};
remove();
};
};
};
}
public function draw():void{
x = m_posX;
y = m_posY;
rotation = (rotation + (m_dir * 3));
}
public function get posX():Number{
return (m_posX);
}
public function setCameraTop(_arg1):void{
m_cameraTop = _arg1;
}
}
}//package game.activeobjects.objects
Section 101
//ShotGrenade (game.activeobjects.objects.ShotGrenade)
package game.activeobjects.objects {
import flash.display.*;
import flash.geom.*;
import game.activeobjects.*;
import events.*;
import config.*;
import game.view.*;
public class ShotGrenade extends MovieClip {
private const SPEED_X:int = 10;
private const SPEED_Y:int = -4;
private const STATE_FLY:int = 0;
private const EXPLODE_TIME:int = 43;
private const SPEED_ANGLE:int = 17;
private const LABEL_EXPLODE:String = "explode";
private const STATE_EXPLODE:int = 1;
private var m_speedX:int;
private var m_speedY:int;
private var m_gridY:int;
private var m_hero:Hero;
private var m_bmdGround:BitmapData;
private var m_gridX:int;
private var m_posX:Number;
private var m_posY:Number;
public var m_mcAnim:MovieClip;
private var m_cameraTop:int;
private var m_counter:int;
private var m_dir:int;
private var m_point:Point;
private var m_state:int;
public static const DIR_LEFT:int = -1;
public static const DIR_RIGHT:int = -1;
public static const DAMAGE:Number = 0.2;
public function ShotGrenade(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero, _arg5:int=-1000){
m_posX = _arg1;
m_posY = _arg2;
m_dir = _arg3;
m_gridX = int((m_posX / View.TILE_SIZE));
m_gridY = int((m_posY / View.TILE_SIZE));
m_hero = _arg4;
m_state = STATE_FLY;
if (_arg5 == -1000){
m_speedX = (SPEED_X * m_dir);
m_speedY = SPEED_Y;
} else {
m_speedX = (SPEED_ANGLE * Math.cos(((Math.PI * _arg5) / 180)));
m_speedY = ((-(SPEED_ANGLE) * Math.sin(((Math.PI * _arg5) / 180))) * 1.5);
};
m_point = new Point(0, 0);
draw();
}
public function setGround(_arg1:BitmapData):void{
m_bmdGround = _arg1;
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED));
dispatchEvent(new ShotEvent(ShotEvent.REMOVE));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
private function explode():void{
m_state = STATE_EXPLODE;
m_speedX = 0;
m_speedY = 0;
m_counter = EXPLODE_TIME;
gotoAndStop(LABEL_EXPLODE);
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
m_posX = (m_posX + m_speedX);
m_posY = (m_posY + m_speedY);
m_speedY = (m_speedY + Config.GRAVITY);
m_gridX = int((m_posX / View.TILE_SIZE));
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
if (m_state == STATE_FLY){
_local5 = (_arg1 * View.TILE_SIZE);
_local6 = (_arg2 * View.TILE_SIZE);
if (((m_bmdGround.hitTest(m_point, 50, new Point((m_posX - _local5), (m_posY - m_cameraTop)))) || (hitTestObject(m_hero.m_doHitArea)))){
explode();
};
} else {
if (m_state == STATE_EXPLODE){
m_counter--;
if (m_counter <= 0){
remove();
} else {
if ((((((m_counter > (EXPLODE_TIME - 30))) && (hitTestObject(m_hero.m_doHitArea)))) && (!(m_hero.isProtected())))){
if (m_hero.isDefending()){
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, (DAMAGE * 0.3), HeroEvent.SIDE_BOTTOM));
} else {
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, DAMAGE, HeroEvent.SIDE_BOTTOM));
};
};
};
};
};
};
}
public function get posX():Number{
return (m_posX);
}
public function get posY():Number{
return (m_posY);
}
public function draw():void{
if (m_state == STATE_FLY){
x = m_posX;
y = m_posY;
rotation = (rotation + (m_dir * 3));
} else {
rotation = 0;
if (m_mcAnim){
m_mcAnim.nextFrame();
};
};
}
public function setCameraTop(_arg1):void{
m_cameraTop = _arg1;
}
}
}//package game.activeobjects.objects
Section 102
//ShotHero (game.activeobjects.objects.ShotHero)
package game.activeobjects.objects {
import flash.display.*;
import flash.geom.*;
import events.*;
import config.*;
import game.view.*;
public class ShotHero extends MovieClip {
private const SPEED:int = 20;
private var m_gridX:int;
private var m_gridY:int;
private var m_wallsMap:Array;
private var m_bmdShot:BitmapData;
private var m_bmdGround:BitmapData;
private var m_posX:Number;
private var m_posY:Number;
private var m_cameraTop:int;
private var m_objectsMap:Array;
private var m_dir:int;
private var m_point:Point;
public static const DIR_LEFT:int = -1;
public static const DIR_RIGHT:int = -1;
public static const DAMAGE:int = 10;
public function ShotHero(_arg1:int, _arg2:int, _arg3:int, _arg4:Array, _arg5:Array){
m_posX = _arg1;
m_posY = _arg2;
m_dir = _arg3;
m_gridX = int((m_posX / View.TILE_SIZE));
m_gridY = int((m_posY / View.TILE_SIZE));
m_objectsMap = _arg4;
m_wallsMap = _arg5;
m_bmdShot = new BitmapData(width, height, true, 0);
var _local6:Matrix = new Matrix(1, 0, 0, 1, (width >> 1), (height >> 1));
m_bmdShot.draw(this, _local6);
m_point = new Point(0, 0);
draw();
}
public function remove():void{
parent.removeChild(this);
stop();
dispatchEvent(new ShotEvent(ShotEvent.REMOVE));
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED));
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
rotation = (rotation + (m_dir * 3));
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:Point;
var _local7:int;
var _local8:int;
m_posX = (m_posX + (SPEED * m_dir));
m_gridX = int((m_posX / View.TILE_SIZE));
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
} else {
_local5 = m_objectsMap[m_gridY][m_gridX];
_local6 = new Point((_local5 & 0xFF), (_local5 >> 8));
if (!_local6.equals(Config.TILE_NO_COLLISION)){
_local5 = m_wallsMap[m_gridY][m_gridX];
_local6 = new Point((_local5 & 0xFF), (_local5 >> 8));
if ((((_local6.x < 0xFF)) && ((_local6.y < 0xFF)))){
_local7 = (_arg1 * View.TILE_SIZE);
_local8 = (_arg2 * View.TILE_SIZE);
if (m_bmdGround.hitTest(m_point, 50, new Point((m_posX - _local7), (m_posY - m_cameraTop)))){
remove();
};
};
};
};
}
public function setGround(_arg1:BitmapData):void{
m_bmdGround = _arg1;
}
public function get posX():Number{
return (m_posX);
}
public function get posY():Number{
return (m_posY);
}
public function setCameraTop(_arg1):void{
m_cameraTop = _arg1;
}
}
}//package game.activeobjects.objects
Section 103
//Signpost (game.activeobjects.objects.Signpost)
package game.activeobjects.objects {
import flash.display.*;
import events.*;
import com.gskinner.utils.*;
import game.view.*;
public class Signpost extends MovieClip {
protected var m_gridX:int;
public var m_mcArrow:MovieClip;
protected var m_gridY:int;
protected var m_posX:Number;
protected var m_posY:Number;
protected var m_dir:int;
public function Signpost(_arg1:int, _arg2:int, _arg3:int){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_dir = _arg3;
var _local4:FrameScriptManager = new FrameScriptManager(this);
_local4.setFrameScript("arrow", onFrameArrow);
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
private function onFrameArrow():void{
m_mcArrow.gotoAndStop((m_dir + 1));
}
public function draw():void{
x = m_posX;
y = m_posY;
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > _arg4)))){
remove();
};
}
}
}//package game.activeobjects.objects
Section 104
//Spikes (game.activeobjects.objects.Spikes)
package game.activeobjects.objects {
import game.activeobjects.*;
public class Spikes extends Obstacle {
public function Spikes(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero){
super(_arg1, _arg2, _arg3, _arg4);
}
}
}//package game.activeobjects.objects
Section 105
//Start (game.activeobjects.objects.Start)
package game.activeobjects.objects {
import flash.display.*;
import flash.events.*;
import events.*;
import com.gskinner.utils.*;
import game.view.*;
public class Start extends MovieClip {
private var m_gridX:Number;
private var m_gridY:Number;
public var m_mcHero:MovieClip;
private var m_posX:Number;
private var m_posY:Number;
private var m_dir:int;
public static const EVENT_CLOSE:String = "onCloseStart";
public function Start(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Boolean){
cacheAsBitmap = true;
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
m_dir = _arg3;
if (_arg4){
m_mcHero.gotoAndStop("boy");
} else {
m_mcHero.gotoAndStop("girl");
};
var _local5:FrameScriptManager = new FrameScriptManager(this);
_local5.setFrameScript("close", onFrameClose);
draw();
}
private function onFrameClose():void{
dispatchEvent(new Event(EVENT_CLOSE));
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if ((((((((m_gridX > (_arg1 - 2))) && ((m_gridX < (_arg3 + 2))))) && ((m_gridY > (_arg2 - 1))))) && ((m_gridY < (_arg4 + 4))))){
visible = true;
} else {
visible = false;
};
}
public function draw():void{
x = m_posX;
y = m_posY;
if (currentFrame < totalFrames){
nextFrame();
};
}
}
}//package game.activeobjects.objects
Section 106
//Thumper (game.activeobjects.objects.Thumper)
package game.activeobjects.objects {
import flash.display.*;
import game.activeobjects.*;
import events.*;
import game.view.*;
public class Thumper extends MovieClip {
private const DAMAGE:Number = 0.1;
private var m_gridX:int;
private var m_gridY:int;
public var m_mcColumn:MovieClip;
private var m_damage:Number;
private var m_hero:Hero;
private var m_posX:Number;
private var m_posY:Number;
public var m_mcHitArea:MovieClip;
private var m_dir:int;
public function Thumper(_arg1:int, _arg2:int, _arg3:int, _arg4:Hero){
m_gridX = _arg1;
m_gridY = _arg2;
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 1) * View.TILE_SIZE);
m_hero = _arg4;
m_damage = DAMAGE;
gotoAndStop(((_arg3 * 5) + 1));
draw();
}
public function remove():void{
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED, m_gridX, m_gridY));
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function draw():void{
x = m_posX;
y = m_posY;
nextFrame();
if (currentFrame == totalFrames){
gotoAndStop(1);
};
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if ((((((((m_gridX < _arg1)) || ((m_gridX > _arg3)))) || ((m_gridY < _arg2)))) || ((m_gridY > (_arg4 + 3))))){
} else {
if (m_hero.isProtected()){
_local5 = (m_hero.posX - m_posX);
if ((((Math.abs(_local5) < 16)) && (m_mcHitArea.hitTestObject(m_hero.m_doHitArea)))){
_local6 = ((_local5 < 0)) ? -1 : 1;
dispatchEvent(new BlockadeEvent(BlockadeEvent.NEXT_TO_BLOCKADE, m_posX, _local6, 16));
};
} else {
if (m_mcHitArea.hitTestObject(m_hero.m_doHitArea)){
_local7 = (m_hero.posY - m_posY);
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, m_damage, ((_local7 < 16)) ? HeroEvent.SIDE_BOTTOM : HeroEvent.SIDE_TOP));
};
};
};
}
}
}//package game.activeobjects.objects
Section 107
//Hero (game.activeobjects.Hero)
package game.activeobjects {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import sound.*;
import events.*;
import config.*;
import utils.*;
import game.view.*;
import flash.ui.*;
public class Hero extends MovieClip {
private const LABEL_SEA_HORSE:String = "sea_horse";
private const SPEED_MAX_X:Number = 20;
private const SPEED_MAX_Y:Number = 25;
private const KEY_LEFT:int = 37;
public const HIT_RECT_BALLON:Rectangle;
private const HIT_RECT_BOTTOM:Rectangle;
public const HIT_RECT_ROLL:Rectangle;
private const HIT_RECT_RIGHT:Rectangle;
private const WALK_SPEED:Number = 6;
private const LABEL_IDLE_0:String = "idle0";
private const FRAMES_AMOUNT_SHOOT:int = 9;
private const LABEL_WALK:String = "walk";
private const LABEL_GLIDE:String = "glide";
private const LABEL_ATTACK_SLIDE:String = "attack_slide";
private const LABEL_SLIDE:String = "slide";
private const FRAMES_AMOUNT_ATTACK_1:int = 9;
private const FRAMES_AMOUNT_ATTACK_2:int = 15;
private const HIT_RECT_RIGHT_BALLON:Rectangle;
private const KEY_ACTION_A:int = 32;
private const KEY_ACTION_B:int = 90;
private const LABEL_RUN:String = "run";
private const LABEL_SHOOT_RUN:String = "shoot_run";
private const LABEL_SHOOT_STAND:String = "shoot_stand";
private const DOUBLE_PRESS_TIME:Number = 300;
private const DIR_LEFT:int = -1;
private const KEY_UP:int = 38;
private const KEY_DOWN:int = 40;
private const SEA_HORSE_JUMP_SPEED:Number = -12;
private const LABEL_JUMP:String = "jump";
private const LABEL_SHOOT_JUMP:String = "shoot_jump";
private const RUN_ATTACK_SPEED:Number = 13;
private const HIT_RECT_LEFT_BALLON:Rectangle;
private const JUMP_SPEED:Number = -17;
private const HIT_RECT_TOP_BALLON:Rectangle;
private const LABEL_SLIDE_DOWN:String = "slide_down";
private const LABEL_DEAD:String = "dead";
private const BALLOON_TIME:int = 300;
private const LABEL_ROLL:String = "roll";
private const BALLON_SPEED_Y:Number = -3;
private const KEY_CAMERA:int = 67;
public const HIT_RECT:Rectangle;
private const HIT_RECT_RIGHT_ROLL:Rectangle;
private const RUN_SPEED:Number = 10;
private const SPEED_MAX_Y_ACID:Number = 5;
private const LABEL_GUARD:String = "guard";
private const HIT_RECT_LEFT_ROLL:Rectangle;
private const MAX_SHIELD_TIME:int = 60;
private const HIT_RECT_TOP_ROLL:Rectangle;
private const HIT_RECT_BOTTOM_ROLL:Rectangle;
private const LABEL_CROUCH:String = "crouch";
private const LABEL_HIT:String = "hit";
private const SLIDE_SPEED_Y:Number = 25;
private const SLIDE_SPEED_X:Number = 10;
private const LABEL_BALLOON:String = "balloon";
private const HIT_RECT_TOP:Rectangle;
private const SLIDE_SPEED_Y_ROLL:Number = 8;
private const SPEED_DX:Number = 0.7;
private const SPEED_DY:Number = 0.7;
private const DIR_RIGHT:int = 1;
private const LABEL_ATTACK_STAND_1:String = "attack_1";
private const LABEL_ATTACK_STAND_2:String = "attack_2";
private const HIT_RECT_LEFT:Rectangle;
private const SPEED_MAX_Y_GLIDING:Number = 2;
private const FRAMES_AMOUNT_DEAD:int = 63;
private const ROLL_JUMP_SPEED:Number = -15;
private const HIT_RECT_BOTTOM_BALLON:Rectangle;
private const SHOT_DX:int = 30;
private const SHOT_DY:int = -12;
private const KEY_RIGHT:int = 39;
private var m_counter:int;
private var m_keyRightDownTime:Number;
private var m_state:int;// = 0
private var m_keyActionADown:Boolean;
private var m_action:int;// = 0
private var m_canJump:Boolean;// = true
private var m_attackTime:int;
private var m_isSliding:Boolean;
private var m_isBalloon:Boolean;
private var m_isHurted:Boolean;
public var m_doHitArea:MovieClip;
private var m_stageWidth:int;
private var m_bmpTiles:Bitmap;
private var m_cameraTop:int;
private var m_label:String;
private var m_isOnGround:Boolean;
private var m_isOnPlatform:Boolean;
private var m_isDead:Boolean;
private var m_keyDownUp:Boolean;// = true
private var m_keyCameraDown:Boolean;// = false
private var m_maxSpeed:Number;// = 0
private var m_isEnemyClose:Boolean;
private var m_bmpBuffer:Bitmap;
private var m_isInAcid:Boolean;
private var m_isRoll:Boolean;
private var m_stageHeight:int;
private var m_keyLeftUp:Boolean;// = true
private var m_speedX:Number;// = 0
private var m_isInAir:Boolean;
private var m_speedY:Number;// = 0
private var m_isCrouching:Boolean;// = false
private var m_keyDownDown:Boolean;
private var m_posY:Number;
private var m_isJumping:Boolean;// = false
private var m_posX:Number;
private var m_rotation:Number;// = 0
private var m_isSeaHorse:Boolean;
private var m_jumpAfterCrush:Boolean;// = false
private var m_isInExit:Boolean;
private var m_isGliding:Boolean;// = false
private var m_speedDX:Number;// = 0
private var m_speedDY:Number;// = 0
private var m_keyCameraUp:Boolean;// = true
public var m_doAnim:MovieClip;
private var m_platformSpeedX:Number;// = 0
public var m_doShield:Sprite;// = null
private var m_shield:int;
private var m_keyRightUp:Boolean;// = true
private var m_keyActionBUp:Boolean;// = true
private var m_rotationRoll:Number;// = 0
private var m_keyActionAUp:Boolean;// = true
private var m_dir:int;
private var m_isShooting:Boolean;
private var m_speedYMax:Number;// = 0
private var m_keyActionBDown:Boolean;
private var m_keyUpUp:Boolean;// = true
private var m_keyUpDown:Boolean;
private var m_collisionTable:Array;
private var m_keyRightDown:Boolean;
private var m_isCameraControl:Boolean;// = false
private var m_keyLeftDownTime:Number;
private var m_distanceToSurface:int;
private var m_cameraLeft:int;
private var m_keyLeftDown:Boolean;
public static const DAMAGE_SLIDE:int = 30;
public static const STATE_SLIDE:int = 5;
public static const ACTION_ATTACK_SLIDE:int = 3;
public static const STATE_WALK:int = 1;
public static const STATE_MORPH:int = 6;
public static const ACTION_ATTACK_STAND_2:int = 2;
public static const STATE_RUN:int = 2;
public static const ACTION_ATTACK_STAND_1:int = 1;
public static const STATE_IDLE:int = 0;
public static const STATE_HIT:int = 7;
public static const ACTION_NONE:int = 0;
public static const ACTION_ATTACK_SHOOT:int = 4;
public static const STATE_GLIDE:int = 4;
public static const DAMAGE_SHIELD:int = 20;
public static const STATE_JUMP:int = 3;
public function Hero(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int){
HIT_RECT = new Rectangle(-9, -47, 18, 63);
HIT_RECT_TOP = new Rectangle(-6, -47, 12, 3);
HIT_RECT_RIGHT = new Rectangle(6, -27, 3, 23);
HIT_RECT_BOTTOM = new Rectangle(-6, 13, 12, 3);
HIT_RECT_LEFT = new Rectangle(-9, -27, 3, 23);
HIT_RECT_BALLON = new Rectangle(-33, -47, 66, 63);
HIT_RECT_TOP_BALLON = new Rectangle(-30, -47, 60, 3);
HIT_RECT_RIGHT_BALLON = new Rectangle(30, -27, 3, 23);
HIT_RECT_BOTTOM_BALLON = new Rectangle(-30, 13, 60, 3);
HIT_RECT_LEFT_BALLON = new Rectangle(-33, -27, 3, 23);
HIT_RECT_ROLL = new Rectangle(-13, -15, 26, 30);
HIT_RECT_TOP_ROLL = new Rectangle(-6, -15, 12, 3);
HIT_RECT_RIGHT_ROLL = new Rectangle(10, -10, 3, 2);
HIT_RECT_BOTTOM_ROLL = new Rectangle(-6, 12, 12, 3);
HIT_RECT_LEFT_ROLL = new Rectangle(-13, -10, 3, 2);
super();
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
x = int(m_posX);
y = int(m_posY);
m_dir = ((_arg3 < 0)) ? DIR_LEFT : DIR_RIGHT;
scaleX = m_dir;
m_stageWidth = _arg4;
m_stageHeight = _arg5;
m_speedYMax = SPEED_MAX_Y;
setLabel(LABEL_IDLE_0);
m_action = ACTION_NONE;
m_doHitArea.visible = false;
m_shield = 0;
m_keyLeftDownTime = 0;
m_keyRightDownTime = 0;
}
private function onKeyUpHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case KEY_LEFT:
m_keyLeftDown = false;
m_keyLeftUp = true;
break;
case KEY_RIGHT:
m_keyRightDown = false;
m_keyRightUp = true;
break;
case KEY_UP:
m_keyUpDown = false;
m_keyUpUp = true;
m_canJump = true;
break;
case KEY_DOWN:
m_keyDownDown = false;
m_keyDownUp = true;
break;
case KEY_ACTION_A:
m_keyActionADown = false;
m_keyActionAUp = true;
break;
case KEY_ACTION_B:
break;
case KEY_CAMERA:
};
}
public function morphBalloon():void{
m_isBalloon = true;
m_isRoll = false;
m_isSeaHorse = false;
m_isGliding = false;
m_isShooting = false;
m_isSliding = false;
m_action = ACTION_NONE;
m_counter = BALLOON_TIME;
m_doAnim.alpha = 1;
}
public function enableKeys():void{
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandler);
EventManager.addEventListener(stage, KeyboardEvent.KEY_UP, onKeyUpHandler);
stage.focus = stage;
}
public function get isSeaHorse():Boolean{
return (m_isSeaHorse);
}
private function shoot():void{
m_isShooting = true;
dispatchEvent(new ShotEvent(ShotEvent.CREATE, (m_posX + (SHOT_DX * m_dir)), (m_posY + SHOT_DY), m_dir));
SoundManager.getInstance().playSound(SoundConfig.SFX_HERO_SHOT);
}
public function setCamera(_arg1:Number, _arg2:Number):void{
m_cameraLeft = Math.round(_arg1);
m_cameraTop = Math.round(_arg2);
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case KEY_LEFT:
if (m_keyLeftUp){
if (((((((getTimer() - m_keyLeftDownTime) < DOUBLE_PRESS_TIME)) && (((m_isOnGround) || (m_isOnPlatform))))) && (!(m_isSliding)))){
m_keyActionBDown = true;
m_keyActionBUp = true;
m_dir = DIR_LEFT;
} else {
m_keyLeftDownTime = getTimer();
m_keyActionBDown = false;
m_keyActionBUp = false;
};
};
m_keyLeftDown = true;
m_keyLeftUp = false;
break;
case KEY_RIGHT:
if (m_keyRightUp){
if (((((((getTimer() - m_keyRightDownTime) < DOUBLE_PRESS_TIME)) && (((m_isOnGround) || (m_isOnPlatform))))) && (!(m_isSliding)))){
m_keyActionBDown = true;
m_keyActionBUp = true;
m_dir = DIR_RIGHT;
} else {
m_keyRightDownTime = getTimer();
m_keyActionBDown = false;
m_keyActionBUp = false;
};
};
m_keyRightDown = true;
m_keyRightUp = false;
break;
case KEY_UP:
m_keyUpDown = true;
break;
case KEY_DOWN:
m_keyDownDown = true;
m_keyDownUp = false;
break;
case KEY_ACTION_A:
m_keyActionADown = true;
break;
case KEY_ACTION_B:
break;
case KEY_CAMERA:
break;
case Keyboard.END:
dispatchEvent(new HeroEvent(HeroEvent.EXIT));
break;
};
}
public function get action():int{
return (m_action);
}
public function canMoveCamera():Boolean{
if (((m_isOnGround) || (m_isOnPlatform))){
return (true);
};
return (false);
}
public function getDamage(_arg1:int):void{
if (!isDefending()){
alpha = 1;
m_shield = MAX_SHIELD_TIME;
if (m_dir == DIR_RIGHT){
m_speedX = -3;
} else {
m_speedX = 3;
};
if (_arg1 == HeroEvent.SIDE_BOTTOM){
m_speedY = -7;
} else {
m_speedY = 3;
};
m_posY = (m_posY + m_speedY);
if (!m_isSeaHorse){
m_isInAir = true;
m_isOnGround = false;
m_isJumping = false;
m_isGliding = false;
m_isBalloon = false;
m_isSliding = false;
m_isShooting = false;
m_action = ACTION_NONE;
};
} else {
m_shield = (MAX_SHIELD_TIME * 0.8);
};
m_isHurted = true;
}
public function onCrushObject():void{
if (m_action == ACTION_ATTACK_SLIDE){
m_jumpAfterCrush = true;
};
}
public function cameraControl(_arg1:Boolean):void{
if (m_isCameraControl != _arg1){
m_isCameraControl = _arg1;
if (m_isCameraControl){
disableKeys();
} else {
enableKeys();
resetKeys();
};
};
}
public function remove():void{
EventManager.removeAllListeners(this);
parent.removeChild(this);
stop();
delete ??getglobalscope
[this];
}
public function get dir():int{
return (m_dir);
}
public function get posX():Number{
return (m_posX);
}
public function stopNextToBlockade(_arg1:int, _arg2:Number, _arg3:int):void{
if ((((((m_dir == -(_arg2))) || (m_isHurted))) || (((m_speedX / _arg2) < 0)))){
m_posX = (_arg1 + (_arg2 * _arg3));
m_speedX = 0;
};
}
public function isAttacking():Boolean{
if (m_action != ACTION_NONE){
return (true);
};
m_attackTime = (getTimer() + 10);
return (false);
}
public function get posY():Number{
return (m_posY);
}
public function get isDead():Boolean{
return (m_isDead);
}
private function checkGround():void{
var _local22:*;
var _local23:*;
var _local24:Number;
var _local25:Number;
var _local26:int;
var _local27:int;
var _local28:Point;
var _local29:int;
var _local30:Point;
var _local31:Number;
if (m_posY > (m_stageHeight - 16)){
return;
};
var _local1:Point = new Point();
var _local2:Point = new Point();
var _local3:Boolean = ((m_rotation == 0)) ? false : true;
m_isOnGround = false;
m_isSliding = false;
m_isInAir = true;
scaleX = 1;
x = int(m_posX);
y = int(m_posY);
rotation = 0;
var _local4:Rectangle = (m_isBalloon) ? HIT_RECT_BALLON : (m_isRoll) ? HIT_RECT_ROLL : HIT_RECT;
var _local5:Rectangle = (m_isBalloon) ? HIT_RECT_LEFT_BALLON : (m_isRoll) ? HIT_RECT_LEFT_ROLL : HIT_RECT_LEFT;
var _local6:Rectangle = (m_isBalloon) ? HIT_RECT_RIGHT_BALLON : (m_isRoll) ? HIT_RECT_RIGHT_ROLL : HIT_RECT_RIGHT;
var _local7:Rectangle = (m_isBalloon) ? HIT_RECT_TOP_BALLON : (m_isRoll) ? HIT_RECT_TOP_ROLL : HIT_RECT_TOP;
var _local8:Rectangle = (m_isBalloon) ? HIT_RECT_BOTTOM_BALLON : (m_isRoll) ? HIT_RECT_BOTTOM_ROLL : HIT_RECT_BOTTOM;
if (((m_isRoll) && ((m_speedY < 0)))){
_local6 = _local6.clone();
_local5 = _local5.clone();
_local6.y = (_local6.y + 20);
_local5.y = (_local5.y + 20);
};
_local1.x = _local4.x;
_local1.y = _local4.y;
_local1 = localToGlobal(_local1);
_local1 = parent.globalToLocal(_local1);
_local2.x = _local1.x;
_local2.y = _local1.y;
var _local9:int = int((_local1.x / View.TILE_SIZE));
var _local10:int = int((_local1.y / View.TILE_SIZE));
var _local11:int = ((_local9 * View.TILE_SIZE) - m_cameraLeft);
var _local12:int = ((_local10 * View.TILE_SIZE) - m_cameraTop);
_local1.x = (_local4.x + _local4.width);
_local1.y = (_local4.y + _local4.height);
_local1 = localToGlobal(_local1);
_local1 = parent.globalToLocal(_local1);
var _local13:int = int((_local1.x / View.TILE_SIZE));
var _local14:int = int((_local1.y / View.TILE_SIZE));
var _local15:int = (((_local13 + 1) * View.TILE_SIZE) - m_cameraLeft);
var _local16:int = (((_local14 + 1) * View.TILE_SIZE) - m_cameraTop);
scaleX = m_dir;
var _local17:BitmapData = new BitmapData((_local15 - _local11), (_local16 - _local12), true, 0);
_local1.x = 0;
_local1.y = 0;
var _local18:Rectangle = new Rectangle();
_local18.x = _local11;
_local18.y = _local12;
_local18.width = (_local15 - _local11);
_local18.height = (_local16 - _local12);
_local17.lock();
_local17.copyPixels(m_bmpTiles.bitmapData, _local18, _local1);
_local18.width = View.TILE_SIZE;
_local18.height = View.TILE_SIZE;
var _local19:int = (_local13 - _local9);
var _local20:int = (_local14 - _local10);
do {
do {
_local22 = (_local13 - _local19);
_local23 = (_local14 - _local20);
if (m_collisionTable[_local23][_local22] == 1){
_local18.x = ((_local22 - _local9) * View.TILE_SIZE);
_local18.y = ((_local23 - _local10) * View.TILE_SIZE);
_local17.fillRect(_local18, 0);
};
--_local19;
} while (_local19 >= 0);
_local19 = (_local13 - _local9);
--_local20;
} while (_local20 >= 0);
_local17.unlock();
var _local21:Rectangle = new Rectangle();
_local21.x = ((_local2.x - m_cameraLeft) - _local11);
_local21.y = ((_local2.y - m_cameraTop) - _local12);
_local21.width = _local4.width;
_local21.height = _local4.height;
if (_local17.hitTest(_local1, 250, _local21)){
_local24 = 0;
_local25 = 0;
if ((((m_speedX > 0)) || ((((m_speedX == 0)) && ((m_dir == DIR_RIGHT)))))){
_local18.x = ((_local21.x + _local6.x) - _local4.x);
_local18.y = ((_local21.y + _local6.y) - _local4.y);
_local18.width = _local6.width;
_local18.height = _local6.height;
if (_local17.hitTest(_local1, 250, _local18)){
do {
_local21.x = (_local21.x - 1);
_local18.x = (_local18.x - 1);
_local24--;
} while (((_local17.hitTest(_local1, 250, _local18)) && ((-(_local24) < (m_speedX + 1)))));
if (m_isRoll){
m_speedX = (-(Math.abs(m_speedX)) * 0.3);
} else {
m_speedX = 0;
};
};
} else {
_local18.x = ((_local21.x + _local5.x) - _local4.x);
_local18.y = ((_local21.y + _local5.y) - _local4.y);
_local18.width = _local5.width;
_local18.height = _local5.height;
if (_local17.hitTest(_local1, 250, _local18)){
do {
_local21.x = (_local21.x + 1);
_local18.x = (_local18.x + 1);
_local24 = (_local24 + 1);
} while (((_local17.hitTest(_local1, 250, _local18)) && ((_local24 < (-(m_speedX) + 1)))));
if (m_isRoll){
m_speedX = (Math.abs(m_speedX) * 0.3);
} else {
m_speedX = 0;
};
};
};
if (m_speedY >= 0){
_local18.x = ((_local21.x + _local8.x) - _local4.x);
_local18.y = ((_local21.y + _local8.y) - _local4.y);
_local18.width = _local8.width;
_local18.height = _local8.height;
if (_local17.hitTest(_local1, 250, _local18)){
do {
_local21.y = (_local21.y - 1);
_local18.y = (_local18.y - 1);
_local25--;
} while (_local17.hitTest(_local1, 250, _local18));
m_isJumping = false;
m_isOnGround = true;
m_isInAir = false;
m_isGliding = false;
_local26 = 30;
_local27 = 0;
_local28 = new Point((_local18.x + 4), (_local18.y + _local18.height));
if (!m_isRoll){
_local28.x = (_local28.x - 4);
};
while (((!(_local17.hitTest(_local1, 250, _local28))) && ((_local27 < _local26)))) {
_local28.y++;
_local27++;
};
_local29 = 0;
_local30 = new Point((_local18.x + 8), (_local18.y + _local18.height));
if (!m_isRoll){
_local30.x = (_local30.x + 4);
};
while (((!(_local17.hitTest(_local1, 250, _local30))) && ((_local29 < _local26)))) {
_local30.y++;
_local29++;
};
_local31 = 0;
if ((((_local29 < _local26)) && ((_local27 < _local26)))){
_local31 = Math.atan2((_local30.y - _local28.y), (_local30.x - _local28.x));
_local31 = ((180 * _local31) / Math.PI);
};
m_rotation = (_local31 / 2);
if (_local31 == 0){
if (m_isRoll){
if (_local3){
m_speedY = (Math.abs(m_speedY) * 0.1);
} else {
if (Math.abs(m_speedY) > 1){
m_speedY = (-(Math.abs(m_speedY)) * 0.6);
} else {
m_speedY = 0;
};
};
} else {
m_speedY = 0;
};
} else {
if (((true) || ((((_local31 < 30)) && ((_local31 > -30)))))){
m_speedY = 10;
if (m_isRoll){
m_speedX = (m_speedX + (1 * ((m_rotation > 0)) ? 1 : -1));
};
} else {
if (m_isRoll){
m_speedY = SLIDE_SPEED_Y;
} else {
m_speedY = SLIDE_SPEED_Y;
};
m_isSliding = true;
m_action = ACTION_NONE;
};
};
} else {
if (_local3){
if (m_isRoll){
m_speedY = (Math.abs(m_speedY) * 0.1);
} else {
if (!m_isGliding){
m_speedY = 0;
};
};
};
};
} else {
_local18.x = ((_local21.x + _local7.x) - _local4.x);
_local18.y = ((_local21.y + _local7.y) - _local4.y);
_local18.width = _local7.width;
_local18.height = _local7.height;
if (_local17.hitTest(_local1, 250, _local18)){
do {
_local21.y = (_local21.y + 1);
_local18.y = (_local18.y + 1);
_local25 = (_local25 + 1);
} while (_local17.hitTest(_local1, 250, _local18));
m_speedY = 0;
};
};
m_posX = (m_posX + _local24);
m_posY = (m_posY + _local25);
};
}
public function get isHurted():Boolean{
return (m_isHurted);
}
public function stopMovement():void{
m_speedX = 0;
m_speedY = 0;
m_action = ACTION_NONE;
m_isShooting = false;
resetKeys();
}
public function die():void{
if (!m_isDead){
m_shield = 0;
alpha = 1;
m_isDead = true;
m_counter = FRAMES_AMOUNT_DEAD;
};
}
public function step():void{
var _local1:Point;
var _local2:Boolean;
if (m_isInExit){
_local1 = new Point();
_local1 = localToGlobal(_local1);
if ((((_local1.x < -20)) || ((_local1.x > (View.VIEW_WIDTH + 20))))){
dispatchEvent(new HeroEvent(HeroEvent.EXIT));
return;
};
};
if (m_isDead){
if (m_counter-- <= 0){
dispatchEvent(new HeroEvent(HeroEvent.DEATH_ANIM_END));
};
return;
};
if (((m_isRoll) || (m_isSeaHorse))){
} else {
if (m_isBalloon){
if (((m_keyActionADown) && (m_keyActionAUp))){
m_isBalloon = false;
m_keyActionAUp = false;
};
} else {
if (((m_keyActionBDown) && (m_keyActionBUp))){
if (((((m_isOnGround) || (m_isOnPlatform))) && (!((m_action == ACTION_ATTACK_SLIDE))))){
m_isShooting = false;
m_action = ACTION_ATTACK_SLIDE;
m_speedX = ((m_dir)==DIR_RIGHT) ? RUN_ATTACK_SPEED : -(RUN_ATTACK_SPEED);
m_keyActionBUp = false;
m_attackTime = getTimer();
};
} else {
if (((m_keyActionADown) && (m_keyActionAUp))){
if ((((m_action == ACTION_NONE)) && (!(m_isCrouching)))){
if (((((m_isOnGround) || (m_isOnPlatform))) || (((m_isInAir) && (!(m_isGliding)))))){
m_action = ACTION_ATTACK_SHOOT;
m_counter = FRAMES_AMOUNT_SHOOT;
shoot();
};
m_keyActionAUp = false;
m_attackTime = getTimer();
};
};
};
};
};
if ((((((m_action == ACTION_ATTACK_STAND_1)) || ((m_action == ACTION_ATTACK_STAND_2)))) || ((m_action == ACTION_ATTACK_SHOOT)))){
m_counter--;
if (m_counter <= 0){
m_action = ACTION_NONE;
m_doShield = null;
m_isShooting = false;
};
};
if (((m_isBalloon) && ((m_counter > 0)))){
m_counter--;
if (m_counter <= 0){
m_isBalloon = false;
m_doAnim.alpha = 1;
} else {
if (m_counter < 20){
m_doAnim.alpha = (((m_counter % 2) < 1)) ? 1 : 0;
} else {
if (m_counter < 40){
m_doAnim.alpha = (((m_counter % 4) < 2)) ? 1 : 0;
};
};
};
};
m_maxSpeed = (m_isBalloon) ? (RUN_SPEED * 0.7) : RUN_SPEED;
m_speedDX = (m_isBalloon) ? (SPEED_DX * 0.7) : SPEED_DX;
if (m_jumpAfterCrush){
m_jumpAfterCrush = false;
m_speedX = (-(m_dir) * 2);
m_speedY = -7;
m_isJumping = true;
m_isInAir = true;
m_isOnGround = false;
m_isSliding = false;
m_isBalloon = false;
};
if (m_action == ACTION_ATTACK_SLIDE){
if (m_isInAir){
m_action = ACTION_NONE;
};
if (Math.abs(m_speedX) > 5){
m_speedX = (m_speedX - (m_speedX * 0.05));
} else {
m_action = ACTION_NONE;
};
} else {
if (((((m_keyLeftDown) && (!(m_isHurted)))) && ((((m_action == ACTION_NONE)) || ((m_action == ACTION_ATTACK_SHOOT)))))){
m_dir = DIR_LEFT;
m_speedX = (m_speedX - ((m_speedX)>0) ? (2 * m_speedDX) : m_speedDX);
m_speedX = Math.max(-(m_maxSpeed), m_speedX);
} else {
if (((((m_keyRightDown) && (!(m_isHurted)))) && ((((m_action == ACTION_NONE)) || ((m_action == ACTION_ATTACK_SHOOT)))))){
m_dir = DIR_RIGHT;
m_speedX = (m_speedX + ((m_speedX)<0) ? (2 * m_speedDX) : m_speedDX);
m_speedX = Math.min(m_maxSpeed, m_speedX);
} else {
if (!m_isSliding){
if (Math.abs(m_speedX) > 0.5){
if (!m_isInAir){
m_speedX = (m_speedX - (m_speedX * 0.4));
} else {
m_speedX = (m_speedX - (m_speedX * 0.05));
};
} else {
m_speedX = 0;
};
};
};
};
};
if (m_speedX > SPEED_MAX_X){
m_speedX = SPEED_MAX_X;
} else {
if (m_speedX < -(SPEED_MAX_X)){
m_speedX = -(SPEED_MAX_X);
};
};
if (((m_keyUpDown) && (!(m_isBalloon)))){
_local2 = false;
if (m_isSeaHorse){
if (((m_isInAcid) && (!(m_isJumping)))){
if (m_distanceToSurface < 24){
_local2 = true;
} else {
m_speedDY = -(SPEED_DY);
};
};
};
if (((((((m_keyUpUp) && (!(m_isJumping)))) && (m_canJump))) && (((((!(m_isInAir)) && (!(m_isSeaHorse)))) || (_local2))))){
m_canJump = false;
m_isJumping = true;
if (m_isRoll){
m_speedY = ROLL_JUMP_SPEED;
} else {
if (m_isSeaHorse){
m_speedY = SEA_HORSE_JUMP_SPEED;
} else {
m_speedY = JUMP_SPEED;
};
};
m_keyUpUp = false;
if (m_action == ACTION_ATTACK_SLIDE){
m_action = ACTION_NONE;
};
SoundManager.getInstance().playSound(SoundConfig.SFX_JUMP);
} else {
if (((((((((((m_keyUpUp) && (m_isInAir))) && (!(m_isGliding)))) && (!(m_isHurted)))) && (!(m_isRoll)))) && (!(m_isSeaHorse)))){
m_isGliding = true;
m_keyUpUp = false;
m_speedY = 0;
};
};
} else {
if (((((((((((((m_keyDownDown) && (((m_isOnGround) || (m_isOnPlatform))))) && (!(m_isCrouching)))) && (!((m_action == ACTION_ATTACK_SLIDE))))) && (!(m_isBalloon)))) && (!(m_isRoll)))) && (!(m_isSeaHorse)))){
m_isCrouching = true;
} else {
if (((((m_keyDownDown) && (m_isInAcid))) && (!(m_isJumping)))){
m_speedDY = SPEED_DY;
} else {
if (((m_keyDownUp) && (m_isCrouching))){
m_isCrouching = false;
} else {
if (((m_keyUpUp) && (m_isGliding))){
m_isGliding = false;
};
};
};
};
};
if (((m_isInAcid) && (!(m_isJumping)))){
if (m_distanceToSurface < 24){
m_speedDY = SPEED_DY;
};
m_speedY = (m_speedY + m_speedDY);
if (m_speedDY == 0){
m_speedY = (m_speedY - (m_speedY * 0.2));
};
m_speedDY = 0;
};
if (m_isGliding){
m_speedY = (m_speedY + (Config.GRAVITY * 0.1));
} else {
if (m_isBalloon){
m_speedY = BALLON_SPEED_Y;
} else {
if (((m_isSeaHorse) && (m_isInAcid))){
} else {
if (!m_isOnPlatform){
m_speedY = (m_speedY + Config.GRAVITY);
};
};
};
};
m_speedYMax = SPEED_MAX_Y;
if (m_isGliding){
m_speedYMax = SPEED_MAX_Y_GLIDING;
} else {
if (((((m_isSeaHorse) && (m_isInAcid))) && (!(m_isJumping)))){
m_speedYMax = SPEED_MAX_Y_ACID;
};
};
if (m_speedY > m_speedYMax){
m_speedY = m_speedYMax;
} else {
if (m_speedY < -(m_speedYMax)){
m_speedY = -(m_speedYMax);
};
};
if (m_isCrouching){
m_speedX = 0;
} else {
if (m_isSliding){
if (m_rotation > 0){
m_speedX = (m_speedX + 3);
if (m_speedX > SLIDE_SPEED_X){
m_speedX = SLIDE_SPEED_X;
};
m_dir = DIR_RIGHT;
} else {
m_speedX = (m_speedX - 3);
if (m_speedX < -(SLIDE_SPEED_X)){
m_speedX = -(SLIDE_SPEED_X);
};
m_dir = DIR_LEFT;
};
};
};
if (((((((m_isOnGround) || (m_isInAir))) || (m_isJumping))) || (m_isInAcid))){
m_posX = (m_posX + m_speedX);
m_posY = (m_posY + m_speedY);
} else {
if (m_isOnPlatform){
m_posX = (m_posX + m_speedX);
};
};
checkGround();
if (m_posX < 16){
m_posX = 16;
m_speedX = 0;
} else {
if (m_posX > (m_stageWidth - 16)){
m_posX = (m_stageWidth - 16);
m_speedX = 0;
};
};
if (m_posY > (m_stageHeight + 44)){
m_posY = (m_stageHeight + 44);
m_speedY = 0;
m_isOnGround = true;
m_isInAir = false;
m_isGliding = false;
m_isJumping = false;
dispatchEvent(new HeroEvent(HeroEvent.DAMAGE, 1));
};
m_isOnPlatform = false;
m_isEnemyClose = false;
m_isCameraControl = false;
m_isInAcid = false;
}
public function get speedY():Number{
return (m_speedY);
}
public function disableKeys():void{
EventManager.removeEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandler);
EventManager.removeEventListener(stage, KeyboardEvent.KEY_UP, onKeyUpHandler);
}
public function gotoExit(_arg1:int):void{
m_dir = _arg1;
m_isInExit = true;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUpHandler);
resetKeys();
if (m_dir == DIR_RIGHT){
m_keyRightDown = true;
} else {
m_keyLeftDown = true;
};
m_action = ACTION_NONE;
}
public function onBumper(_arg1:Number, _arg2:Number):void{
m_isInAir = true;
m_isJumping = true;
m_isOnGround = false;
m_isGliding = false;
m_speedY = _arg2;
m_speedX = (m_speedX + _arg1);
m_rotation = 0;
}
public function setSpeed(_arg1:Number, _arg2:Number):void{
m_speedX = _arg1;
m_speedY = _arg2;
}
public function init(_arg1:Bitmap, _arg2:Array):void{
m_bmpTiles = _arg1;
m_collisionTable = _arg2;
EventManager.addEventListener(this, Event.ADDED_TO_STAGE, onAddedToStage);
m_isOnGround = true;
}
public function get attackTime():int{
return (m_attackTime);
}
public function stopNextToDoor(_arg1:int, _arg2:Number):void{
if ((((((m_dir == -(_arg2))) || (m_isHurted))) || (((m_speedX / _arg2) < 0)))){
m_posX = (_arg1 + (_arg2 * 32));
m_speedX = 0;
};
}
public function enemyClose():void{
m_isEnemyClose = true;
}
public function isInAcid(_arg1:int):void{
m_isInAcid = true;
m_distanceToSurface = _arg1;
if (_arg1 > 24){
m_isJumping = false;
m_isInAir = false;
};
}
public function reset(_arg1:Number, _arg2:Number, _arg3:int):void{
m_posX = ((_arg1 + 0.5) * View.TILE_SIZE);
m_posY = ((_arg2 + 0.5) * View.TILE_SIZE);
x = int(m_posX);
y = int(m_posY);
m_dir = ((_arg3 < 0)) ? DIR_LEFT : DIR_RIGHT;
scaleX = m_dir;
setLabel(LABEL_IDLE_0);
m_action = ACTION_NONE;
m_doHitArea.visible = false;
m_shield = 0;
m_rotation = 0;
m_maxSpeed = 0;
m_speedX = 0;
m_speedDX = 0;
m_speedY = 0;
m_speedDY = 0;
m_platformSpeedX = 0;
m_canJump = true;
m_isJumping = false;
m_isCrouching = false;
m_isGliding = false;
m_jumpAfterCrush = false;
m_isHurted = false;
m_isDead = false;
m_isOnGround = true;
m_isSliding = false;
m_isShooting = false;
m_isEnemyClose = false;
m_isBalloon = false;
m_isRoll = false;
m_isSeaHorse = false;
}
public function isDefending():Boolean{
return (m_isCrouching);
}
public function draw():void{
x = int(m_posX);
y = int(m_posY);
if (((((m_isRoll) && ((m_doAnim.currentFrame > 9)))) && (!(m_isDead)))){
scaleX = 1;
m_rotationRoll = (m_rotationRoll + ((180 * (m_speedX / 15)) / Math.PI));
rotation = m_rotationRoll;
} else {
if (((!((m_speedX == 0))) && (m_isOnGround))){
scaleX = m_dir;
rotation = 0;
};
};
m_doAnim.nextFrame();
if (m_doAnim.currentFrame == m_doAnim.totalFrames){
m_doAnim.gotoAndStop(1);
};
if ((((m_label == LABEL_WALK)) && ((((m_doAnim.currentFrame == 6)) || ((m_doAnim.currentFrame == 16)))))){
SoundManager.getInstance().playSound(SoundConfig.SFX_FOOT_STEPS);
} else {
if ((((m_label == LABEL_RUN)) && ((((m_doAnim.currentFrame == 1)) || ((m_doAnim.currentFrame == 9)))))){
SoundManager.getInstance().playSound(SoundConfig.SFX_FOOT_STEPS);
};
};
if (m_isDead){
setLabel(LABEL_DEAD);
} else {
if (m_isRoll){
setLabel(LABEL_ROLL);
} else {
if (m_isSeaHorse){
setLabel(LABEL_SEA_HORSE);
} else {
if (((m_isHurted) && (!(isDefending())))){
setLabel(LABEL_HIT);
} else {
if (m_action == ACTION_ATTACK_SLIDE){
setLabel(LABEL_ATTACK_SLIDE);
if (m_doAnim){
m_doShield = m_doAnim.m_doShield;
};
} else {
if (m_action == ACTION_ATTACK_STAND_1){
setLabel(LABEL_ATTACK_STAND_1);
if (m_doAnim){
m_doShield = m_doAnim.m_doShield;
};
} else {
if (m_action == ACTION_ATTACK_STAND_2){
setLabel(LABEL_ATTACK_STAND_2);
if (m_doAnim){
m_doShield = m_doAnim.m_doShield;
};
} else {
if (m_isSliding){
setLabel(LABEL_SLIDE_DOWN);
} else {
if (m_isGliding){
setLabel(LABEL_GLIDE);
} else {
if (m_isBalloon){
setLabel(LABEL_BALLOON);
} else {
if (((m_isJumping) || (m_isInAir))){
m_rotation = 0;
if (m_isShooting){
setLabel(LABEL_SHOOT_JUMP);
} else {
setLabel(LABEL_JUMP);
};
} else {
if (m_isCrouching){
setLabel(LABEL_CROUCH);
} else {
if (m_isShooting){
if (Math.abs(m_speedX) <= 0.5){
setLabel(LABEL_SHOOT_STAND);
m_speedX = 0;
} else {
setLabel(LABEL_SHOOT_RUN);
};
} else {
if (Math.abs(m_speedX) == 0){
setLabel(LABEL_IDLE_0);
} else {
if (Math.abs(m_speedX) <= WALK_SPEED){
if ((((((m_speedX > 0)) && (m_keyLeftDown))) || ((((m_speedX < 0)) && (m_keyRightDown))))){
setLabel(LABEL_SLIDE);
} else {
setLabel(LABEL_WALK);
};
} else {
if ((((((m_speedX > 0)) && (m_keyLeftDown))) || ((((m_speedX < 0)) && (m_keyRightDown))))){
setLabel(LABEL_SLIDE);
} else {
setLabel(LABEL_RUN);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (m_shield > 0){
m_shield--;
if (m_shield > (MAX_SHIELD_TIME * 0.75)){
m_isHurted = true;
} else {
if (m_shield > (MAX_SHIELD_TIME * 0.5)){
m_isHurted = false;
alpha = (((m_shield % 6) > 2)) ? 0 : 1;
} else {
if (m_shield > (MAX_SHIELD_TIME * 0.2)){
alpha = (((m_shield % 4) > 1)) ? 0 : 1;
} else {
alpha = (((m_shield % 2) > 0)) ? 0 : 1;
};
};
};
};
}
public function disableRoll():void{
m_isRoll = false;
}
public function isOnGround():Boolean{
return (m_isOnGround);
}
public function onPlatform(_arg1:Number, _arg2:Number, _arg3:Number):void{
m_isOnPlatform = true;
m_isJumping = false;
m_isInAir = false;
m_isGliding = false;
m_posX = (m_posX + _arg2);
m_posY = (m_posY - _arg1);
m_speedY = _arg3;
m_platformSpeedX = _arg2;
}
public function morphRoll():void{
m_isRoll = true;
m_isBalloon = false;
m_isSeaHorse = false;
m_isGliding = false;
m_isShooting = false;
m_isSliding = false;
m_action = ACTION_NONE;
m_rotationRoll = 0;
m_doAnim.alpha = 1;
}
private function onAddedToStage(_arg1:Event):void{
EventManager.removeEventListener(this, Event.ADDED_TO_STAGE, onAddedToStage);
enableKeys();
}
public function isSlideAttack():Boolean{
if (m_action == ACTION_ATTACK_SLIDE){
return (true);
};
return (false);
}
public function get doShield():Sprite{
return (m_doShield);
}
public function isProtected():Boolean{
if ((((((m_shield > 0)) || (m_isDead))) || (m_isInExit))){
return (true);
};
return (false);
}
private function setLabel(_arg1:String):void{
if (m_label != _arg1){
m_label = _arg1;
gotoAndStop(m_label);
};
}
public function disableSeaHorse():void{
m_isSeaHorse = false;
}
public function resetKeys():void{
m_keyLeftDown = false;
m_keyRightDown = false;
m_keyUpDown = false;
m_keyDownDown = false;
m_keyActionADown = false;
m_keyActionBDown = false;
m_keyCameraDown = false;
m_keyLeftUp = true;
m_keyRightUp = true;
m_keyUpUp = true;
m_keyDownUp = true;
m_keyActionAUp = true;
m_keyActionBUp = true;
m_keyCameraUp = true;
}
public function morphSeaHorse():void{
m_isSeaHorse = true;
m_isRoll = false;
m_isBalloon = false;
m_isGliding = false;
m_isShooting = false;
m_isSliding = false;
m_action = ACTION_NONE;
m_rotationRoll = 0;
m_doAnim.alpha = 1;
}
}
}//package game.activeobjects
Section 108
//HeroBoy (game.activeobjects.HeroBoy)
package game.activeobjects {
public class HeroBoy extends Hero {
public function HeroBoy(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
}
}//package game.activeobjects
Section 109
//HeroGirl (game.activeobjects.HeroGirl)
package game.activeobjects {
public class HeroGirl extends Hero {
public function HeroGirl(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:int){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
}
}//package game.activeobjects
Section 110
//Secret (game.activeobjects.Secret)
package game.activeobjects {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import data.*;
import caurina.transitions.*;
import events.*;
import game.view.*;
public class Secret extends EventDispatcher {
private var m_info:SecretData;
private var m_gridY:int;
private var m_isExposed:Boolean;
private var m_gridX:int;
private var m_hero:Hero;
private var m_isVisited:Boolean;
private var m_posX:int;
private var m_posY:int;
private var m_asset:Bitmap;
public static const EVENT_SHOW_SECRET:String = "onShowSecret";
public function Secret(_arg1:SecretData, _arg2:Bitmap, _arg3:Hero){
m_info = _arg1;
m_hero = _arg3;
m_gridX = _arg1.rect.x;
m_gridY = _arg1.rect.y;
m_posX = (m_gridX * View.TILE_SIZE);
m_posY = (m_gridY * View.TILE_SIZE);
m_isVisited = false;
m_isExposed = false;
m_asset = _arg2;
m_asset.x = m_posX;
m_asset.y = m_posY;
}
public function draw():void{
}
private function showSecret():void{
dispatchEvent(new ObjectEvent(EVENT_SHOW_SECRET, {secretId:m_info.id}));
Tweener.addTween(m_asset, {time:1, alpha:0});
}
private function hideSecret():void{
Tweener.addTween(m_asset, {time:1, alpha:1});
}
public function remove():void{
m_asset.parent.removeChild(m_asset);
m_asset = null;
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED));
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local5:Rectangle = new Rectangle(_arg1, _arg2, ((_arg3 - _arg1) + 1), ((_arg4 - _arg2) + 1));
if (areRectsOverlapping(_local5, m_info.rect)){
if (!m_asset.visible){
m_asset.visible = true;
};
_local6 = int((m_hero.posX / View.TILE_SIZE));
_local7 = int((m_hero.posY / View.TILE_SIZE));
_local8 = 0;
while (_local8 < m_info.entrances.length) {
_local9 = m_info.entrances[_local8].x;
_local10 = m_info.entrances[_local8].y;
if ((((((((_local9 > _arg1)) && ((_local9 < _arg3)))) && ((_local10 > _arg2)))) && ((_local10 < _arg4)))){
if ((((_local9 == _local6)) && ((_local10 == _local7)))){
if (!m_isExposed){
m_isExposed = true;
showSecret();
};
if (!m_isVisited){
m_isVisited = true;
};
};
};
_local8++;
};
if (((m_isExposed) && ((((((((_local6 < m_info.rect.x)) || ((_local6 > ((m_info.rect.x + m_info.rect.width) - 1))))) || ((_local7 < m_info.rect.y)))) || ((_local7 > ((m_info.rect.y + m_info.rect.height) - 1))))))){
m_isExposed = false;
hideSecret();
};
} else {
if (m_asset.visible){
m_asset.visible = false;
};
};
}
public function makeVisible():void{
m_asset.visible = true;
}
private function areRectsOverlapping(_arg1:Rectangle, _arg2:Rectangle):Boolean{
var _local3:int = _arg1.x;
var _local4:int = _arg1.y;
var _local5:int = (_arg1.x + _arg1.width);
var _local6:int = (_arg1.y + _arg1.height);
var _local7:int = _arg2.x;
var _local8:int = _arg2.y;
var _local9:int = (_arg2.x + _arg2.width);
var _local10:int = (_arg2.y + _arg2.height);
if ((((((((_local7 <= _local5)) && ((_local3 <= _local9)))) && ((_local8 <= _local6)))) && ((_local4 <= _local10)))){
return (true);
};
return (false);
}
}
}//package game.activeobjects
Section 111
//View (game.view.View)
package game.view {
import flash.display.*;
import flash.geom.*;
import events.*;
import game.*;
public class View extends MovieClip {
private const POINT_00:Point;
private const CAMERA_TARGET_DY:int = 40;
private const CAMERA_TARGET_DX:int = 0;
private var m_objectsDrawable:Sprite;
private var m_cameraX:Number;
private var m_objectsFront:Sprite;
private var m_cameraY:Number;
private var m_cameraDX:int;
private var m_cameraDY:int;
private var m_bmdBackBuffer:BitmapData;
private var m_bmdScreenBuffer:BitmapData;
private var m_cameraDestY:Number;
private var m_targetY:Number;
private var m_bmdTiles:BitmapData;
private var m_heroLayer:Sprite;
private var m_targetX:Number;
private var m_bmdBackground:BitmapData;
private var m_bufferTileX:int;
private var m_bufferTileY:int;
private var m_point:Point;
private var m_objectsBack:Sprite;
private var m_bmdTileset:BitmapData;
private var m_bufferDX:int;
private var m_bufferDY:int;
private var m_bmpBackTiles:Bitmap;
private var m_canvas:BitmapData;
private var m_rect:Rectangle;
private var m_delayedMove:Boolean;
private var m_bmpTiles:Bitmap;
private var m_cameraTop:int;
private var m_levelWidth:int;
private var m_canvasHolder:Bitmap;
private var m_backgroundFar:Sprite;
private var m_shake:Boolean;
private var m_cameraLeft:int;
private var m_secretsLayer:Sprite;
private var m_backgroundFarScaleX:Number;
private var m_backgroundFarScaleY:Number;
private var m_targetDir:int;
private var m_bmdBackTiles:BitmapData;
private var m_levelHeight:int;
private var m_levelData:Array;
private var m_cameraDestX:Number;
public static const VIEW_HEIGHT:int = 440;
public static const VIEW_COLUMNS:int = (int((VIEW_WIDTH / TILE_SIZE)) + 1);
public static const LAYER_HERO:int = 1;
public static const LAYER_DRAWABLE:int = 3;
public static const TILE_SIZE:int = 32;
public static const VIEW_WIDTH:int = 605;
public static const LAYER_BACK:int = 0;
public static const VIEW_ROWS:int = (int((VIEW_HEIGHT / TILE_SIZE)) + 1);
public static const LAYER_FRONT:int = 2;
public static const LAYER_SECRETS:int = 4;
public function View(){
POINT_00 = new Point(0, 0);
m_point = new Point();
m_rect = new Rectangle();
super();
scrollRect = new Rectangle(0, 0, VIEW_WIDTH, VIEW_HEIGHT);
}
private function addColumnRight():void{
var _local1:BitmapData;
var _local3:int;
m_rect.x = TILE_SIZE;
m_rect.y = 0;
m_rect.width = (m_bmdScreenBuffer.width - TILE_SIZE);
m_rect.height = m_bmdScreenBuffer.height;
m_point.x = 0;
m_point.y = 0;
_local1 = m_bmdScreenBuffer.clone();
m_bmdScreenBuffer.fillRect(m_bmdScreenBuffer.rect, 0);
m_bmdScreenBuffer.copyPixels(_local1, m_rect, m_point);
_local1 = m_bmdBackBuffer.clone();
m_bmdBackBuffer.fillRect(m_bmdBackBuffer.rect, 0);
m_bmdBackBuffer.copyPixels(_local1, m_rect, m_point);
_local1.dispose();
var _local2:int;
while (_local2 < (VIEW_ROWS + 1)) {
if (((((_local2 + m_bufferTileY) < m_levelHeight)) && (((m_bufferTileX + VIEW_COLUMNS) < m_levelWidth)))){
_local3 = m_levelData[Game.LAYER_WALLS][(_local2 + m_bufferTileY)][(m_bufferTileX + VIEW_COLUMNS)];
drawTile(m_bmdScreenBuffer, _local3, (VIEW_COLUMNS * TILE_SIZE), (_local2 * TILE_SIZE));
_local3 = m_levelData[Game.LAYER_BACK][(_local2 + m_bufferTileY)][(m_bufferTileX + VIEW_COLUMNS)];
drawTile(m_bmdBackBuffer, _local3, (VIEW_COLUMNS * TILE_SIZE), (_local2 * TILE_SIZE));
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (m_bufferTileX + VIEW_COLUMNS), (_local2 + m_bufferTileY)));
if ((m_bufferTileX + VIEW_COLUMNS) < (m_levelWidth - 2)){
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, ((m_bufferTileX + VIEW_COLUMNS) + 1), (_local2 + m_bufferTileY)));
};
};
_local2++;
};
}
public function get bufferTileX():int{
return (m_bufferTileX);
}
private function addColumnLeft():void{
var _local1:BitmapData;
var _local3:int;
m_rect.x = 0;
m_rect.y = 0;
m_rect.width = (m_bmdScreenBuffer.width - TILE_SIZE);
m_rect.height = m_bmdScreenBuffer.height;
m_point.x = TILE_SIZE;
m_point.y = 0;
_local1 = m_bmdScreenBuffer.clone();
m_bmdScreenBuffer.fillRect(m_bmdScreenBuffer.rect, 0);
m_bmdScreenBuffer.copyPixels(_local1, m_rect, m_point);
_local1 = m_bmdBackBuffer.clone();
m_bmdBackBuffer.fillRect(m_bmdBackBuffer.rect, 0);
m_bmdBackBuffer.copyPixels(_local1, m_rect, m_point);
_local1.dispose();
var _local2:int;
while (_local2 < (VIEW_ROWS + 1)) {
if ((_local2 + m_bufferTileY) < m_levelHeight){
_local3 = m_levelData[Game.LAYER_WALLS][(_local2 + m_bufferTileY)][m_bufferTileX];
drawTile(m_bmdScreenBuffer, _local3, 0, (_local2 * TILE_SIZE));
_local3 = m_levelData[Game.LAYER_BACK][(_local2 + m_bufferTileY)][m_bufferTileX];
drawTile(m_bmdBackBuffer, _local3, 0, (_local2 * TILE_SIZE));
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, m_bufferTileX, (_local2 + m_bufferTileY)));
if (m_bufferTileX > 0){
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (m_bufferTileX - 1), (_local2 + m_bufferTileY)));
};
};
_local2++;
};
}
public function init(_arg1:Array, _arg2:Point, _arg3:int, _arg4:BitmapData, _arg5:BitmapData):void{
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:BitmapData;
var _local14:Point;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
m_shake = false;
m_levelData = _arg1;
m_levelWidth = m_levelData[0][0].length;
m_levelHeight = m_levelData[0].length;
m_targetX = _arg2.x;
m_targetY = _arg2.y;
m_targetDir = _arg3;
m_cameraX = (m_targetX + (m_targetDir * CAMERA_TARGET_DX));
m_cameraY = (m_targetY - CAMERA_TARGET_DY);
m_cameraDestX = m_cameraX;
m_cameraDestY = m_cameraY;
m_cameraDX = (VIEW_WIDTH >> 1);
m_cameraDY = (VIEW_HEIGHT >> 1);
m_cameraLeft = (m_cameraX - m_cameraDX);
if (m_cameraLeft < 0){
m_cameraLeft = 0;
};
m_cameraTop = (m_cameraY - m_cameraDY);
if (m_cameraTop < 0){
m_cameraTop = 0;
};
if ((m_cameraTop + VIEW_HEIGHT) > (m_levelHeight * TILE_SIZE)){
m_cameraTop = ((m_levelHeight * TILE_SIZE) - VIEW_HEIGHT);
};
m_bufferDX = (m_cameraLeft % 32);
m_bufferDY = (m_cameraTop % 32);
m_bufferTileX = (m_cameraLeft >> 5);
m_bufferTileY = (m_cameraTop >> 5);
m_bmdTileset = _arg5;
m_bmdBackground = _arg4.clone();
m_backgroundFarScaleX = ((m_bmdBackground.width - VIEW_WIDTH) / (m_levelWidth * TILE_SIZE));
m_backgroundFarScaleY = ((m_bmdBackground.height - VIEW_HEIGHT) / (m_levelHeight * TILE_SIZE));
m_bmdBackTiles = new BitmapData(VIEW_WIDTH, VIEW_HEIGHT, true, 0);
m_bmpBackTiles = new Bitmap(m_bmdBackTiles);
addChild(m_bmpBackTiles);
m_objectsDrawable = new Sprite();
addChild(m_objectsDrawable);
m_objectsDrawable.x = -(m_cameraLeft);
m_objectsDrawable.y = -(m_cameraTop);
m_objectsDrawable.visible = false;
m_objectsBack = new Sprite();
addChild(m_objectsBack);
m_objectsBack.x = -(m_cameraLeft);
m_objectsBack.y = -(m_cameraTop);
m_heroLayer = new Sprite();
addChild(m_heroLayer);
m_heroLayer.x = -(m_cameraLeft);
m_heroLayer.y = -(m_cameraTop);
m_bmdTiles = new BitmapData(VIEW_WIDTH, VIEW_HEIGHT, true, 0);
m_bmpTiles = new Bitmap(m_bmdTiles);
addChild(m_bmpTiles);
m_objectsFront = new Sprite();
addChild(m_objectsFront);
m_objectsFront.x = -(m_cameraLeft);
m_objectsFront.y = -(m_cameraTop);
m_secretsLayer = new Sprite();
addChild(m_secretsLayer);
m_secretsLayer.x = -(m_cameraLeft);
m_secretsLayer.y = -(m_cameraTop);
m_bmdBackBuffer = new BitmapData(((VIEW_COLUMNS + 1) * TILE_SIZE), ((VIEW_ROWS + 1) * TILE_SIZE), true, 0);
m_bmdScreenBuffer = new BitmapData(((VIEW_COLUMNS + 1) * TILE_SIZE), ((VIEW_ROWS + 1) * TILE_SIZE), true, 0);
var _local6:int;
while (_local6 < (VIEW_ROWS + 1)) {
if ((_local6 + m_bufferTileY) < m_levelHeight){
_local15 = 0;
while (_local15 < (VIEW_COLUMNS + 1)) {
_local16 = m_levelData[Game.LAYER_WALLS][(_local6 + m_bufferTileY)][(_local15 + m_bufferTileX)];
_local17 = (_local16 & 0xFF);
_local18 = (_local16 >> 8);
if ((((_local17 < 0xFF)) && ((_local18 < 0xFF)))){
m_bmdScreenBuffer.copyPixels(m_bmdTileset, new Rectangle((_local17 * TILE_SIZE), (_local18 * TILE_SIZE), TILE_SIZE, TILE_SIZE), new Point((_local15 * TILE_SIZE), (_local6 * TILE_SIZE)));
};
_local16 = m_levelData[Game.LAYER_BACK][(_local6 + m_bufferTileY)][(_local15 + m_bufferTileX)];
_local17 = (_local16 & 0xFF);
_local18 = (_local16 >> 8);
if ((((_local17 < 0xFF)) && ((_local18 < 0xFF)))){
m_bmdBackBuffer.copyPixels(m_bmdTileset, new Rectangle((_local17 * TILE_SIZE), (_local18 * TILE_SIZE), TILE_SIZE, TILE_SIZE), new Point((_local15 * TILE_SIZE), (_local6 * TILE_SIZE)));
};
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (_local15 + m_bufferTileX), (_local6 + m_bufferTileY)));
_local15++;
};
};
_local6++;
};
}
public function get bufferTileY():int{
return (m_bufferTileY);
}
private function drawTile(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
_local5 = (_arg2 & 0xFF);
_local6 = (_arg2 >> 8);
if ((((_local5 < 0xFF)) && ((_local6 < 0xFF)))){
m_rect.x = (_local5 * TILE_SIZE);
m_rect.y = (_local6 * TILE_SIZE);
m_rect.width = TILE_SIZE;
m_rect.height = TILE_SIZE;
m_point.x = _arg3;
m_point.y = _arg4;
_arg1.copyPixels(m_bmdTileset, m_rect, m_point);
};
}
public function getGroundBitmap():BitmapData{
return (m_bmdScreenBuffer);
}
private function stepCamera(_arg1:Number, _arg2:Number, _arg3:int):void{
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:int;
m_cameraDestX = (_arg1 + (_arg3 * CAMERA_TARGET_DX));
m_cameraDestY = (_arg2 - CAMERA_TARGET_DY);
if (m_delayedMove){
m_cameraX = (m_cameraX + ((m_cameraDestX - m_cameraX) * 0.1));
m_cameraY = (m_cameraY + ((m_cameraDestY - m_cameraY) * 0.3));
} else {
_local4 = ((m_cameraDestX - m_cameraX) * 0.15);
if (_local4 > 64){
_local4 = 64;
} else {
if (_local4 < -64){
_local4 = -64;
};
};
_local5 = ((m_cameraDestY - m_cameraY) * 0.15);
if (_local5 > 64){
_local5 = 64;
} else {
if (_local5 < -64){
_local5 = -64;
};
};
m_cameraX = (m_cameraX + _local4);
m_cameraY = (m_cameraY + _local5);
};
if ((((Math.abs((m_cameraDestX - m_cameraX)) < 25)) && ((Math.abs((m_cameraDestY - m_cameraY)) < 25)))){
dispatchEvent(new ViewEvent(ViewEvent.CAMERA_ON_TARGET));
};
if (m_delayedMove){
m_cameraLeft = ((m_cameraX - m_cameraDX) + (2 * (m_cameraDestX - m_cameraX)));
} else {
_local4 = (m_cameraDestX - m_cameraX);
if (_local4 > 32){
_local4 = 32;
} else {
if (_local4 < -32){
_local4 = -32;
};
};
m_cameraLeft = ((m_cameraX - m_cameraDX) + (2 * _local4));
};
if (m_cameraLeft < 0){
m_cameraLeft = 0;
} else {
if (m_cameraLeft > ((m_levelWidth * TILE_SIZE) - VIEW_WIDTH)){
m_cameraLeft = ((m_levelWidth * TILE_SIZE) - VIEW_WIDTH);
};
};
m_cameraTop = (m_cameraY - m_cameraDY);
if (m_cameraTop < 0){
m_cameraTop = 0;
} else {
if (m_cameraTop > ((m_levelHeight * TILE_SIZE) - VIEW_HEIGHT)){
m_cameraTop = ((m_levelHeight * TILE_SIZE) - VIEW_HEIGHT);
};
};
if ((((((((_arg1 > m_cameraLeft)) && ((_arg1 < (m_cameraLeft + VIEW_WIDTH))))) && ((_arg2 > m_cameraTop)))) && ((_arg2 < (m_cameraTop + VIEW_HEIGHT))))){
dispatchEvent(new ViewEvent(ViewEvent.TARGET_ON_SCREEN));
};
m_bufferDX = (m_cameraLeft & 31);
m_bufferDY = (m_cameraTop & 31);
if ((m_cameraLeft >> 5) > m_bufferTileX){
_local6 = ((m_cameraLeft >> 5) - m_bufferTileX);
_local7 = 0;
while (_local7 < _local6) {
m_bufferTileX++;
addColumnRight();
_local7++;
};
} else {
if ((m_cameraLeft >> 5) < m_bufferTileX){
_local6 = (m_bufferTileX - (m_cameraLeft >> 5));
_local7 = 0;
while (_local7 < _local6) {
m_bufferTileX--;
addColumnLeft();
_local7++;
};
} else {
m_bufferTileX = (m_cameraLeft >> 5);
};
};
if ((m_cameraTop >> 5) > m_bufferTileY){
_local6 = ((m_cameraTop >> 5) - m_bufferTileY);
_local7 = 0;
while (_local7 < _local6) {
m_bufferTileY++;
addBottomRow();
_local7++;
};
} else {
if ((m_cameraTop >> 5) < m_bufferTileY){
_local6 = (m_bufferTileY - (m_cameraTop >> 5));
_local7 = 0;
while (_local7 < _local6) {
m_bufferTileY--;
addUpperRow();
_local7++;
};
} else {
m_bufferTileY = (m_cameraTop >> 5);
};
};
}
private function addBottomRow():void{
var _local1:BitmapData;
var _local3:int;
m_rect.x = 0;
m_rect.y = TILE_SIZE;
m_rect.width = m_bmdScreenBuffer.width;
m_rect.height = (m_bmdScreenBuffer.height - TILE_SIZE);
m_point.x = 0;
m_point.y = 0;
_local1 = m_bmdScreenBuffer.clone();
m_bmdScreenBuffer.fillRect(m_bmdScreenBuffer.rect, 0);
m_bmdScreenBuffer.copyPixels(_local1, m_rect, m_point);
_local1 = m_bmdBackBuffer.clone();
m_bmdBackBuffer.fillRect(m_bmdBackBuffer.rect, 0);
m_bmdBackBuffer.copyPixels(_local1, m_rect, m_point);
_local1.dispose();
var _local2:int;
while (_local2 < (VIEW_COLUMNS + 1)) {
if (((((m_bufferTileX + _local2) < m_levelWidth)) && (((m_bufferTileY + VIEW_ROWS) < m_levelHeight)))){
_local3 = m_levelData[Game.LAYER_WALLS][(m_bufferTileY + VIEW_ROWS)][(m_bufferTileX + _local2)];
drawTile(m_bmdScreenBuffer, _local3, (_local2 * TILE_SIZE), (VIEW_ROWS * TILE_SIZE));
_local3 = m_levelData[Game.LAYER_BACK][(m_bufferTileY + VIEW_ROWS)][(m_bufferTileX + _local2)];
drawTile(m_bmdBackBuffer, _local3, (_local2 * TILE_SIZE), (VIEW_ROWS * TILE_SIZE));
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (m_bufferTileX + _local2), (m_bufferTileY + VIEW_ROWS)));
};
_local2++;
};
}
private function drawObjects():void{
m_objectsBack.x = -(m_cameraLeft);
m_objectsBack.y = -(m_cameraTop);
m_heroLayer.x = -(m_cameraLeft);
m_heroLayer.y = -(m_cameraTop);
m_objectsFront.x = -(m_cameraLeft);
m_objectsFront.y = -(m_cameraTop);
m_objectsDrawable.x = -(m_cameraLeft);
m_objectsDrawable.y = -(m_cameraTop);
m_secretsLayer.x = -(m_cameraLeft);
m_secretsLayer.y = -(m_cameraTop);
m_bmdTiles.draw(m_objectsDrawable, new Matrix(1, 0, 0, 1, -(m_cameraLeft), -(m_cameraTop)), null, null, m_bmdTiles.rect);
}
public function getCameraTop():Number{
return (m_cameraTop);
}
public function addObject(_arg1:DisplayObject, _arg2:int=0):void{
switch (_arg2){
case LAYER_BACK:
m_objectsBack.addChild(_arg1);
break;
case LAYER_FRONT:
m_objectsFront.addChild(_arg1);
break;
case LAYER_HERO:
m_heroLayer.addChild(_arg1);
break;
case LAYER_DRAWABLE:
m_objectsDrawable.addChild(_arg1);
break;
case LAYER_SECRETS:
m_secretsLayer.addChild(_arg1);
break;
};
}
public function draw():void{
if (m_shake){
x = (1 - (Math.random() * 2));
y = (1 - (Math.random() * 2));
};
drawBackground();
drawBackTiles();
drawTiles();
drawObjects();
}
public function get bmpTiles():Bitmap{
return (m_bmpTiles);
}
public function remove():void{
var _local1:*;
m_bmdScreenBuffer.dispose();
m_bmdBackTiles.dispose();
m_bmdBackBuffer.dispose();
m_bmdTiles.dispose();
m_bmdTileset.dispose();
while (numChildren > 0) {
_local1 = getChildAt(0);
if ((_local1 is Sprite)){
while (_local1.numChildren > 0) {
Sprite(_local1).removeChildAt(0);
};
};
removeChild(_local1);
};
}
public function startShaking():void{
m_shake = true;
}
public function setCameraTarget(_arg1:Number, _arg2:Number, _arg3:int, _arg4:Boolean=true):void{
m_targetX = _arg1;
m_targetY = _arg2;
m_targetDir = _arg3;
m_delayedMove = _arg4;
}
private function addUpperRow():void{
var _local1:BitmapData;
var _local3:int;
m_rect.x = 0;
m_rect.y = 0;
m_rect.width = m_bmdScreenBuffer.width;
m_rect.height = (m_bmdScreenBuffer.height - TILE_SIZE);
m_point.x = 0;
m_point.y = TILE_SIZE;
_local1 = m_bmdScreenBuffer.clone();
m_bmdScreenBuffer.fillRect(m_bmdScreenBuffer.rect, 0);
m_bmdScreenBuffer.copyPixels(_local1, m_rect, m_point);
_local1 = m_bmdBackBuffer.clone();
m_bmdBackBuffer.fillRect(m_bmdBackBuffer.rect, 0);
m_bmdBackBuffer.copyPixels(_local1, m_rect, m_point);
_local1.dispose();
var _local2:int;
while (_local2 < (VIEW_COLUMNS + 1)) {
if ((m_bufferTileX + _local2) < m_levelWidth){
_local3 = m_levelData[Game.LAYER_WALLS][m_bufferTileY][(m_bufferTileX + _local2)];
drawTile(m_bmdScreenBuffer, _local3, (_local2 * TILE_SIZE), 0);
_local3 = m_levelData[Game.LAYER_BACK][m_bufferTileY][(m_bufferTileX + _local2)];
drawTile(m_bmdBackBuffer, _local3, (_local2 * TILE_SIZE), 0);
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (m_bufferTileX + _local2), m_bufferTileY));
if (m_bufferTileY > 0){
dispatchEvent(new ViewEvent(ViewEvent.INSERT_OBJECT, (m_bufferTileX + _local2), (m_bufferTileY - 1)));
};
};
_local2++;
};
}
private function drawBackground():void{
m_bmdBackTiles.lock();
m_rect.x = int((m_cameraLeft * m_backgroundFarScaleX));
m_rect.y = int((m_cameraTop * m_backgroundFarScaleY));
m_rect.width = VIEW_WIDTH;
m_rect.height = VIEW_HEIGHT;
m_bmdBackTiles.copyPixels(m_bmdBackground, m_rect, POINT_00);
m_bmdBackTiles.unlock();
}
public function getSecret(_arg1:Rectangle):BitmapData{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local2:BitmapData = new BitmapData((_arg1.width * TILE_SIZE), (_arg1.height * TILE_SIZE), true, 0);
var _local3:int;
while (_local3 < _arg1.height) {
_local4 = 0;
while (_local4 < _arg1.width) {
_local5 = m_levelData[Game.LAYER_SECRETS][(_local3 + _arg1.y)][(_local4 + _arg1.x)];
_local6 = (_local5 & 0xFF);
_local7 = (_local5 >> 8);
if ((((_local6 < 0xFF)) && ((_local7 < 0xFF)))){
_local2.copyPixels(m_bmdTileset, new Rectangle((_local6 * TILE_SIZE), (_local7 * TILE_SIZE), TILE_SIZE, TILE_SIZE), new Point((_local4 * TILE_SIZE), (_local3 * TILE_SIZE)));
};
_local4++;
};
_local3++;
};
return (_local2);
}
private function drawTiles():void{
m_bmdTiles.lock();
m_rect.x = m_bufferDX;
m_rect.y = m_bufferDY;
m_rect.width = VIEW_WIDTH;
m_rect.height = VIEW_HEIGHT;
m_bmdTiles.copyPixels(m_bmdScreenBuffer, m_rect, POINT_00);
m_bmdTiles.unlock();
}
public function getCameraLeft():Number{
return (m_cameraLeft);
}
public function stopShaking():void{
m_shake = false;
}
public function step():void{
stepCamera(m_targetX, m_targetY, m_targetDir);
}
private function drawBackTiles():void{
m_bmdBackTiles.lock();
m_rect.x = m_bufferDX;
m_rect.y = m_bufferDY;
m_rect.width = VIEW_WIDTH;
m_rect.height = VIEW_HEIGHT;
m_bmdBackTiles.copyPixels(m_bmdBackBuffer, m_rect, POINT_00, m_bmdBackBuffer, new Point(m_bufferDX, m_bufferDY), true);
m_bmdBackTiles.unlock();
}
}
}//package game.view
Section 112
//Game (game.Game)
package game {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import sound.*;
import data.*;
import br.com.stimuli.loading.*;
import game.activeobjects.*;
import events.*;
import game.activeobjects.items.*;
import game.activeobjects.objects.*;
import parser.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
import screens.*;
import game.view.*;
import game.activeobjects.enemies.*;
public class Game extends MovieClip {
private const POINTS_MARBLE:int = 25;
private const STATE_GOTO_EXIT:int = 7;
private const STATE_OPEN_DOOR:int = 3;
private const STATE_OPEN_CAGE:int = 5;
private const POINTS_ALIEN:int = 1000;
private const OBJECT_MAP_NORMAL:int = 1;
private const STATE_START_GAME:int = 11;
private const STATE_WAIT:int = -1;
private const POINTS_KEY_CHEST:int = 100;
private const KEY_UP:int = 38;
private const KEY_DOWN:int = 40;
private const STATE_GAME_BOSS_DEFEATED:int = 10;
private const LIVES_AMOUNT:int = 3;
private const OBJECT_MAP_DESTROYABLE:int = 3;
private const STATE_GAME_OVER:int = 9;
private const POINTS_LIFE:int = 300;
private const POINTS_KEY_EXIT:int = 200;
private const STATE_GAME:int = 1;
private const POINTS_ENEMY:int = 500;
private const STATE_LEVEL_END:int = 8;
private const KEY_CAMERA:int = 67;
private const STATE_MOVE_TO_ALIEN:int = 4;
private const POINTS_SECOND:int = 10;
private const POINTS_LEGO_BRICK:int = 50;
private const POINTS_ENERGY:int = 100;
private const HINT_BOARD_X:int = 500;
private const OBJECT_MAP_EMPTY:int = 0;
private const OBJECT_MAP_NOT_REMOVABLE:int = 2;
private const HINT_BOARD_Y:int = 150;
private const POINTS_BONUS_UNLOCK:int = 300;
private const POINTS_RADIX:int = 23;
private const STATE_MOVE_TO_DOOR:int = 2;
private const STATE_MOVE_TO_HERO:int = 6;
private const POINTS_RARE_MARB:int = 1000;
private const ENERGY_AMOUNT:int = 100;
private const STATE_LOAD:int = 0;
private var m_isBonusLevel:Boolean;
private var m_heroTypeBoy:Boolean;
private var m_marbleKeysAmount:int;
public var m_meters:Meters;
private var m_currentLevel:int;
private var m_loader:BulkLoader;
private var m_counter:int;
private var m_colectedAliens:int;
private var m_instructions:InstructionsInGame;
private var m_state:int;
private var m_door:Door;
private var m_aliensList:Array;
private var m_enemyShotsList:Array;
private var m_restartPosY:int;
private var m_restartPosX:int;
private var m_marblesAmount:String;
private var m_alien:AlienCage;
private var m_gamePoints:String;
private var m_hero:Hero;
private var m_exitKey:Boolean;
private var m_bossActivated:Boolean;
private var m_levelPoints:String;
private var m_objectsMap:Array;
private var m_isDownKeyDown:Boolean;// = false
private var m_prevState:int;
private var m_legoBricks:int;
private var m_isDownKeyUp:Boolean;// = false
private var m_bombsList:Array;
private var m_levelInfo:Array;
private var m_isDownKeyCamera:Boolean;// = false
private var m_itemsMap:Array;
private var m_restartDir:int;
private var m_levelConfigsList:Array;
public var m_preloader:Preloader;
private var m_aliensToCollect:int;
public var m_view:View;
private var m_hintBoard:HintBoard;
private var m_rareMarbId:int;
private var m_rareMarbs:Array;
public var m_doStage:MovieClip;
public var m_gameOverSuccess:GameOverSuccess;
private var m_livesAmount:int;
private var m_gameTime:String;
private var m_autoMode:Boolean;// = true
private var m_doorsList:Array;
private var m_wasHintCloud:Boolean;
private var m_energyAmount:int;
private var m_activeObjectsList:Array;
private var m_shotsList:Array;
public var m_btnOptions:Button;
private var m_doorKeysAmount:int;
private var m_collisionTable:Array;
private var m_bonusUnlocked:Boolean;
public var m_summary:LevelSummary;
public var m_gameOverFailed:GameOverFailed;
private var m_legoList:Array;
private var m_secretsVisited:Array;
private var m_levelData:LevelData;
public static const HINT_NAME_BONUS_UNLOCK:String = "bonus_unlock";
public static const HINT_NAME_ENEMY_CLOUD:String = "enemy_cloud";
public static const HINT_NAME_CHECKPOINT:String = "checkpoint";
public static const HINT_NAME_SPRING:String = "spring";
public static const TILE_DIR_LEFT:int = 3;
public static const LAYER_LIQUID:int = 2;
public static const LAYER_SECRETS:int = 6;
public static const HINT_NAME_RARE_LOGGED_IN:String = "rare_logged_out";
public static const TILE_DIR_DOWN:int = 2;
public static const HINT_NAME_ALIEN:String = "alien";
public static const HINT_NAME_SECRET:String = "secret";
public static const LAYER_CONTROL:int = 4;
public static const HINT_NAME_SWITCH:String = "switch";
public static const HINT_NAME_RARE_LOGGED_OUT:String = "rare_logged_in";
public static const LAYER_BACK:int = 0;
public static const LAYER_WALLS:int = 1;
public static const HINT_NAME_MARBLE:String = "marble";
public static const HINT_NAME_KEY:String = "key";
public static const LAYER_DIRECTION:int = 5;
public static const EVENT_LEVEL_FINISHED:String = "onLevelFinished";
public static const TILE_DIR_RIGHT:int = 1;
public static const LABEL_LOADER:String = "loader";
public static const TILE_DIR_UP:int = 0;
public static const LAYER_OBJECTS:int = 3;
public static const EVENT_GAME_FAILED:String = "onGameFailed";
public static const HINT_NAME_BLOCK:String = "block";
public static const LABEL_GAME:String = "game";
public function Game(){
m_state = STATE_LOAD;
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript(LABEL_GAME, onFrameGame);
_local1.setFrameScript(LABEL_LOADER, onFrameLoader);
stop();
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
private function findTile(_arg1:Point, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Point{
var _local6:int;
var _local7:Point = new Point(_arg2, _arg3);
var _local8:Point = new Point(_arg2, _arg3);
var _local9 = 20;
do {
_local7.x = (_local7.x + _arg4);
_local7.y = (_local7.y + _arg5);
_local6 = m_levelInfo[LAYER_OBJECTS][_local7.y][_local7.x];
_local8.x = (_local6 & 0xFF);
_local8.y = (_local6 >> 8);
if (_local8.equals(_arg1)){
return (_local7);
};
var _temp1 = _local9;
_local9 = (_local9 - 1);
} while (_temp1 > 0);
return (null);
}
private function onKeyUpHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case KEY_UP:
m_isDownKeyUp = false;
break;
case KEY_DOWN:
m_isDownKeyDown = false;
break;
};
}
private function initLoad():void{
m_state = STATE_LOAD;
m_levelData = m_levelConfigsList[m_currentLevel];
m_isBonusLevel = ((m_levelData.type)==LevelData.MISSION_TYPE_BONUS) ? true : false;
gotoGame();
}
private function onDeactivateHandler(_arg1:Event):void{
if (m_state == STATE_GAME){
m_hero.stopMovement();
};
}
private function showHintBoard(_arg1:String):void{
var _local2:Point = new Point((m_hero.posX - 10), (m_hero.posY - 120));
_local2 = m_hero.parent.localToGlobal(_local2);
_local2 = globalToLocal(_local2);
_local2.y = Math.max(_local2.y, 70);
m_hintBoard = new HintBoard(_arg1);
m_hintBoard.x = _local2.x;
m_hintBoard.y = _local2.y;
EventManager.addEventListener(m_hintBoard, HintBoard.EVENT_CLICK_OK, onHintBoardOk);
addChild(m_hintBoard);
pauseGame();
m_hero.stopMovement();
m_hero.disableKeys();
}
private function onSavepointActivate(_arg1:SavepointEvent):void{
m_restartPosX = _arg1.gridX;
m_restartPosY = _arg1.gridY;
m_restartDir = _arg1.dir;
displayHint(HINT_NAME_CHECKPOINT);
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case KEY_UP:
m_isDownKeyUp = true;
break;
case KEY_DOWN:
m_isDownKeyDown = true;
break;
};
if (Main.DEBUG){
if (String.fromCharCode(_arg1.charCode) == "d"){
m_autoMode = !(m_autoMode);
if (!m_autoMode){
EventManager.removeEventListener(this, Event.ENTER_FRAME, loopMain);
} else {
EventManager.addEventListener(this, Event.ENTER_FRAME, loopMain);
};
};
if (((!(m_autoMode)) && ((String.fromCharCode(_arg1.charCode) == "s")))){
loopMain(new Event(""));
};
};
}
private function addBorder():void{
var _local1:int;
var _local2:int;
var _local3:Array;
var _local4:Array;
var _local5:int = (m_levelInfo[0][0].length + (Config.LEVEL_BORDER * 2));
var _local6:int = (m_levelInfo[0].length + (Config.LEVEL_BORDER * 2));
_local2 = 0;
while (_local2 < _local6) {
if (_local2 < Config.LEVEL_BORDER){
_local3 = new Array();
_local4 = new Array();
_local1 = 0;
while (_local1 < _local5) {
_local3[_local1] = 0;
_local4[_local1] = -1;
_local1++;
};
m_levelInfo[LAYER_BACK].unshift(_local3);
m_levelInfo[LAYER_WALLS].unshift(_local3);
m_levelInfo[LAYER_LIQUID].unshift(_local4);
m_levelInfo[LAYER_OBJECTS].unshift(_local4);
m_levelInfo[LAYER_CONTROL].unshift(_local4);
m_levelInfo[LAYER_DIRECTION].unshift(_local4);
m_levelInfo[LAYER_SECRETS].unshift(_local3);
} else {
if (_local2 >= (_local6 - Config.LEVEL_BORDER)){
_local3 = new Array();
_local4 = new Array();
_local1 = 0;
while (_local1 < _local5) {
_local3[_local1] = 0;
_local4[_local1] = -1;
_local1++;
};
m_levelInfo[LAYER_BACK].push(_local3);
m_levelInfo[LAYER_WALLS].push(_local3);
m_levelInfo[LAYER_LIQUID].push(_local4);
m_levelInfo[LAYER_OBJECTS].push(_local4);
m_levelInfo[LAYER_CONTROL].push(_local4);
m_levelInfo[LAYER_DIRECTION].push(_local4);
m_levelInfo[LAYER_SECRETS].push(_local3);
} else {
_local1 = 0;
while (_local1 < Config.LEVEL_BORDER) {
m_levelInfo[LAYER_BACK][_local2].push(0);
m_levelInfo[LAYER_BACK][_local2].unshift(0);
m_levelInfo[LAYER_WALLS][_local2].push(0);
m_levelInfo[LAYER_WALLS][_local2].unshift(0);
m_levelInfo[LAYER_LIQUID][_local2].push(-1);
m_levelInfo[LAYER_LIQUID][_local2].unshift(-1);
m_levelInfo[LAYER_OBJECTS][_local2].push(-1);
m_levelInfo[LAYER_OBJECTS][_local2].unshift(-1);
m_levelInfo[LAYER_CONTROL][_local2].push(-1);
m_levelInfo[LAYER_CONTROL][_local2].unshift(-1);
m_levelInfo[LAYER_DIRECTION][_local2].push(-1);
m_levelInfo[LAYER_DIRECTION][_local2].unshift(-1);
m_levelInfo[LAYER_SECRETS][_local2].push(0);
m_levelInfo[LAYER_SECRETS][_local2].unshift(0);
_local1++;
};
};
};
_local1 = 0;
while (_local1 < _local5) {
if ((((((((_local1 < Config.LEVEL_BORDER)) || ((_local1 >= (_local5 - Config.LEVEL_BORDER))))) || ((_local2 < Config.LEVEL_BORDER)))) || ((_local2 >= (_local6 - Config.LEVEL_BORDER))))){
m_levelInfo[LAYER_BACK][_local2][_local1] = 0;
m_levelInfo[LAYER_WALLS][_local2][_local1] = 0;
m_levelInfo[LAYER_LIQUID][_local2][_local1] = -1;
m_levelInfo[LAYER_OBJECTS][_local2][_local1] = -1;
m_levelInfo[LAYER_CONTROL][_local2][_local1] = -1;
m_levelInfo[LAYER_DIRECTION][_local2][_local1] = -1;
m_levelInfo[LAYER_SECRETS][_local2][_local1] = 0;
};
_local1++;
};
_local2++;
};
}
private function onBrickCrush(_arg1:BrickEvent):void{
if (!SoundManager.getInstance().getSound(SoundConfig.SFX_BRICK).playing){
SoundManager.getInstance().playSound(SoundConfig.SFX_BRICK);
};
m_view.addObject((_arg1.target as Brick), View.LAYER_FRONT);
m_hero.onCrushObject();
}
private function getStartPoint():Object{
var _local1:int;
var _local5:int;
var _local6:Point;
var _local7:int;
var _local2:int = m_levelInfo[LAYER_WALLS][0].length;
var _local3:int = m_levelInfo[LAYER_WALLS].length;
var _local4:int;
while (_local4 < _local3) {
_local5 = 0;
while (_local5 < _local2) {
_local1 = m_levelInfo[LAYER_OBJECTS][_local4][_local5];
_local6 = new Point((_local1 & 0xFF), (_local1 >> 8));
if ((((_local6.x < 0xFF)) && ((_local6.y < 0xFF)))){
if (_local6.equals(Config.TILE_START)){
_local7 = m_levelInfo[LAYER_DIRECTION][_local4][_local5];
_local7 = ((_local7 == TILE_DIR_LEFT)) ? -1 : 1;
return ({x:_local5, y:_local4, dir:_local7});
};
};
_local5++;
};
_local4++;
};
return (null);
}
private function onHeroMorphEnd(_arg1:Event):void{
m_hero.disableRoll();
m_hero.disableSeaHorse();
}
private function onSpecialMarbleRelease(_arg1:ObjectEvent):void{
var _local2:ItemSpecialMarble;
EventManager.addEventListener((_arg1.target as MarbleCage), MarbleCage.EVENT_MARBLE_RELEASED, onSpecialMarbleRelease);
if (_arg1.object.marbId == 0){
_local2 = new ItemSpecialMarble1(_arg1.object.gridX, _arg1.object.gridY, m_hero);
} else {
if (_arg1.object.marbId == 1){
_local2 = new ItemSpecialMarble2(_arg1.object.gridX, _arg1.object.gridY, m_hero);
};
};
addActiveObject(_local2);
EventManager.addEventListener(_local2, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local2, ItemEvent.COLLECTED, onCollectItem);
EventManager.addEventListener(_local2, ItemEvent.REMOVED, onRemoveItem);
m_itemsMap[_arg1.object.gridY][_arg1.object.gridX] = 1;
m_objectsMap[_arg1.object.gridY][_arg1.object.gridX] = OBJECT_MAP_NORMAL;
m_view.addObject(_local2, View.LAYER_BACK);
var _local3 = ((Config.TILE_ITEM_SPECIAL_MARBLE.y << 8) | Config.TILE_ITEM_SPECIAL_MARBLE.x);
m_levelInfo[LAYER_OBJECTS][_arg1.object.gridY][_arg1.object.gridX] = _local3;
m_levelInfo[LAYER_CONTROL][_arg1.object.gridY][_arg1.object.gridX] = (_arg1.object.marbId << 8);
}
private function onHeroNextToExit(_arg1:Event):void{
var _local2:Exit;
if (m_exitKey){
_local2 = (_arg1.target as Exit);
EventManager.removeEventListener(_local2, Exit.EVENT_NEXT_TO_EXIT, onHeroNextToExit);
_local2.open();
m_hero.stopMovement();
m_state = STATE_GOTO_EXIT;
};
}
private function onStartDoorClose(_arg1:Event):void{
m_state = STATE_GAME;
m_hero.visible = true;
}
private function drawActiveObjects(_arg1:Boolean=false):void{
var _local2:int;
while (_local2 < m_activeObjectsList.length) {
if (_arg1){
if ((m_activeObjectsList[_local2] is DisplayObject)){
m_activeObjectsList[_local2].visible = true;
} else {
m_activeObjectsList[_local2].makeVisible();
};
};
m_activeObjectsList[_local2].draw();
_local2++;
};
}
private function onExitOpened(_arg1:Event):void{
m_state = STATE_LEVEL_END;
}
private function displayHint(_arg1:String):void{
var _local2:HintData = HintsManager.getHint(_arg1);
if (_local2){
showHintBoard(_local2.copy);
};
}
private function findItem(_arg1:int, _arg2:int):Item{
var _local4:Item;
var _local3:int;
while (_local3 < m_activeObjectsList.length) {
if ((m_activeObjectsList[_local3] is Item)){
_local4 = m_activeObjectsList[_local3];
if ((((_local4.gridX == _arg1)) && ((_local4.gridY == _arg2)))){
return (_local4);
};
};
_local3++;
};
return (null);
}
private function loopMain(_arg1:Event):void{
var _local2:int;
switch (m_state){
case STATE_GAME_BOSS_DEFEATED:
if (m_counter-- <= 0){
m_state = STATE_LEVEL_END;
};
case STATE_START_GAME:
m_hero.draw();
m_view.draw();
drawActiveObjects();
break;
case STATE_GAME:
_local2 = getTime(m_gameTime);
_local2--;
m_gameTime = Crypto.encrypt(_local2);
if (_local2 <= 0){
_local2 = 0;
if (m_levelData.type == LevelData.MISSION_TYPE_BONUS){
m_state = STATE_LEVEL_END;
} else {
gameFailed();
};
};
m_meters.drawTime(int((_local2 / Config.FPS)), m_levelData.time);
m_hero.setCamera(m_view.getCameraLeft(), m_view.getCameraTop());
m_hero.step();
if (((!((m_state == STATE_GAME))) && (!((m_state == STATE_GAME_BOSS_DEFEATED))))){
break;
};
if (((m_isDownKeyCamera) && (m_hero.canMoveCamera()))){
m_hero.cameraControl(true);
if (m_isDownKeyUp){
m_view.setCameraTarget(int(m_hero.posX), int((m_hero.posY - 80)), m_hero.dir);
} else {
if (m_isDownKeyDown){
m_view.setCameraTarget(int(m_hero.posX), int((m_hero.posY + 250)), m_hero.dir);
} else {
m_view.setCameraTarget(int(m_hero.posX), int(m_hero.posY), m_hero.dir);
};
};
} else {
m_view.setCameraTarget(int(m_hero.posX), int(m_hero.posY), m_hero.dir);
};
m_view.step();
stepActiveObjects();
m_hero.draw();
m_view.draw();
drawActiveObjects();
break;
case STATE_MOVE_TO_DOOR:
m_view.setCameraTarget(int(m_door.posX), int(m_door.posY), 1, false);
m_view.step();
m_view.draw();
break;
case STATE_OPEN_DOOR:
if (m_counter-- <= 0){
m_state = STATE_MOVE_TO_HERO;
EventManager.addEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnHero);
};
break;
case STATE_MOVE_TO_ALIEN:
m_view.setCameraTarget(int(m_alien.posX), int(m_alien.posY), 1, false);
m_view.step();
m_view.draw();
break;
case STATE_OPEN_CAGE:
if (m_counter-- <= 0){
m_state = STATE_MOVE_TO_HERO;
EventManager.addEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnHero);
};
break;
case STATE_MOVE_TO_HERO:
m_view.setCameraTarget(int(m_hero.posX), int(m_hero.posY), m_hero.dir, false);
m_view.step();
m_view.draw();
break;
case STATE_GOTO_EXIT:
m_hero.draw();
m_view.draw();
drawActiveObjects();
break;
case STATE_LEVEL_END:
dispatchEvent(new ObjectEvent(EVENT_LEVEL_FINISHED, {points:m_levelPoints, gamePoints:m_gamePoints, time:m_gameTime, rare:m_rareMarbId, secrets:m_secretsVisited, bonus:m_bonusUnlocked, timeBonus:getTimeBonus(), collectedMarbs:m_marblesAmount, bg:getScreenShot()}));
break;
case STATE_GAME_OVER:
dispatchEvent(new ObjectEvent(EVENT_GAME_FAILED, {points:m_levelPoints, gamePoints:m_gamePoints, time:m_gameTime, rare:m_rareMarbId, secrets:m_secretsVisited, timeBonus:Crypto.encrypt(0), collectedMarbs:m_marblesAmount, bg:getScreenShot()}));
break;
};
}
private function onFrameLoader():void{
initLoad();
}
private function removeActiveObject(_arg1):void{
var _local2:int;
while (_local2 < m_activeObjectsList.length) {
if (m_activeObjectsList[_local2] == _arg1){
m_activeObjectsList.splice(_local2, 1);
break;
};
_local2++;
};
}
private function onEnemyCloseToHero(_arg1:HeroEvent):void{
m_hero.enemyClose();
}
private function onClickPause(_arg1:Event):void{
if (m_state != STATE_WAIT){
pauseGame();
m_meters.setPauseButtonIconPlay();
} else {
unpauseGame();
m_meters.setPauseButtonIconPause();
m_hero.resetKeys();
};
}
public function unpauseGame():void{
m_state = m_prevState;
}
private function onRemoveEnemyShot(_arg1:ShotEvent):void{
_arg1.target.removeEventListener(ShotEvent.REMOVE, onRemoveEnemyShot);
_arg1.target.removeEventListener(HeroEvent.DAMAGE, onHeroDamage);
var _local2:int;
while (_local2 < m_enemyShotsList.length) {
if (_arg1.target == m_enemyShotsList[_local2]){
m_enemyShotsList.splice(_local2, 1);
break;
};
_local2++;
};
}
private function getTimeBonus():String{
var _local1:int = int((Crypto.decrypt(m_gameTime) / Config.FPS));
return (Crypto.encrypt(int((POINTS_SECOND * _local1))));
}
private function onLoadProgress(_arg1:BulkProgressEvent):void{
if (m_preloader){
m_preloader.setPercents(int(((100 * _arg1.bytesLoaded) / _arg1.bytesTotal)));
};
}
private function onHeroOnBumper(_arg1:BumperEvent):void{
m_hero.onBumper(_arg1.speedX, _arg1.speedY);
SoundManager.getInstance().playSound(SoundConfig.SFX_BUMPER);
displayHint(HINT_NAME_SPRING);
}
private function onHeroNextToBlockade(_arg1:BlockadeEvent):void{
m_hero.stopNextToBlockade(_arg1.blockadeX, _arg1.dir, _arg1.distance);
}
private function onHeroNextMarbleCage(_arg1:Event):void{
if (m_marbleKeysAmount > 0){
m_marbleKeysAmount--;
m_meters.drawKeys(m_marbleKeysAmount);
(_arg1.target as MarbleCage).open();
EventManager.removeEventListener((_arg1.target as MarbleCage), MarbleCage.EVENT_NEXT_TO_CAGE, onHeroNextMarbleCage);
};
}
private function onHeroOnPlatform(_arg1:PlatformEvent):void{
m_hero.onPlatform(_arg1.dY, _arg1.speedX, _arg1.speedY);
}
private function onRemoveActiveObject(_arg1:ActiveObjectEvent):void{
EventManager.removeAllListeners((_arg1.target as EventDispatcher));
if ((_arg1.target is Secret)){
} else {
if ((((_arg1.gridX > -1)) && ((_arg1.gridY > -1)))){
if (m_objectsMap[_arg1.gridY][_arg1.gridX] == OBJECT_MAP_NORMAL){
m_objectsMap[_arg1.gridY][_arg1.gridX] = OBJECT_MAP_EMPTY;
} else {
if (m_objectsMap[_arg1.gridY][_arg1.gridX] == OBJECT_MAP_DESTROYABLE){
if (!_arg1.target.destroyed){
m_objectsMap[_arg1.gridY][_arg1.gridX] = OBJECT_MAP_EMPTY;
};
};
};
};
};
if ((((m_state == STATE_GAME)) && ((((_arg1.target is StormCloud)) || ((_arg1.target is SickCloud)))))){
addPoints(POINTS_ENEMY, _arg1.target.posX, _arg1.target.posY);
};
removeActiveObject(_arg1.target);
}
private function onInsertObject(_arg1:ViewEvent):void{
var _local4:int;
var _local5:*;
var _local6:int;
var _local7:int;
var _local11:int;
var _local12:Point;
var _local13:int;
var _local14:int;
var _local15:Point;
var _local16:Point;
var _local17:Point;
var _local18:int;
var _local19:int;
var _local20:int;
var _local21:Point;
var _local22:Point;
var _local2:int = _arg1.gridX;
var _local3:int = _arg1.gridY;
if (m_objectsMap[_local3][_local2] > 0){
_local11 = m_levelInfo[LAYER_LIQUID][_local3][_local2];
_local12 = new Point((_local11 & 0xFF), (_local11 >> 8));
if ((((m_objectsMap[_local3][_local2] == OBJECT_MAP_NOT_REMOVABLE)) && (_local12.equals(Config.TILE_ACID_BOTTOM)))){
insertLiquid(_local2, _local3);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
};
return;
};
var _local8:int = m_levelInfo[LAYER_WALLS][0].length;
var _local9:int = m_levelInfo[LAYER_WALLS].length;
_local4 = m_levelInfo[LAYER_OBJECTS][_local3][_local2];
var _local10:Point = new Point((_local4 & 0xFF), (_local4 >> 8));
if ((((_local10.x < 0xFF)) && ((_local10.y < 0xFF)))){
if (_local10.equals(Config.TILE_NO_COLLISION)){
m_collisionTable[_local3][_local2] = 1;
} else {
if (_local10.equals(Config.TILE_START)){
_local7 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local7 = ((_local7 == TILE_DIR_RIGHT)) ? 1 : -1;
_local5 = new Start(_local2, _local3, _local7, m_heroTypeBoy);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, Start.EVENT_CLOSE, onStartDoorClose);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
m_view.addObject(_local5, View.LAYER_BACK);
} else {
if (_local10.equals(Config.TILE_EXIT)){
_local5 = new Exit(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, Exit.EVENT_NEXT_TO_EXIT, onHeroNextToExit);
EventManager.addEventListener(_local5, Exit.EVENT_DOOR_OPENED, onExitOpened);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
m_view.addObject(_local5, View.LAYER_BACK);
} else {
if (_local10.equals(Config.TILE_SIGNPOST)){
_local7 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local5 = new Signpost(_local2, _local3, _local7);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
m_view.addObject(_local5, View.LAYER_BACK);
} else {
if (_local10.equals(Config.TILE_SAVEPOINT)){
_local5 = new Savepoint(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, SavepointEvent.ACTIVATE, onSavepointActivate);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
m_view.addObject(_local5, View.LAYER_BACK);
} else {
if (_local10.y == Config.TILE_ITEM_MARBLE.y){
if (m_itemsMap[_local3][_local2] == 0){
if (_local10.equals(Config.TILE_ITEM_MARBLE)){
_local5 = new ItemMarble(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_SPECIAL_MARBLE)){
_local6 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local6 = ((_local6 == 0xFF)) ? 0 : _local6;
if (_local6 == 0){
_local5 = new ItemSpecialMarble1(_local2, _local3, m_hero);
} else {
if (_local6 == 1){
_local5 = new ItemSpecialMarble2(_local2, _local3, m_hero);
};
};
} else {
if (_local10.equals(Config.TILE_ITEM_MARBLE_KEY)){
_local5 = new ItemMarbleKey(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_LEGO_BRICK)){
_local5 = new ItemLegoBrick(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_LIFE)){
_local5 = new ItemLife(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_ENERGY)){
_local5 = new ItemEnergy(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_DOOR_KEY)){
_local5 = new ItemDoorKey(_local2, _local3, m_hero);
} else {
if (_local10.equals(Config.TILE_ITEM_BONUS)){
_local5 = new ItemBonus(_local2, _local3, m_hero);
};
};
};
};
};
};
};
};
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, ItemEvent.COLLECTED, onCollectItem);
EventManager.addEventListener(_local5, ItemEvent.REMOVED, onRemoveItem);
m_itemsMap[_local3][_local2] = 1;
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
m_view.addObject(_local5, View.LAYER_BACK);
};
} else {
if (((_local10.equals(Config.TILE_STORM_CLOUD)) || (_local10.equals(Config.TILE_SICK_CLOUD)))){
_local15 = _local10.clone();
_local13 = findTile(Config.TILE_BADDY_FLAG, _local2, _local3, -1, 0).x;
_local14 = findTile(Config.TILE_BADDY_FLAG, _local2, _local3, 1, 0).x;
_local7 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local7 = ((_local7 == TILE_DIR_LEFT)) ? BaddieWalking.DIR_LEFT : BaddieWalking.DIR_RIGHT;
if (_local15.equals(Config.TILE_STORM_CLOUD)){
_local5 = new StormCloud(_local2, _local3, _local13, _local14, _local7, m_hero);
} else {
if (_local15.equals(Config.TILE_SICK_CLOUD)){
_local5 = new SickCloud(_local2, _local3, _local13, _local14, _local7, m_hero);
};
};
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, HeroEvent.DAMAGE, onHeroDamage);
EventManager.addEventListener(_local5, HeroEvent.HIT_ENEMY, onHeroHitEnemy);
EventManager.addEventListener(_local5, HeroEvent.ENEMY_CLOSE, onEnemyCloseToHero);
EventManager.addEventListener(_local5, BaddieWalking.EVENT_ON_SCREEN, onEnemyOnScreen);
m_objectsMap[_local3][_local2] = OBJECT_MAP_DESTROYABLE;
m_view.addObject(_local5, View.LAYER_BACK);
} else {
if (_local10.equals(Config.TILE_PLATFORM_VERTICAL)){
onInsertObject(new ViewEvent(ViewEvent.INSERT_OBJECT, _local2, (_local3 - 1)));
_local16 = findTile(Config.TILE_PLATFORM_CONTROL, _local2, _local3, 0, -1);
_local17 = findTile(Config.TILE_PLATFORM_CONTROL, _local2, _local3, 0, 1);
_local18 = 0;
_local19 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local19 = ((_local19 == TILE_DIR_UP)) ? -1 : 1;
_local20 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local20 = ((_local20 == 0xFF)) ? 0 : _local20;
_local5 = new MovingPlatform(_local2, _local3, _local16, _local17, _local18, _local19, _local20, m_hero, findItem(_local2, (_local3 - 1)));
addActiveObject(_local5);
m_view.addObject(_local5, View.LAYER_BACK);
EventManager.addEventListener(_local5, PlatformEvent.STAND, onHeroOnPlatform);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
} else {
if (_local10.equals(Config.TILE_PLATFORM_HORIZONTAL)){
onInsertObject(new ViewEvent(ViewEvent.INSERT_OBJECT, _local2, (_local3 - 1)));
_local21 = findTile(Config.TILE_PLATFORM_CONTROL, _local2, _local3, -1, 0);
_local22 = findTile(Config.TILE_PLATFORM_CONTROL, _local2, _local3, 1, 0);
_local18 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local18 = ((_local18 == TILE_DIR_LEFT)) ? -1 : 1;
_local19 = 0;
_local20 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local20 = ((_local20 == 0xFF)) ? 0 : _local20;
_local5 = new MovingPlatform(_local2, _local3, _local21, _local22, _local18, _local19, _local20, m_hero, findItem(_local2, (_local3 - 1)));
addActiveObject(_local5);
m_view.addObject(_local5, View.LAYER_BACK);
EventManager.addEventListener(_local5, PlatformEvent.STAND, onHeroOnPlatform);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
} else {
if (_local10.equals(Config.TILE_PLATFORM_FALLING)){
_local5 = new FallingPlatform(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, PlatformEvent.STAND, onHeroOnPlatform);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
} else {
if (_local10.equals(Config.TILE_BUMPER_VERTICAL)){
_local5 = new Bumper(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, BumperEvent.BUMP, onHeroOnBumper);
m_view.addObject(_local5, View.LAYER_DRAWABLE);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
} else {
if (_local10.equals(Config.TILE_BUMPER_DIAGONAL)){
_local7 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local7 = ((_local7 == TILE_DIR_LEFT)) ? TILE_DIR_LEFT : TILE_DIR_RIGHT;
_local5 = new BumperDiagonal(_local2, _local3, _local7, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, BumperEvent.BUMP, onHeroOnBumper);
m_view.addObject(_local5, View.LAYER_DRAWABLE);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
} else {
if (_local10.equals(Config.TILE_BRICK)){
if ((_local3 % 2) == 0){
_local5 = new Brick(_local2, _local3, m_hero);
} else {
_local5 = new Brick2(_local2, _local3, m_hero);
};
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, BrickEvent.CRUSH, onBrickCrush);
m_view.addObject(_local5, View.LAYER_DRAWABLE);
m_objectsMap[_local3][_local2] = OBJECT_MAP_DESTROYABLE;
} else {
if (_local10.equals(Config.TILE_SPIKES)){
_local7 = m_levelInfo[LAYER_DIRECTION][_local3][_local2];
_local7 = ((_local7 == ((0xFF << 8) | 0xFF))) ? 0 : _local7;
_local5 = new Spikes(_local2, _local3, _local7, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, HeroEvent.DAMAGE, onHeroDamage);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
} else {
if (_local10.equals(Config.TILE_THUMPER)){
_local6 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local6 = ((_local6 == 0xFF)) ? 0 : _local6;
_local5 = new Thumper(_local2, _local3, _local6, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, HeroEvent.DAMAGE, onHeroDamage);
EventManager.addEventListener(_local5, BlockadeEvent.NEXT_TO_BLOCKADE, onHeroNextToBlockade);
m_view.addObject(_local5, View.LAYER_FRONT);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
} else {
if (_local10.equals(Config.TILE_ALIEN_CAGE)){
_local6 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local6 = ((_local6 == 0xFF)) ? -1 : _local6;
_local5 = new AlienCage(_local2, _local3, _local6, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, AlienCage.EVENT_COLLECT_ALIEN, onCollectAlien);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
if (_local6 >= 0){
m_aliensList[_local6] = _local5;
};
} else {
if (_local10.equals(Config.TILE_ALIEN_CAGE_TRIGGER)){
_local6 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local6 = ((_local6 == 0xFF)) ? 0 : _local6;
_local5 = new AlienCageTrigger(_local2, _local3, m_hero, _local6);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, TriggerEvent.PRESSED, onPressAlienCageTrigger);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
} else {
if (_local10.equals(Config.TILE_MARBLE_CAGE)){
_local6 = (m_levelInfo[LAYER_CONTROL][_local3][_local2] >> 8);
_local6 = ((_local6 == 0xFF)) ? 0 : _local6;
_local5 = new MarbleCage(_local2, _local3, _local6, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, MarbleCage.EVENT_NEXT_TO_CAGE, onHeroNextMarbleCage);
EventManager.addEventListener(_local5, MarbleCage.EVENT_MARBLE_RELEASED, onSpecialMarbleRelease);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
} else {
if (_local10.equals(Config.TILE_LEGO_PLACEHOLDER)){
_local5 = new LegoBrickPlaceholder(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, LegoBrickPlaceholder.EVENT_HERO_NEXT_TO_LEGO, onHeroNextToLego);
EventManager.addEventListener(_local5, LegoBrickPlaceholder.EVENT_LOCK_LEGO, onLockLego);
m_view.addObject(_local5, View.LAYER_BACK);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NOT_REMOVABLE;
m_legoList.push(_local5);
} else {
if (_local10.equals(Config.TILE_CLOUD)){
_local5 = new Cloud(_local2, _local3, m_hero);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local5, PlatformEvent.STAND, onHeroOnPlatform);
m_view.addObject(_local5, View.LAYER_FRONT);
m_objectsMap[_local3][_local2] = OBJECT_MAP_NORMAL;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
insertLiquid(_local2, _local3);
}
private function onPressAlienCageTrigger(_arg1:TriggerEvent):void{
var _local2:AlienCage = (m_aliensList[_arg1.id] as AlienCage);
var _local3:Boolean = _local2.isOnScreen((m_view.bufferTileX + 1), (m_view.bufferTileY + 2), ((m_view.bufferTileX + View.VIEW_COLUMNS) - 1), ((m_view.bufferTileY + View.VIEW_ROWS) - 1));
if (_local3){
_local2.open();
} else {
m_alien = _local2;
m_state = STATE_MOVE_TO_ALIEN;
EventManager.addEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnAlien);
m_hero.stopMovement();
drawActiveObjects(true);
};
_local2.visible = true;
SoundManager.getInstance().playSound(SoundConfig.SFX_TRIGGER);
displayHint(HINT_NAME_SWITCH);
}
private function onRemoveShot(_arg1:ShotEvent):void{
_arg1.target.removeEventListener(ShotEvent.REMOVE, onRemoveShot);
var _local2:int;
while (_local2 < m_shotsList.length) {
if (_arg1.target == m_shotsList[_local2]){
m_shotsList.splice(_local2, 1);
break;
};
_local2++;
};
}
private function gameFailed():void{
m_state = STATE_GAME_OVER;
}
private function addPoints(_arg1:int, _arg2:int=-1, _arg3:int=-1):void{
var _local5:PointsCloud;
var _local4:int = getPoints(m_levelPoints);
_local4 = (_local4 + _arg1);
if (_local4 < 0){
_local4 = 0;
};
m_levelPoints = Crypto.encrypt(_local4);
m_meters.drawPoints(_local4);
if (!m_isBonusLevel){
_local4 = getPoints(m_gamePoints);
_local4 = (_local4 + _arg1);
if (_local4 < 0){
_local4 = 0;
};
m_gamePoints = Crypto.encrypt(_local4);
};
if ((((_arg2 >= 0)) && ((_arg3 >= 0)))){
_local5 = new PointsCloud(_arg2, _arg3, _arg1);
m_view.addObject(_local5, View.LAYER_BACK);
addActiveObject(_local5);
EventManager.addEventListener(_local5, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
};
}
private function onLockLego(_arg1:Event):void{
var _local2:LegoBrickPlaceholder = (_arg1.target as LegoBrickPlaceholder);
EventManager.removeEventListener(_local2, LegoBrickPlaceholder.EVENT_LOCK_LEGO, onLockLego);
m_view.addObject(_local2, View.LAYER_DRAWABLE);
}
private function onRemovedFromStage(_arg1:Event):void{
EventManager.removeAllListeners(this);
EventManager.removeAllListeners(m_view);
while (m_activeObjectsList.length > 0) {
m_activeObjectsList[0].remove();
};
m_activeObjectsList = null;
EventManager.removeAllListeners(m_hero);
m_hero.remove();
m_hero = null;
m_view.remove();
m_view = null;
EventManager.removeAllListeners(stage);
m_collisionTable = null;
m_itemsMap = null;
m_objectsMap = null;
m_activeObjectsList = null;
m_doorsList = null;
m_aliensList = null;
m_legoList = null;
m_shotsList = null;
m_bombsList = null;
m_enemyShotsList = null;
delete ??getglobalscope
[this];
}
private function onHeroNextToDoor(_arg1:DoorEvent):void{
if ((((_arg1.id < 0)) && ((m_doorKeysAmount > 0)))){
m_doorKeysAmount--;
m_meters.drawKeys(m_doorKeysAmount);
(_arg1.target as Door).open();
} else {
m_hero.stopNextToDoor(_arg1.doorX, _arg1.dir);
};
}
private function onRemoveItem(_arg1:ItemEvent):void{
EventManager.removeEventListener((_arg1.target as EventDispatcher), ItemEvent.REMOVED, onRemoveItem);
if (m_itemsMap[_arg1.gridY][_arg1.gridX] == 1){
m_itemsMap[_arg1.gridY][_arg1.gridX] = 0;
};
}
private function countObjects():void{
var _local1:int;
var _local15:int;
var _local16:Point;
var _local2:int = m_levelInfo[LAYER_WALLS][0].length;
var _local3:int = m_levelInfo[LAYER_WALLS].length;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
while (_local14 < _local3) {
_local15 = 0;
while (_local15 < _local2) {
_local1 = m_levelInfo[LAYER_OBJECTS][_local14][_local15];
_local16 = new Point((_local1 & 0xFF), (_local1 >> 8));
if ((((_local16.x < 0xFF)) && ((_local16.y < 0xFF)))){
if (_local16.equals(Config.TILE_ITEM_MARBLE)){
_local4++;
} else {
if (((_local16.equals(Config.TILE_STORM_CLOUD)) || (_local16.equals(Config.TILE_SICK_CLOUD)))){
_local5++;
} else {
if (_local16.equals(Config.TILE_ITEM_LIFE)){
_local6++;
} else {
if (_local16.equals(Config.TILE_ITEM_ENERGY)){
_local7++;
} else {
if (_local16.equals(Config.TILE_ITEM_DOOR_KEY)){
_local8++;
} else {
if (_local16.equals(Config.TILE_ITEM_MARBLE_KEY)){
_local9++;
} else {
if (_local16.equals(Config.TILE_MARBLE_CAGE)){
_local10++;
} else {
if (_local16.equals(Config.TILE_ALIEN_CAGE)){
_local11++;
} else {
if (_local16.equals(Config.TILE_ITEM_BONUS)){
_local12++;
} else {
if (_local16.equals(Config.TILE_ITEM_LEGO_BRICK)){
_local13++;
};
};
};
};
};
};
};
};
};
};
};
_local15++;
};
_local14++;
};
m_aliensToCollect = _local11;
}
public function pauseGame():void{
m_prevState = m_state;
m_state = STATE_WAIT;
}
private function onSecretShow(_arg1:ObjectEvent):void{
m_secretsVisited[_arg1.object.secretId] = true;
displayHint(HINT_NAME_SECRET);
if (_arg1.object.secretId == 1){
Main.trackEvent(Config.MEME_SECRET_1);
} else {
if (_arg1.object.secretId == 2){
Main.trackEvent(Config.MEME_SECRET_2);
} else {
if (_arg1.object.secretId == 3){
Main.trackEvent(Config.MEME_SECRET_3);
};
};
};
}
public function stopGame():void{
}
private function onHeroDeathAnimEnd(_arg1:HeroEvent):void{
if (m_livesAmount <= 0){
gameFailed();
} else {
m_energyAmount = ENERGY_AMOUNT;
m_meters.drawEnergy((m_energyAmount / ENERGY_AMOUNT));
m_hero.reset(m_restartPosX, m_restartPosY, m_restartDir);
EventManager.addEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnHero);
m_state = STATE_MOVE_TO_HERO;
drawActiveObjects(true);
};
}
private function onCreateGrenade(_arg1:ShotEvent):void{
var _local2:ShotGrenade = new ShotGrenade(_arg1.posX, _arg1.posY, _arg1.dir, m_hero, _arg1.angle);
EventManager.addEventListener(_local2, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local2, ShotEvent.REMOVE, onRemoveEnemyShot);
EventManager.addEventListener(_local2, HeroEvent.DAMAGE, onHeroDamage);
m_view.addObject(_local2, View.LAYER_FRONT);
addActiveObject(_local2);
m_enemyShotsList.push(_local2);
}
public function initGame(_arg1:Array, _arg2:String, _arg3:String, _arg4:int, _arg5:Boolean, _arg6:Array):void{
m_levelConfigsList = _arg1;
m_levelPoints = _arg2;
m_gamePoints = _arg3;
m_currentLevel = _arg4;
m_heroTypeBoy = _arg5;
m_rareMarbs = _arg6;
gotoAndStop(LABEL_LOADER);
}
private function addActiveObject(_arg1):Boolean{
var _local2:int;
while (_local2 < m_activeObjectsList.length) {
if (m_activeObjectsList[_local2] == _arg1){
return (false);
};
_local2++;
};
m_activeObjectsList.push(_arg1);
return (true);
}
private function onCreateEnemyShot(_arg1:ShotEvent):void{
var _local2:ShotEnemy = new ShotEnemy(_arg1.posX, _arg1.posY, _arg1.angle, m_hero);
EventManager.addEventListener(_local2, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local2, ShotEvent.REMOVE, onRemoveEnemyShot);
EventManager.addEventListener(_local2, HeroEvent.DAMAGE, onHeroDamage);
m_view.addObject(_local2, View.LAYER_HERO);
addActiveObject(_local2);
m_enemyShotsList.push(_local2);
}
private function onHeroShoot(_arg1:ShotEvent):void{
var _local2:ShotHero = new ShotHero(_arg1.posX, _arg1.posY, _arg1.dir, m_levelInfo[LAYER_OBJECTS], m_levelInfo[LAYER_WALLS]);
EventManager.addEventListener(_local2, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local2, ShotEvent.REMOVE, onRemoveShot);
m_view.addObject(_local2, View.LAYER_HERO);
addActiveObject(_local2);
m_shotsList.push(_local2);
}
private function onCameraOnDoor(_arg1:ViewEvent):void{
EventManager.removeEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnDoor);
m_door.open();
m_counter = 20;
m_state = STATE_OPEN_DOOR;
}
private function onEnemyOnScreen(_arg1:Event):void{
if ((((_arg1.target is StormCloud)) || ((_arg1.target is SickCloud)))){
if (!m_wasHintCloud){
m_wasHintCloud = true;
displayHint(HINT_NAME_ENEMY_CLOUD);
};
};
}
private function onShowInstructions(_arg1:Event):void{
pauseGame();
m_instructions = new InstructionsInGame();
addChild(m_instructions);
EventManager.addEventListener(m_instructions, InstructionsInGame.EVENT_CLOSE, onCloseInstructions);
}
private function onHeroDamage(_arg1:HeroEvent):void{
m_energyAmount = (m_energyAmount - int((_arg1.damageValue * ENERGY_AMOUNT)));
m_energyAmount = ((m_energyAmount < 0)) ? 0 : m_energyAmount;
m_meters.drawEnergy((m_energyAmount / ENERGY_AMOUNT));
if (m_energyAmount == 0){
m_livesAmount--;
m_meters.drawLives(m_livesAmount);
m_hero.die();
SoundManager.getInstance().playSound(SoundConfig.SFX_HERO_DEATH);
} else {
m_hero.getDamage(_arg1.damageSide);
SoundManager.getInstance().playSound(SoundConfig.SFX_HERO_HURT);
};
}
private function onCollectAlien(_arg1:ObjectEvent):void{
EventManager.removeEventListener((_arg1.target as EventDispatcher), AlienCage.EVENT_COLLECT_ALIEN, onCollectAlien);
m_colectedAliens++;
m_meters.drawAlien(m_colectedAliens);
SoundManager.getInstance().playSound(SoundConfig.SFX_COLLECT_ALIEN);
addPoints(POINTS_ALIEN, ((_arg1.object.gridX + 0.5) * View.TILE_SIZE), ((_arg1.object.gridY - 0.5) * View.TILE_SIZE));
displayHint(HINT_NAME_ALIEN);
}
private function onHeroHitEnemy(_arg1:HeroEvent):void{
m_hero.onCrushObject();
}
private function getTime(_arg1:String):int{
return (Crypto.decrypt(_arg1));
}
private function insertLiquid(_arg1:int, _arg2:int):void{
var _local3:*;
var _local4:int = m_levelInfo[LAYER_LIQUID][_arg2][_arg1];
var _local5:Point = new Point((_local4 & 0xFF), (_local4 >> 8));
if ((((_local5.x < 0xFF)) && ((_local5.y < 0xFF)))){
if (_local5.equals(Config.TILE_ACID_TOP)){
_local3 = new AcidTop(_arg1, _arg2, m_hero);
addActiveObject(_local3);
EventManager.addEventListener(_local3, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local3, HeroEvent.DAMAGE, onHeroDamage);
m_view.addObject(_local3, View.LAYER_FRONT);
if (m_objectsMap[_arg2][_arg1] == 0){
m_objectsMap[_arg2][_arg1] = OBJECT_MAP_NORMAL;
};
} else {
if (_local5.equals(Config.TILE_ACID_BOTTOM)){
_local3 = new AcidBottom(_arg1, _arg2, m_hero);
addActiveObject(_local3);
EventManager.addEventListener(_local3, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
EventManager.addEventListener(_local3, HeroEvent.DAMAGE, onHeroDamage);
m_view.addObject(_local3, View.LAYER_FRONT);
if (m_objectsMap[_arg2][_arg1] == 0){
m_objectsMap[_arg2][_arg1] = OBJECT_MAP_NORMAL;
};
};
};
};
}
private function getBitmapData(_arg1:String):BitmapData{
var _local2:Class = (getDefinitionByName(_arg1) as Class);
return ((new _local2(0, 0) as BitmapData));
}
private function onHeroNextToLego(_arg1:ObjectEvent):void{
var _local2:LegoBrickPlaceholder;
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:Boolean;
var _local7:int;
var _local8:int;
var _local9:Point;
var _local10:LegoBrickPlaceholder;
if (m_legoBricks > 0){
_local2 = (_arg1.target as LegoBrickPlaceholder);
_local3 = _arg1.object.gridX;
_local4 = _arg1.object.gridY;
_local5 = true;
_local6 = false;
_local7 = 0;
while (_local7 < 3) {
_local8 = m_levelInfo[LAYER_OBJECTS][(_local4 + 1)][((_local3 - 1) + _local7)];
_local9 = new Point((_local8 & 0xFF), (_local8 >> 8));
if (_local9.equals(Config.TILE_LEGO_PLACEHOLDER)){
_local5 = false;
_local10 = getLegoBrick(((_local3 - 1) + _local7), (_local4 + 1));
if (((_local10) && (_local10.isLocked))){
_local6 = true;
};
};
_local7++;
};
if (((_local5) || (_local6))){
EventManager.removeEventListener(_local2, LegoBrickPlaceholder.EVENT_HERO_NEXT_TO_LEGO, onHeroNextToLego);
_local2.enable();
m_legoBricks--;
};
};
}
private function startGame():void{
m_state = STATE_START_GAME;
EventManager.addEventListener(this, Event.ENTER_FRAME, loopMain);
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandler);
EventManager.addEventListener(stage, KeyboardEvent.KEY_UP, onKeyUpHandler);
}
private function getScreenShot():BitmapData{
var _local1:BitmapData = new BitmapData(stage.width, stage.height, false);
_local1.draw(stage);
return (_local1);
}
private function onCameraOnHero(_arg1:ViewEvent):void{
EventManager.removeEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnHero);
m_state = STATE_GAME;
}
private function onHintBoardOk(_arg1:Event):void{
EventManager.removeAllListeners(m_hintBoard);
removeChild(m_hintBoard);
m_hintBoard = null;
unpauseGame();
m_hero.enableKeys();
stage.focus = Main.getInstance();
}
private function onCloseInstructions(_arg1:Event):void{
EventManager.removeAllListeners(m_instructions);
removeChild(m_instructions);
m_instructions = null;
unpauseGame();
stage.focus = stage;
}
private function onCameraOnAlien(_arg1:ViewEvent):void{
EventManager.removeEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnAlien);
m_alien.open();
m_counter = 30;
m_state = STATE_OPEN_CAGE;
}
private function onLoadComplete(_arg1:BulkProgressEvent):void{
EventManager.removeAllListeners(m_loader);
gotoGame();
}
private function stepActiveObjects():void{
var _local1:*;
var _local2:int;
while (_local2 < m_activeObjectsList.length) {
_local1 = m_activeObjectsList[_local2];
if ((_local1 is ShotHero)){
(_local1 as ShotHero).setGround(m_view.getGroundBitmap());
(_local1 as ShotHero).setCameraTop(m_view.getCameraTop());
} else {
if ((_local1 is ShotGrenade)){
(_local1 as ShotGrenade).setGround(m_view.getGroundBitmap());
(_local1 as ShotGrenade).setCameraTop(m_view.getCameraTop());
} else {
if ((_local1 is ShotEnemy)){
(_local1 as ShotEnemy).setGround(m_view.getGroundBitmap());
(_local1 as ShotEnemy).setCameraTop(m_view.getCameraTop());
} else {
if ((_local1 is BaddieWalking)){
(_local1 as BaddieWalking).setShots(m_shotsList);
(_local1 as BaddieWalking).setBombs(m_bombsList);
};
};
};
};
_local1.step(m_view.bufferTileX, m_view.bufferTileY, (m_view.bufferTileX + View.VIEW_COLUMNS), (m_view.bufferTileY + View.VIEW_ROWS));
_local2++;
};
}
private function getPoints(_arg1:String):int{
return (Crypto.decrypt(_arg1));
}
private function onFrameGame():void{
var _local11:int;
var _local12:int;
var _local13:Point;
var _local14:SecretData;
var _local15:Bitmap;
var _local16:Secret;
var _local1:BitmapData = getBitmapData(m_levelData.mapUrl);
var _local2:BitmapParser = new BitmapParser(_local1, Config.LEVEL_LAYERS_AMOUNT);
m_levelInfo = _local2.layersList;
addBorder();
countObjects();
var _local3:Object = getStartPoint();
m_restartPosX = _local3.x;
m_restartPosY = _local3.y;
m_restartDir = _local3.dir;
if (m_heroTypeBoy){
m_hero = new HeroBoy(m_restartPosX, m_restartPosY, m_restartDir, (m_levelInfo[0][0].length * View.TILE_SIZE), (m_levelInfo[0].length * View.TILE_SIZE));
} else {
m_hero = new HeroGirl(m_restartPosX, m_restartPosY, m_restartDir, (m_levelInfo[0][0].length * View.TILE_SIZE), (m_levelInfo[0].length * View.TILE_SIZE));
};
EventManager.addEventListener(m_hero, ShotEvent.CREATE, onHeroShoot);
EventManager.addEventListener(m_hero, HeroEvent.DEATH_ANIM_END, onHeroDeathAnimEnd);
EventManager.addEventListener(m_hero, HeroEvent.DAMAGE, onHeroDamage);
m_hero.visible = false;
var _local4:BitmapData = getBitmapData(m_levelData.backgroundUrl);
var _local5:BitmapData = getBitmapData(m_levelData.tilesetUrl);
m_marblesAmount = Crypto.encrypt(0);
m_rareMarbId = -1;
m_doorKeysAmount = 0;
m_marbleKeysAmount = 0;
m_legoBricks = 0;
m_colectedAliens = 0;
m_secretsVisited = new Array();
m_livesAmount = LIVES_AMOUNT;
m_energyAmount = ENERGY_AMOUNT;
m_gameTime = Crypto.encrypt((m_levelData.time * Config.FPS));
m_bossActivated = false;
m_exitKey = false;
m_bonusUnlocked = false;
m_wasHintCloud = false;
m_activeObjectsList = new Array();
m_doorsList = new Array();
m_aliensList = new Array();
m_legoList = new Array();
m_shotsList = new Array();
m_bombsList = new Array();
m_enemyShotsList = new Array();
var _local6:int = m_levelInfo[LAYER_WALLS][0].length;
var _local7:int = m_levelInfo[LAYER_WALLS].length;
m_itemsMap = new Array(_local7);
m_objectsMap = new Array(_local7);
m_collisionTable = new Array(_local7);
var _local8:int;
while (_local8 < _local7) {
m_collisionTable[_local8] = new Array(_local6);
m_itemsMap[_local8] = new Array(_local6);
m_objectsMap[_local8] = new Array(_local6);
_local11 = 0;
while (_local11 < _local6) {
m_collisionTable[_local8][_local11] = 0;
m_itemsMap[_local8][_local11] = 0;
m_objectsMap[_local8][_local11] = 0;
_local11++;
};
_local8++;
};
EventManager.addEventListener(m_view, ViewEvent.INSERT_OBJECT, onInsertObject);
m_view.init(m_levelInfo, new Point(m_hero.x, m_hero.y), _local3.dir, _local4, _local5);
_local8 = 0;
while (_local8 < _local7) {
_local11 = 0;
while (_local11 < _local6) {
_local12 = m_levelInfo[LAYER_OBJECTS][_local8][_local11];
_local13 = new Point((_local12 & 0xFF), (_local12 >> 8));
if ((((_local13.x < 0xFF)) && ((_local13.y < 0xFF)))){
if (((((((((((((_local13.equals(Config.TILE_PLATFORM_HORIZONTAL)) || (_local13.equals(Config.TILE_PLATFORM_VERTICAL)))) || (_local13.equals(Config.TILE_DOOR)))) || (_local13.equals(Config.TILE_SAVEPOINT)))) || (_local13.equals(Config.TILE_THUMPER)))) || (_local13.equals(Config.TILE_ALIEN_CAGE)))) || (_local13.equals(Config.TILE_EXIT)))){
onInsertObject(new ViewEvent(ViewEvent.INSERT_OBJECT, _local11, _local8));
};
};
_local11++;
};
_local8++;
};
m_hero.init(m_view.bmpTiles, m_collisionTable);
m_view.addObject(m_hero, View.LAYER_HERO);
m_view.draw();
var _local9:Array = m_levelData.secrets;
var _local10:int;
while (_local10 < _local9.length) {
_local14 = _local9[_local10];
_local15 = new Bitmap(m_view.getSecret(_local14.rect));
_local16 = new Secret(_local14, _local15, m_hero);
m_view.addObject(_local15, View.LAYER_SECRETS);
addActiveObject(_local16);
EventManager.addEventListener(_local16, Secret.EVENT_SHOW_SECRET, onSecretShow);
EventManager.addEventListener(_local16, ActiveObjectEvent.REMOVED, onRemoveActiveObject);
_local10++;
};
m_meters.init(m_aliensToCollect);
EventManager.addEventListener(m_meters, Meters.EVENT_SHOW_INSTRUCTIONS, onShowInstructions);
EventManager.addEventListener(m_meters, Meters.EVENT_CLICK_PAUSE, onClickPause);
m_meters.drawMarbs(Crypto.decrypt(m_marblesAmount), false);
m_meters.drawKeys(m_doorKeysAmount, false);
m_meters.drawLives(m_livesAmount, false);
m_meters.drawPoints(getPoints(m_levelPoints));
m_meters.drawEnergy((m_energyAmount / ENERGY_AMOUNT), false);
if (m_rareMarbs[0]){
m_meters.drawRare(0);
};
if (m_rareMarbs[1]){
m_meters.drawRare(1);
};
startGame();
EventManager.addEventListener(stage, Event.DEACTIVATE, onDeactivateHandler);
}
private function onPressDoorTrigger(_arg1:TriggerEvent):void{
var _local2:Door = (m_doorsList[_arg1.id] as Door);
var _local3:Boolean = _local2.areOnScreen((m_view.bufferTileX + 1), (m_view.bufferTileY + 2), ((m_view.bufferTileX + View.VIEW_COLUMNS) - 1), ((m_view.bufferTileY + View.VIEW_ROWS) - 1));
if (_local3){
_local2.open();
} else {
m_door = _local2;
m_state = STATE_MOVE_TO_DOOR;
EventManager.addEventListener(m_view, ViewEvent.CAMERA_ON_TARGET, onCameraOnDoor);
m_hero.stopMovement();
drawActiveObjects(true);
};
SoundManager.getInstance().playSound(SoundConfig.SFX_TRIGGER);
}
private function getLegoBrick(_arg1:int, _arg2:int):LegoBrickPlaceholder{
var _local4:LegoBrickPlaceholder;
var _local3:int;
while (_local3 < m_legoList.length) {
_local4 = m_legoList[_local3];
if ((((_local4.gridX == _arg1)) && ((_local4.gridY == _arg2)))){
return (_local4);
};
_local3++;
};
return (null);
}
private function gotoGame():void{
gotoAndStop(LABEL_GAME);
var _local1:SoundManager = SoundManager.getInstance();
var _local2:SoundInstance = _local1.getMusic(SoundConfig.MUSIC_MENU_PANEL);
_local2.volumeTo(0, 2, true);
var _local3:SoundInstance = _local1.getMusic(SoundConfig.MUSIC_1);
_local1.playMusic(SoundConfig.MUSIC_1);
_local3.volume = 0;
_local3.volumeTo(1, 2);
}
private function onCollectItem(_arg1:ItemEvent):void{
var _local2:Item = (_arg1.target as Item);
m_itemsMap[_arg1.gridY][_arg1.gridX] = -1;
EventManager.removeEventListener(_local2, ItemEvent.COLLECTED, onCollectItem);
switch (_arg1.itemType){
case Item.TYPE_MARBLE:
m_marblesAmount = Crypto.encrypt((Crypto.decrypt(m_marblesAmount) + 1));
m_meters.drawMarbs(Crypto.decrypt(m_marblesAmount));
SoundManager.getInstance().playSound(SoundConfig.SFX_COLLECT);
if (m_isBonusLevel){
addPoints((POINTS_MARBLE * 2), ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
} else {
addPoints(POINTS_MARBLE, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
};
displayHint(HINT_NAME_MARBLE);
break;
case Item.TYPE_SPECIAL_MARBLE:
m_rareMarbId = ItemSpecialMarble(_local2).id;
m_meters.drawRare(m_rareMarbId);
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_RARE_MARB, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
if (Main.getInstance().isLoggedIn){
displayHint(HINT_NAME_RARE_LOGGED_IN);
} else {
displayHint(HINT_NAME_RARE_LOGGED_OUT);
};
if (m_rareMarbId == 0){
Main.trackEvent(Config.MEME_RARE_MARB_1);
} else {
Main.trackEvent(Config.MEME_RARE_MARB_2);
};
break;
case Item.TYPE_MARBLE_KEY:
m_marbleKeysAmount++;
m_meters.drawKeys(m_marbleKeysAmount);
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_KEY_CHEST, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
displayHint(HINT_NAME_KEY);
break;
case Item.TYPE_LEGO_BRICK:
m_legoBricks++;
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_LEGO_BRICK, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
displayHint(HINT_NAME_BLOCK);
break;
case Item.TYPE_ENERGY:
m_energyAmount = (m_energyAmount + 25);
if (m_energyAmount > ENERGY_AMOUNT){
m_energyAmount = ENERGY_AMOUNT;
};
m_meters.drawEnergy((m_energyAmount / ENERGY_AMOUNT));
SoundManager.getInstance().playSound(SoundConfig.SFX_ENERGY_COLLECT);
addPoints(POINTS_ENERGY, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
break;
case Item.TYPE_LIFE:
m_livesAmount++;
m_meters.drawLives(m_livesAmount);
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_LIFE, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
break;
case Item.TYPE_EXIT_KEY:
m_exitKey = true;
m_meters.drawExitKey();
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_KEY_EXIT, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
displayHint(HINT_NAME_KEY);
break;
case Item.TYPE_BONUS:
m_bonusUnlocked = true;
SoundManager.getInstance().playSound(SoundConfig.SFX_LIFE_COLLECT);
addPoints(POINTS_BONUS_UNLOCK, ((_arg1.gridX + 0.5) * View.TILE_SIZE), ((_arg1.gridY + 0.5) * View.TILE_SIZE));
displayHint(HINT_NAME_BONUS_UNLOCK);
break;
};
}
}
}//package game
Section 113
//HintsManager (game.HintsManager)
package game {
import data.*;
public class HintsManager {
private static var s_hints:Array;
public static function getHint(_arg1:String):HintData{
var _local3:HintData;
var _local2:int;
while (_local2 < s_hints.length) {
if (s_hints[_local2].name == _arg1){
_local3 = s_hints[_local2];
if (!_local3.displayed){
_local3.markAsDisplayed();
Main.getInstance().saveHint(_local3.id);
return (_local3);
};
return (null);
};
_local2++;
};
return (null);
}
public static function init(_arg1:Array, _arg2:Array):void{
s_hints = _arg1;
var _local3:int;
while (_local3 < _arg2.length) {
if (_arg2[_local3]){
HintData(_arg1[_local3]).markAsDisplayed();
};
_local3++;
};
}
}
}//package game
Section 114
//Meters (game.Meters)
package game {
import flash.display.*;
import flash.events.*;
import caurina.transitions.*;
import com.gskinner.utils.*;
import utils.*;
import caurina.transitions.properties.*;
public class Meters extends MovieClip {
private const LABEL_CHARGE:String = "charge";
public var m_mcLife:MovieClip;
public var m_mcScore:MovieClip;
public var m_btnPause:MovieClip;
public var m_btnInstructions:SimpleButton;
public var m_mcTitle:MovieClip;
public var m_mcTime:MovieClip;
public var m_mcExitKey:MovieClip;
public var m_mcAliens:MovieClip;
public var m_mcMarbz:MovieClip;
public static const EVENT_SHOW_INSTRUCTIONS:String = "onShowInstructions";
public static const EVENT_CLICK_PAUSE:String = "onClickPause";
public function Meters(){
m_mcExitKey.stop();
ColorShortcuts.init();
DisplayShortcuts.init();
EventManager.addEventListener(m_btnInstructions, MouseEvent.CLICK, onClickInstructions);
setPauseButtonIconPause();
var _local1:FrameScriptManager = new FrameScriptManager(m_btnPause);
_local1.setFrameScript("pauseIcon", onPauseFramePauseIcon);
_local1.setFrameScript("playIcon", onPauseFramePlayIcon);
m_mcLife.mcLife4.gotoAndStop(21);
}
private function onPauseFramePlayIcon():void{
m_btnPause.button.enable();
m_btnPause.button.addEventListener(MouseEvent.CLICK, onClickPause);
}
public function drawRare(_arg1:int){
m_mcMarbz[("mcMarb" + _arg1)].gotoAndStop("on");
}
public function drawPoints(_arg1:int):void{
m_mcScore.tfScore.text = _arg1.toString();
}
public function drawMarbs(_arg1:int, _arg2:Boolean=true):void{
m_mcMarbz.tfMarbz.text = _arg1.toString();
}
private function onClickPause(_arg1:MouseEvent):void{
dispatchEvent(new Event(EVENT_CLICK_PAUSE));
}
private function onPauseFramePauseIcon():void{
m_btnPause.button.enable();
m_btnPause.button.addEventListener(MouseEvent.CLICK, onClickPause);
}
public function init(_arg1:int):void{
m_mcAliens.gotoAndStop(_arg1);
}
public function drawKeys(_arg1:int, _arg2:Boolean=true):void{
}
public function drawLives(_arg1:int, _arg2:Boolean=true):void{
var _local3 = 1;
var _local4:int;
while (_local4 < 4) {
if (m_mcLife[("mcLife" + (_local4 + 1))].currentFrame == 1){
_local3 = (_local4 + 1);
};
_local4++;
};
if (_arg1 <= _local3){
m_mcLife[("mcLife" + (_arg1 + 1))].gotoAndPlay("off");
} else {
if (_arg1 > _local3){
m_mcLife[("mcLife" + _arg1)].gotoAndStop("on");
};
};
}
public function setPauseButtonIconPause():void{
m_btnPause.button.removeEventListener(MouseEvent.CLICK, onClickPause);
m_btnPause.gotoAndStop("pauseIcon");
}
public function drawEnergy(_arg1:Number, _arg2:Boolean=true):void{
Tweener.addTween(m_mcLife.mcBar, {_frame:(101 - int((_arg1 * 100))), time:0.2});
if (_arg2){
Tweener.addTween(m_mcLife.mcBar, {_brightness:1, time:0.1});
Tweener.addTween(m_mcLife.mcBar, {_brightness:0, time:0.1, delay:0.1});
};
}
public function drawTime(_arg1:int, _arg2:int):void{
var _local3:int = (_arg1 % 60);
var _local4:int = int((_arg1 / 60));
m_mcTime.tfTime.text = ((((((_local4)<10) ? "0" : "" + _local4) + ":") + ((_local3)<10) ? "0" : "") + _local3);
m_mcTime.mcBar.gotoAndStop((101 - int(((100 * _arg1) / _arg2))));
}
private function onClickInstructions(_arg1:MouseEvent):void{
dispatchEvent(new Event(EVENT_SHOW_INSTRUCTIONS));
}
public function setPauseButtonIconPlay():void{
m_btnPause.button.removeEventListener(MouseEvent.CLICK, onClickPause);
m_btnPause.gotoAndStop("playIcon");
}
public function drawAlien(_arg1:int):void{
m_mcAliens[("mcAlien" + _arg1)].gotoAndPlay("on");
}
public function drawExitKey():void{
m_mcExitKey.gotoAndStop("on");
}
}
}//package game
Section 115
//AttachedSounds_5 (mission1_fla.AttachedSounds_5)
package mission1_fla {
import flash.display.*;
public dynamic class AttachedSounds_5 extends MovieClip {
public function AttachedSounds_5(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mission1_fla
Section 116
//bad_cloud_idle_413 (mission1_fla.bad_cloud_idle_413)
package mission1_fla {
import flash.display.*;
public dynamic class bad_cloud_idle_413 extends MovieClip {
public function bad_cloud_idle_413(){
addFrameScript(79, frame80);
}
function frame80(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 117
//boyglide_364 (mission1_fla.boyglide_364)
package mission1_fla {
import flash.display.*;
public dynamic class boyglide_364 extends MovieClip {
public function boyglide_364(){
addFrameScript(19, frame20);
}
function frame20(){
gotoAndPlay(1);
}
}
}//package mission1_fla
Section 118
//boyjumpshoot_374 (mission1_fla.boyjumpshoot_374)
package mission1_fla {
import flash.display.*;
public dynamic class boyjumpshoot_374 extends MovieClip {
public function boyjumpshoot_374(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package mission1_fla
Section 119
//boyrun_359 (mission1_fla.boyrun_359)
package mission1_fla {
import flash.display.*;
public dynamic class boyrun_359 extends MovieClip {
public function boyrun_359(){
addFrameScript(16, frame17);
}
function frame17(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 120
//boyrunshoot_369 (mission1_fla.boyrunshoot_369)
package mission1_fla {
import flash.display.*;
public dynamic class boyrunshoot_369 extends MovieClip {
public function boyrunshoot_369(){
addFrameScript(16, frame17);
}
function frame17(){
gotoAndPlay(1);
}
}
}//package mission1_fla
Section 121
//boyshoot_370 (mission1_fla.boyshoot_370)
package mission1_fla {
import flash.display.*;
public dynamic class boyshoot_370 extends MovieClip {
public function boyshoot_370(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package mission1_fla
Section 122
//boywalk_358 (mission1_fla.boywalk_358)
package mission1_fla {
import flash.display.*;
public dynamic class boywalk_358 extends MovieClip {
public function boywalk_358(){
addFrameScript(20, frame21);
}
function frame21(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 123
//char_bg_176 (mission1_fla.char_bg_176)
package mission1_fla {
import flash.display.*;
public dynamic class char_bg_176 extends MovieClip {
public function char_bg_176(){
addFrameScript(4, frame5, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
}
}//package mission1_fla
Section 124
//chest_rays_323 (mission1_fla.chest_rays_323)
package mission1_fla {
import flash.display.*;
public dynamic class chest_rays_323 extends MovieClip {
public function chest_rays_323(){
addFrameScript(28, frame29);
}
function frame29(){
gotoAndPlay("loop");
}
}
}//package mission1_fla
Section 125
//girlglide_385 (mission1_fla.girlglide_385)
package mission1_fla {
import flash.display.*;
public dynamic class girlglide_385 extends MovieClip {
public function girlglide_385(){
addFrameScript(19, frame20);
}
function frame20(){
gotoAndPlay(1);
}
}
}//package mission1_fla
Section 126
//girljumpshoot_392 (mission1_fla.girljumpshoot_392)
package mission1_fla {
import flash.display.*;
public dynamic class girljumpshoot_392 extends MovieClip {
public function girljumpshoot_392(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package mission1_fla
Section 127
//girlrun_380 (mission1_fla.girlrun_380)
package mission1_fla {
import flash.display.*;
public dynamic class girlrun_380 extends MovieClip {
public function girlrun_380(){
addFrameScript(16, frame17);
}
function frame17(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 128
//girlrunshoot_389 (mission1_fla.girlrunshoot_389)
package mission1_fla {
import flash.display.*;
public dynamic class girlrunshoot_389 extends MovieClip {
public function girlrunshoot_389(){
addFrameScript(16, frame17);
}
function frame17(){
gotoAndPlay(1);
}
}
}//package mission1_fla
Section 129
//girlshoot_390 (mission1_fla.girlshoot_390)
package mission1_fla {
import flash.display.*;
public dynamic class girlshoot_390 extends MovieClip {
public function girlshoot_390(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package mission1_fla
Section 130
//girlwalk_379 (mission1_fla.girlwalk_379)
package mission1_fla {
import flash.display.*;
public dynamic class girlwalk_379 extends MovieClip {
public function girlwalk_379(){
addFrameScript(20, frame21);
}
function frame21(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 131
//HUD_alien_mc_203 (mission1_fla.HUD_alien_mc_203)
package mission1_fla {
import flash.display.*;
public dynamic class HUD_alien_mc_203 extends MovieClip {
public function HUD_alien_mc_203(){
addFrameScript(0, frame1, 19, frame20);
}
function frame20(){
stop();
}
function frame1(){
stop();
}
}
}//package mission1_fla
Section 132
//HUD_life_bar_207 (mission1_fla.HUD_life_bar_207)
package mission1_fla {
import flash.display.*;
public dynamic class HUD_life_bar_207 extends MovieClip {
public function HUD_life_bar_207(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mission1_fla
Section 133
//HUD_life_heart_mc_209 (mission1_fla.HUD_life_heart_mc_209)
package mission1_fla {
import flash.display.*;
public dynamic class HUD_life_heart_mc_209 extends MovieClip {
public function HUD_life_heart_mc_209(){
addFrameScript(0, frame1, 20, frame21);
}
function frame21(){
stop();
}
function frame1(){
stop();
}
}
}//package mission1_fla
Section 134
//HUD_time_bar_212 (mission1_fla.HUD_time_bar_212)
package mission1_fla {
import flash.display.*;
public dynamic class HUD_time_bar_212 extends MovieClip {
public function HUD_time_bar_212(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package mission1_fla
Section 135
//HUD_trophy_mc_214 (mission1_fla.HUD_trophy_mc_214)
package mission1_fla {
import flash.display.*;
public dynamic class HUD_trophy_mc_214 extends MovieClip {
public function HUD_trophy_mc_214(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
stop();
}
function frame11(){
stop();
}
}
}//package mission1_fla
Section 136
//intro_circle_mc_189 (mission1_fla.intro_circle_mc_189)
package mission1_fla {
import flash.display.*;
public dynamic class intro_circle_mc_189 extends MovieClip {
public function intro_circle_mc_189(){
addFrameScript(63, frame64);
}
function frame64(){
stop();
}
}
}//package mission1_fla
Section 137
//marb_blue_mc_86 (mission1_fla.marb_blue_mc_86)
package mission1_fla {
import flash.display.*;
public dynamic class marb_blue_mc_86 extends MovieClip {
public function marb_blue_mc_86(){
addFrameScript(6, frame7, 14, frame15);
}
function frame15(){
stop();
}
function frame7(){
stop();
}
}
}//package mission1_fla
Section 138
//marb_clear_mc_89 (mission1_fla.marb_clear_mc_89)
package mission1_fla {
import flash.display.*;
public dynamic class marb_clear_mc_89 extends MovieClip {
public function marb_clear_mc_89(){
addFrameScript(6, frame7, 14, frame15);
}
function frame15(){
stop();
}
function frame7(){
stop();
}
}
}//package mission1_fla
Section 139
//marb_red_mc_79 (mission1_fla.marb_red_mc_79)
package mission1_fla {
import flash.display.*;
public dynamic class marb_red_mc_79 extends MovieClip {
public var marb_red:MovieClip;
public function marb_red_mc_79(){
addFrameScript(6, frame7, 14, frame15);
}
function frame15(){
stop();
}
function frame7(){
stop();
}
}
}//package mission1_fla
Section 140
//marb_white_mc_92 (mission1_fla.marb_white_mc_92)
package mission1_fla {
import flash.display.*;
public dynamic class marb_white_mc_92 extends MovieClip {
public function marb_white_mc_92(){
addFrameScript(6, frame7, 14, frame15);
}
function frame15(){
stop();
}
function frame7(){
stop();
}
}
}//package mission1_fla
Section 141
//marb_yellow_mc_83 (mission1_fla.marb_yellow_mc_83)
package mission1_fla {
import flash.display.*;
public dynamic class marb_yellow_mc_83 extends MovieClip {
public function marb_yellow_mc_83(){
addFrameScript(6, frame7, 14, frame15);
}
function frame15(){
stop();
}
function frame7(){
stop();
}
}
}//package mission1_fla
Section 142
//nextbutton_157 (mission1_fla.nextbutton_157)
package mission1_fla {
import flash.display.*;
public dynamic class nextbutton_157 extends MovieClip {
public var m_btnNext:next_butt;
public function nextbutton_157(){
addFrameScript(0, frame1, 25, frame26, 41, frame42);
}
function frame26(){
stop();
}
function frame1(){
stop();
}
function frame42(){
stop();
}
}
}//package mission1_fla
Section 143
//prevbutton_165 (mission1_fla.prevbutton_165)
package mission1_fla {
import flash.display.*;
public dynamic class prevbutton_165 extends MovieClip {
public var m_btnPrev:prev_butt;
public function prevbutton_165(){
addFrameScript(0, frame1, 25, frame26, 41, frame42);
}
function frame26(){
stop();
}
function frame1(){
stop();
}
function frame42(){
stop();
}
}
}//package mission1_fla
Section 144
//savepointanim_284 (mission1_fla.savepointanim_284)
package mission1_fla {
import flash.display.*;
public dynamic class savepointanim_284 extends MovieClip {
public function savepointanim_284(){
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package mission1_fla
Section 145
//sick_cloud_idle_425 (mission1_fla.sick_cloud_idle_425)
package mission1_fla {
import flash.display.*;
public dynamic class sick_cloud_idle_425 extends MovieClip {
public function sick_cloud_idle_425(){
addFrameScript(22, frame23);
}
function frame23(){
gotoAndStop(1);
}
}
}//package mission1_fla
Section 146
//MonsterDebugger (nl.demonsters.debugger.MonsterDebugger)
package nl.demonsters.debugger {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MonsterDebugger {
private const TYPE_BOOLEAN:String = "Boolean";
private const COMMAND_GET_DISPLAYOBJECT:String = "GET_DISPLAYOBJECT";
private const TYPE_VECTOR:String = "Vector";
private const TYPE_XMLLIST:String = "XMLList";
private const COMMAND_TRACE:String = "TRACE";
private const ACCESS_METHOD:String = "method";
private const TYPE_XMLVALUE:String = "XMLValue";
private const COMMAND_NOTFOUND:String = "NOTFOUND";
protected const MAX_BUFFER_SIZE:int = 500;
private const COMMAND_MONITOR:String = "MONITOR";
private const ACCESS_CONSTANT:String = "constant";
protected const HIGHLIGHT_BORDER:int = 4;
private const TYPE_FUNCTION:String = "Function";
private const TYPE_UINT:String = "uint";
private const TYPE_INT:String = "int";
protected const MAX_PACKAGE_BYTES:int = 40000;
private const LINE_IN:String = "_debuggerBlue";
private const TYPE_XMLATTRIBUTE:String = "XMLAttribute";
private const COMMAND_SNAPSHOT:String = "SNAPSHOT";
private const ALLOWED_DOMAIN:String = "*";
private const ICON_VARIABLE_READONLY:String = "iconVariableReadonly";
private const ICON_DEFAULT:String = "iconDefault";
private const LINE_OUT:String = "_debuggerRed";
private const COMMAND_BASE:String = "BASE";
private const COMMAND_SHOW_HIGHLIGHT:String = "SHOW_HIGHLIGHT";
private const COMMAND_HIDE_HIGHLIGHT:String = "HIDE_HIGHLIGHT";
private const TYPE_BYTEARRAY:String = "ByteArray";
private const ICON_VARIABLE_WRITEONLY:String = "iconVariableWriteonly";
private const COMMAND_GET_PROPERTIES:String = "GET_PROPERTIES";
private const TYPE_XML:String = "XML";
private const TYPE_XMLNODE:String = "XMLNode";
private const COMMAND_ROOT:String = "ROOT";
private const TYPE_WARNING:String = "Warning";
private const TYPE_VOID:String = "void";
private const PERMISSION_WRITEONLY:String = "writeonly";
private const PERMISSION_READWRITE:String = "readwrite";
private const ICON_VARIABLE:String = "iconVariable";
private const TYPE_METHOD:String = "MethodClosure";
private const ICON_XMLATTRIBUTE:String = "iconXMLAttribute";
private const COMMAND_HELLO:String = "HELLO";
private const COMMAND_GET_FUNCTIONS:String = "GET_FUNCTIONS";
private const PERMISSION_READONLY:String = "readonly";
private const ICON_XMLNODE:String = "iconXMLNode";
private const COMMAND_CLEAR_TRACES:String = "CLEAR_TRACES";
protected const VERSION:Number = 2.51;
private const ICON_WARNING:String = "iconWarning";
private const COMMAND_HELLO_RESPONSE:String = "HELLO_RESPONSE";
private const ICON_XMLVALUE:String = "iconXMLValue";
private const ACCESS_ACCESSOR:String = "accessor";
private const COMMAND_SET_PROPERTY:String = "SET_PROPERTY";
private const TYPE_STRING:String = "String";
private const COMMAND_CALL_METHOD:String = "CALL_METHOD";
private const ICON_FUNCTION:String = "iconFunction";
protected const HIGHLIGHT_COLOR:uint = 0xFFFF00;
private const COMMAND_INSPECT:String = "INSPECT";
private const TYPE_OBJECT:String = "Object";
private const TYPE_NUMBER:String = "Number";
private const ICON_ROOT:String = "iconRoot";
private const TYPE_ARRAY:String = "Array";
private const ACCESS_VARIABLE:String = "variable";
private const COMMAND_GET_OBJECT:String = "GET_OBJECT";
protected const FPS_UPDATE:int = 500;
protected var isConnected:Boolean;// = false
protected var monitorStart:Number;
private var lineIn:LocalConnection;
protected var buffer:Array;
protected var monitorTime:Number;
protected var monitor:Timer;
public var logger:Function;
protected var monitorFrames:uint;
private var lineOut:LocalConnection;
protected var highlight:Sprite;// = null
protected var monitorSprite:Sprite;
protected var isEnabled:Boolean;// = true
protected var root:Object;// = null
public static const COLOR_WARNING:uint = 0xFF3300;
public static const COLOR_NORMAL:uint = 0x111111;
public static const COLOR_ERROR:uint = 0xFF0000;
private static var instance:MonsterDebugger = null;
public function MonsterDebugger(_arg1:Object=null){
var target = _arg1;
buffer = new Array();
super();
if (instance == null){
instance = this;
lineOut = new LocalConnection();
lineOut.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler, false, 0, true);
lineOut.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
lineOut.addEventListener(StatusEvent.STATUS, statusHandler, false, 0, true);
lineIn = new LocalConnection();
lineIn.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler, false, 0, true);
lineIn.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
lineIn.addEventListener(StatusEvent.STATUS, statusHandler, false, 0, true);
lineIn.allowDomain(ALLOWED_DOMAIN);
lineIn.client = this;
monitorTime = new Date().time;
monitorStart = new Date().time;
monitorFrames = 0;
monitorSprite = new Sprite();
monitorSprite.addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
monitor = new Timer(FPS_UPDATE);
monitor.addEventListener(TimerEvent.TIMER, monitorHandler, false, 0, true);
monitor.start();
try {
lineIn.connect(LINE_IN);
} catch(error:ArgumentError) {
};
};
instance.root = target;
instance.send({text:COMMAND_HELLO, version:VERSION});
}
private function statusHandler(_arg1:StatusEvent):void{
if (_arg1.level == "error"){
isConnected = false;
};
}
private function asyncErrorHandler(_arg1:AsyncErrorEvent):void{
isConnected = false;
}
protected function htmlEscape(_arg1:String):String{
var _local2:XML;
if (_arg1){
if (_arg1.indexOf("&") != -1){
_arg1 = _arg1.split("&").join("&");
};
if (_arg1.indexOf("<") != -1){
_arg1 = _arg1.split("<").join("<");
};
if (_arg1.indexOf(">") != -1){
_arg1 = _arg1.split(">").join(">");
};
if (_arg1.indexOf("'") != -1){
_arg1 = _arg1.split("'").join("'");
};
if (_arg1.indexOf("\"") != -1){
_arg1 = _arg1.split("\"").join(""");
};
_local2 = new XML((("<a>" + ??esc_xelem
) + "</a>"));
return (_local2.toXMLString().replace(/(^<a>)|(<\/a>$)|(^<a\/>$)/g, ""));
//unresolved jump
};
return ("");
}
protected function sendBuffer():void{
if (buffer.length > 0){
while (buffer.length != 0) {
send(buffer.shift());
};
};
}
protected function createNode(_arg1:String, _arg2:Object=null, _arg3:Boolean=false):String{
var _local5:*;
var _local4 = "";
_local4 = (_local4 + ("<" + _arg1));
if (_arg2){
for (_local5 in _arg2) {
_local4 = (_local4 + ((((" " + _local5) + "=\"") + _arg2[_local5]) + "\""));
};
};
if (_arg3){
_local4 = (_local4 + (("></" + _arg1) + ">"));
} else {
_local4 = (_local4 + ">");
};
return (_local4);
}
protected function enterFrameHandler(_arg1:Event):void{
if (isEnabled){
monitorFrames++;
};
}
protected function traceInternal(_arg1:Object, _arg2, _arg3:uint=0x111111, _arg4:Boolean=false, _arg5:int=4):void{
var _local6:XML;
var _local7:uint;
var _local8:Object;
if (isEnabled){
_local6 = XML(parseObject(_arg2, "", _arg4, 1, _arg5));
_local7 = System.totalMemory;
_local8 = {text:COMMAND_TRACE, date:new Date(), target:String(_arg1), xml:_local6, color:_arg3, memory:_local7};
if (isConnected){
send(_local8);
} else {
sendToBuffer(_local8);
};
};
}
protected function getObject(_arg1:String="", _arg2:int=0){
var splitted:Array;
var i:int;
var index:Number;
var obj:Object;
var target = _arg1;
var parent = _arg2;
var object:* = instance.root;
if (target != ""){
splitted = target.split(".");
i = 0;
while (i < (splitted.length - parent)) {
if (splitted[i] != ""){
try {
if (splitted[i] == "children()"){
object = object.children();
} else {
if (splitted[i].indexOf("getChildAt(") == 0){
index = splitted[i].substring(11, splitted[i].indexOf(")", 11));
object = DisplayObjectContainer(object).getChildAt(index);
} else {
object = object[splitted[i]];
};
};
} catch(error:ReferenceError) {
obj = {text:COMMAND_NOTFOUND, target:target};
if (isConnected){
send(obj);
} else {
sendToBuffer(obj);
};
break;
};
};
i = (i + 1);
};
};
return (object);
}
protected function sendToBuffer(_arg1:Object):void{
buffer.push(_arg1);
if (buffer.length > MAX_BUFFER_SIZE){
buffer.shift();
};
}
protected function printObject(_arg1, _arg2:String):String{
var _local3 = "";
if (_arg2 == TYPE_BYTEARRAY){
_local3 = (_arg1["length"] + " bytes");
} else {
_local3 = htmlEscape(String(_arg1));
};
return (_local3);
}
protected function clearTracesInternal():void{
var _local1:Object;
if (isEnabled){
_local1 = {text:COMMAND_CLEAR_TRACES};
if (isConnected){
send(_local1);
} else {
sendToBuffer(_local1);
};
};
}
protected function parseXML(_arg1, _arg2:String="", _arg3:int=1, _arg4:int=-1):String{
var _local7:String;
var _local5 = "";
var _local6:int;
if ((((_arg4 == -1)) || ((_arg3 <= _arg4)))){
if (_arg2.indexOf("@") != -1){
_local5 = (_local5 + createNode("node", {icon:ICON_XMLATTRIBUTE, label:_arg1, name:"", type:TYPE_XMLATTRIBUTE, value:_arg1, target:_arg2, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
if (_arg1.name() == null){
_local5 = (_local5 + createNode("node", {icon:ICON_XMLVALUE, label:((("(" + TYPE_XMLVALUE) + ") = ") + printObject(_arg1, TYPE_XMLVALUE)), name:"", type:TYPE_XMLVALUE, value:printObject(_arg1, TYPE_XMLVALUE), target:_arg2, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
if (_arg1.hasSimpleContent()){
_local5 = (_local5 + createNode("node", {icon:ICON_XMLNODE, label:(((_arg1.name() + " (") + TYPE_XMLNODE) + ")"), name:_arg1.name(), type:TYPE_XMLNODE, value:"", target:_arg2, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}));
if (_arg1 != ""){
_local5 = (_local5 + createNode("node", {icon:ICON_XMLVALUE, label:((("(" + TYPE_XMLVALUE) + ") = ") + printObject(_arg1, TYPE_XMLVALUE)), name:"", type:TYPE_XMLVALUE, value:printObject(_arg1, TYPE_XMLVALUE), target:_arg2, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
};
_local6 = 0;
while (_local6 < _arg1.attributes().length()) {
_local5 = (_local5 + createNode("node", {icon:ICON_XMLATTRIBUTE, label:((((("@" + _arg1.attributes()[_local6].name()) + " (") + TYPE_XMLATTRIBUTE) + ") = ") + _arg1.attributes()[_local6]), name:"", type:TYPE_XMLATTRIBUTE, value:_arg1.attributes()[_local6], target:(((_arg2 + ".") + "@") + _arg1.attributes()[_local6].name()), access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
_local6++;
};
_local5 = (_local5 + createNode("/node"));
} else {
_local5 = (_local5 + createNode("node", {icon:ICON_XMLNODE, label:(((_arg1.name() + " (") + TYPE_XMLNODE) + ")"), name:_arg1.name(), type:TYPE_XMLNODE, value:"", target:_arg2, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}));
_local6 = 0;
while (_local6 < _arg1.attributes().length()) {
_local5 = (_local5 + createNode("node", {icon:ICON_XMLATTRIBUTE, label:((((("@" + _arg1.attributes()[_local6].name()) + " (") + TYPE_XMLATTRIBUTE) + ") = ") + _arg1.attributes()[_local6]), name:"", type:TYPE_XMLATTRIBUTE, value:_arg1.attributes()[_local6], target:(((_arg2 + ".") + "@") + _arg1.attributes()[_local6].name()), access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
_local6++;
};
_local6 = 0;
while (_local6 < _arg1.children().length()) {
_local7 = ((((_arg2 + ".") + "children()") + ".") + _local6);
_local5 = (_local5 + parseXML(_arg1.children()[_local6], _local7, (_arg3 + 1), _arg4));
_local6++;
};
_local5 = (_local5 + createNode("/node"));
};
};
};
};
return (_local5);
}
protected function send(_arg1:Object):void{
var item:ByteArray;
var dataPackages:Array;
var i:int;
var bytesAvailable:int;
var offset:int;
var total:int;
var length:int;
var tmp:ByteArray;
var data = _arg1;
if (isEnabled){
item = new ByteArray();
item.writeObject(data);
item.compress();
dataPackages = new Array();
i = 0;
if (item.length > MAX_PACKAGE_BYTES){
bytesAvailable = item.length;
offset = 0;
total = Math.ceil((item.length / MAX_PACKAGE_BYTES));
i = 0;
while (i < total) {
length = bytesAvailable;
if (length > MAX_PACKAGE_BYTES){
length = MAX_PACKAGE_BYTES;
};
tmp = new ByteArray();
tmp.writeBytes(item, offset, length);
dataPackages.push({total:total, nr:(i + 1), bytes:tmp});
bytesAvailable = (bytesAvailable - length);
offset = (offset + length);
i = (i + 1);
};
} else {
dataPackages.push({total:1, nr:1, bytes:item});
};
i = 0;
while (i < dataPackages.length) {
try {
lineOut.send(LINE_OUT, "onReceivedData", dataPackages[i]);
} catch(error:Error) {
break;
};
i = (i + 1);
};
};
}
private function securityErrorHandler(_arg1:SecurityErrorEvent):void{
isConnected = false;
}
protected function monitorHandler(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Object;
if (isEnabled){
_local2 = System.totalMemory;
_local3 = new Date().time;
_local4 = (_local3 - monitorTime);
_local5 = ((monitorFrames / _local4) * 1000);
monitorFrames = 0;
monitorTime = _local3;
_local6 = {text:COMMAND_MONITOR, memory:_local2, fps:_local5, time:_local3, start:monitorStart};
if (isConnected){
send(_local6);
} else {
sendToBuffer(_local6);
};
};
}
protected function snapshotInternal(_arg1:DisplayObject, _arg2:uint=0x111111):void{
var _local3:BitmapData;
var _local4:ByteArray;
var _local5:uint;
var _local6:Object;
if (isEnabled){
_local3 = new BitmapData(_arg1.width, _arg1.height);
_local3.draw(_arg1);
_local4 = _local3.getPixels(new Rectangle(0, 0, _arg1.width, _arg1.height));
_local5 = System.totalMemory;
_local6 = {text:COMMAND_SNAPSHOT, date:new Date(), target:String(_arg1), bytes:_local4, width:_arg1.width, height:_arg1.height, color:_arg2, memory:_local5};
if (isConnected){
send(_local6);
} else {
sendToBuffer(_local6);
};
_local3.dispose();
_local4 = null;
};
}
protected function isDisplayObject(_arg1):Boolean{
return ((((_arg1 is DisplayObject)) || ((_arg1 is DisplayObjectContainer))));
}
public function onReceivedData(_arg1:ByteArray):void{
var object:*;
var method:Function;
var xml:XML;
var command:Object;
var bounds:Rectangle;
var data = _arg1;
if (isEnabled){
data.uncompress();
command = data.readObject();
switch (command["text"]){
case COMMAND_HELLO:
isConnected = true;
send({text:COMMAND_HELLO, version:VERSION});
break;
case COMMAND_HELLO_RESPONSE:
isConnected = true;
sendBuffer();
break;
case COMMAND_ROOT:
object = getObject("", 0);
if (object != null){
xml = XML(parseObject(object, "", command["functions"], 1, 2));
send({text:COMMAND_ROOT, xml:xml});
if (isDisplayObject(object)){
xml = XML(parseDisplayObject(object, "", command["functions"], 1, 2));
send({text:COMMAND_BASE, xml:xml});
};
};
break;
case COMMAND_GET_OBJECT:
object = getObject(command["target"], 0);
if (object != null){
xml = XML(parseObject(object, command["target"], command["functions"], 1, 2));
send({text:COMMAND_GET_OBJECT, xml:xml});
};
break;
case COMMAND_GET_DISPLAYOBJECT:
object = getObject(command["target"], 0);
if (object != null){
if (isDisplayObject(object)){
xml = XML(parseDisplayObject(object, command["target"], command["functions"], 1, 2));
send({text:COMMAND_GET_DISPLAYOBJECT, xml:xml});
};
};
break;
case COMMAND_GET_PROPERTIES:
object = getObject(command["target"], 0);
if (object != null){
xml = XML(parseObject(object, command["target"], false, 1, 1));
send({text:COMMAND_GET_PROPERTIES, xml:xml});
};
break;
case COMMAND_GET_FUNCTIONS:
object = getObject(command["target"], 0);
if (object != null){
xml = XML(getFunctions(object, command["target"]));
send({text:COMMAND_GET_FUNCTIONS, xml:xml});
};
break;
case COMMAND_SET_PROPERTY:
object = getObject(command["target"], 1);
if (object != null){
try {
object[command["name"]] = command["value"];
send({text:COMMAND_SET_PROPERTY, value:object[command["name"]]});
} catch(error:Error) {
send({text:COMMAND_NOTFOUND, target:command["target"]});
break;
};
};
break;
case COMMAND_CALL_METHOD:
method = getObject(command["target"], 0);
if (method != null){
if (command["returnType"] == TYPE_VOID){
method.apply(this, command["arguments"]);
} else {
object = method.apply(this, command["arguments"]);
xml = XML(parseObject(object, "", false, 1, 4));
send({text:COMMAND_CALL_METHOD, id:command["id"], xml:xml});
};
};
break;
case COMMAND_SHOW_HIGHLIGHT:
if (highlight != null){
try {
highlight.parent.removeChild(highlight);
highlight = null;
} catch(error:Error) {
};
};
object = getObject(command["target"], 0);
if (((isDisplayObject(object)) && (isDisplayObject(object["parent"])))){
bounds = object.getBounds(object["parent"]);
highlight = new Sprite();
highlight.x = 0;
highlight.y = 0;
highlight.graphics.beginFill(0, 0);
highlight.graphics.lineStyle(HIGHLIGHT_BORDER, HIGHLIGHT_COLOR);
highlight.graphics.drawRect(bounds.x, bounds.y, bounds.width, bounds.height);
highlight.graphics.endFill();
highlight.mouseChildren = false;
highlight.mouseEnabled = false;
try {
object["parent"].addChild(highlight);
} catch(error:Error) {
highlight = null;
};
};
break;
case COMMAND_HIDE_HIGHLIGHT:
if (highlight != null){
try {
highlight.parent.removeChild(highlight);
highlight = null;
} catch(error:Error) {
};
};
break;
};
};
}
protected function parseDisplayObject(_arg1, _arg2:String="", _arg3:Boolean=false, _arg4:int=1, _arg5:int=4):String{
var xml:String;
var childs:Array;
var child:DisplayObject;
var ojectName:String;
var msg:String;
var obj:Object;
var object = _arg1;
var target = _arg2;
var functions = _arg3;
var currentDepth = _arg4;
var maxDepth = _arg5;
xml = "";
var childType = "";
var childIcon = "";
var childName = "";
var childTarget = "";
var childChildren = "";
var i:int;
if ((((maxDepth == -1)) || ((currentDepth <= maxDepth)))){
if (currentDepth == 1){
xml = (xml + createNode("root"));
};
try {
if (currentDepth == 1){
ojectName = DisplayObject(object).name;
if ((((ojectName == null)) || ((ojectName == "null")))){
ojectName = "DisplayObject";
};
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + ojectName) + ")"), target:target}));
};
childs = new Array();
i = 0;
while (i < DisplayObjectContainer(object).numChildren) {
childs.push(DisplayObjectContainer(object).getChildAt(i));
i = (i + 1);
};
i = 0;
while (i < childs.length) {
child = childs[i];
childName = describeType(child).@name;
childType = parseType(childName);
childTarget = ((((target + ".") + "getChildAt(") + i) + ")");
childIcon = ((child is DisplayObjectContainer)) ? ICON_ROOT : ICON_VARIABLE;
childChildren = ((child is DisplayObjectContainer)) ? String(DisplayObjectContainer(child).numChildren) : "";
xml = (xml + createNode("node", {icon:childIcon, label:((((child.name + " (") + childType) + ") ") + childChildren), name:child.name, type:childType, value:printObject(child, childType), target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}));
try {
xml = (xml + parseDisplayObject(child, childTarget, functions, (currentDepth + 1), maxDepth));
} catch(error:Error) {
xml = (xml + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Unreadable", name:"Unreadable"}, true));
};
xml = (xml + createNode("/node"));
i = (i + 1);
};
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
} catch(error:Error) {
msg = "";
msg = (msg + createNode("root"));
msg = (msg + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Not found", name:"Not found"}, true));
msg = (msg + createNode("/root"));
obj = {text:COMMAND_NOTFOUND, target:target, xml:XML(msg)};
if (isConnected){
send(obj);
} else {
sendToBuffer(obj);
};
};
if (currentDepth == 1){
xml = (xml + createNode("/root"));
};
};
return (xml);
}
protected function parseType(_arg1:String):String{
var _local2:String = _arg1;
if (_arg1.lastIndexOf("::") != -1){
_local2 = _arg1.substring((_arg1.lastIndexOf("::") + 2), _arg1.length);
};
if (_local2.lastIndexOf(".") != -1){
_local2 = _local2.substring(0, _local2.lastIndexOf("."));
};
if (_local2 == TYPE_METHOD){
_local2 = TYPE_FUNCTION;
};
return (htmlEscape(_local2));
}
protected function parseObject(_arg1, _arg2:String="", _arg3:Boolean=false, _arg4:int=1, _arg5:int=4):String{
var xml:String;
var isXMLString:XML;
var keys:Array;
var key:*;
var properties:Array;
var prop:*;
var variables:XMLList;
var accessors:XMLList;
var constants:XMLList;
var methods:XMLList;
var variablesArr:Array;
var methodsArr:Array;
var double:Boolean;
var permission:String;
var icon:String;
var returnType:String;
var parameters:XMLList;
var args:Array;
var msg:String;
var obj:Object;
var object = _arg1;
var target = _arg2;
var functions = _arg3;
var currentDepth = _arg4;
var maxDepth = _arg5;
xml = "";
var childType = "";
var childName = "";
var childTarget = "";
var description:XML = new XML();
var type = "";
var base = "";
var isXML:Boolean;
var i:int;
var n:int;
if ((((maxDepth == -1)) || ((currentDepth <= maxDepth)))){
if (currentDepth == 1){
xml = (xml + createNode("root"));
};
try {
description = describeType(object);
type = parseType(description.@name);
base = parseType(description.@base);
if (((functions) && ((base == TYPE_FUNCTION)))){
xml = (xml + createNode("node", {icon:ICON_FUNCTION, label:"(Function)", name:"", type:TYPE_FUNCTION, value:"", target:target, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
if ((((type == TYPE_ARRAY)) || ((type == TYPE_VECTOR)))){
if (currentDepth == 1){
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + type) + ")"), target:target}));
};
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((("length" + " (") + TYPE_UINT) + ") = ") + object["length"]), name:"length", type:TYPE_UINT, value:object["length"], target:((target + ".") + "length"), access:ACCESS_VARIABLE, permission:PERMISSION_READONLY}, true));
keys = new Array();
for (key in object) {
keys.push(key);
};
keys.sort();
i = 0;
while (i < keys.length) {
childType = parseType(describeType(object[keys[i]]).@name);
childTarget = ((target + ".") + String(keys[i]));
if ((((((((((((childType == TYPE_STRING)) || ((childType == TYPE_BOOLEAN)))) || ((childType == TYPE_NUMBER)))) || ((childType == TYPE_INT)))) || ((childType == TYPE_UINT)))) || ((childType == TYPE_FUNCTION)))){
isXML = false;
isXMLString = new XML();
if (childType == TYPE_STRING){
try {
isXMLString = new XML(object[keys[i]]);
if (((!(isXMLString.hasSimpleContent())) && ((isXMLString.children().length() > 0)))){
isXML = true;
};
} catch(error:TypeError) {
};
};
try {
if (!isXML){
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:((((("[" + keys[i]) + "] (") + childType) + ") = ") + printObject(object[keys[i]], childType)), name:(("[" + keys[i]) + "]"), type:childType, value:printObject(object[keys[i]], childType), target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((("[" + keys[i]) + "] (") + childType) + ")"), name:(("[" + keys[i]) + "]"), type:childType, value:"", target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, false));
xml = (xml + parseXML(isXMLString, ((childTarget + ".") + "cildren()"), currentDepth, maxDepth));
xml = (xml + createNode("/node"));
};
} catch(error:Error) {
};
} else {
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((("[" + keys[i]) + "] (") + childType) + ")"), name:(("[" + keys[i]) + "]"), type:childType, value:"", target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}));
try {
xml = (xml + parseObject(object[keys[i]], childTarget, functions, (currentDepth + 1), maxDepth));
} catch(error:Error) {
xml = (xml + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Unreadable", name:"Unreadable"}, true));
};
xml = (xml + createNode("/node"));
};
i = (i + 1);
};
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
} else {
if (type == TYPE_OBJECT){
if (currentDepth == 1){
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + type) + ")"), target:target}));
};
properties = new Array();
for (prop in object) {
properties.push(prop);
};
properties.sort();
i = 0;
while (i < properties.length) {
childType = parseType(describeType(object[properties[i]]).@name);
childTarget = ((target + ".") + properties[i]);
if ((((((((((((childType == TYPE_STRING)) || ((childType == TYPE_BOOLEAN)))) || ((childType == TYPE_NUMBER)))) || ((childType == TYPE_INT)))) || ((childType == TYPE_UINT)))) || ((childType == TYPE_FUNCTION)))){
isXML = false;
isXMLString = new XML();
if (childType == TYPE_STRING){
try {
isXMLString = new XML(object[properties[i]]);
if (((!(isXMLString.hasSimpleContent())) && ((isXMLString.children().length() > 0)))){
isXML = true;
};
} catch(error:TypeError) {
};
};
try {
if (!isXML){
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:((((properties[i] + " (") + childType) + ") = ") + printObject(object[properties[i]], childType)), name:properties[i], type:childType, value:printObject(object[properties[i]], childType), target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((properties[i] + " (") + childType) + ")"), name:properties[i], type:childType, value:"", target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, false));
xml = (xml + parseXML(isXMLString, ((childTarget + ".") + "cildren()"), currentDepth, maxDepth));
xml = (xml + createNode("/node"));
};
} catch(error:Error) {
};
} else {
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((properties[i] + " (") + childType) + ")"), name:properties[i], type:childType, value:"", target:childTarget, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}));
try {
xml = (xml + parseObject(object[properties[i]], childTarget, functions, (currentDepth + 1), maxDepth));
} catch(error:Error) {
xml = (xml + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Unreadable", name:"Unreadable"}, true));
};
xml = (xml + createNode("/node"));
};
i = (i + 1);
};
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
} else {
if (type == TYPE_XML){
if (currentDepth == 1){
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + type) + ")"), target:target}));
};
xml = (xml + parseXML(object, ((target + ".") + "cildren()"), currentDepth, maxDepth));
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
} else {
if (type == TYPE_XMLLIST){
if (currentDepth == 1){
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + type) + ")"), target:target}));
};
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(((("length" + " (") + TYPE_UINT) + ") = ") + object.length()), name:"length", type:TYPE_UINT, value:object.length(), target:((target + ".") + "length"), access:ACCESS_VARIABLE, permission:PERMISSION_READONLY}, true));
i = 0;
while (i < object.length()) {
xml = (xml + parseXML(object[i], (((target + ".") + String(i)) + ".children()"), currentDepth, maxDepth));
i = (i + 1);
};
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
} else {
if ((((((((((type == TYPE_STRING)) || ((type == TYPE_BOOLEAN)))) || ((type == TYPE_NUMBER)))) || ((type == TYPE_INT)))) || ((type == TYPE_UINT)))){
isXML = false;
isXMLString = new XML();
if (type == TYPE_STRING){
try {
isXMLString = new XML(object);
if (((!(isXMLString.hasSimpleContent())) && ((isXMLString.children().length() > 0)))){
isXML = true;
};
} catch(error:TypeError) {
};
};
try {
if (!isXML){
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:((("(" + type) + ") = ") + printObject(object, type)), name:"", type:type, value:printObject(object, type), target:target, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, true));
} else {
xml = (xml + createNode("node", {icon:ICON_VARIABLE, label:(("(" + type) + ")"), name:"", type:type, value:"", target:target, access:ACCESS_VARIABLE, permission:PERMISSION_READWRITE}, false));
xml = (xml + parseXML(isXMLString, ((target + ".") + "cildren()"), currentDepth, maxDepth));
xml = (xml + createNode("/node"));
};
} catch(error:Error) {
};
} else {
if (currentDepth == 1){
xml = (xml + createNode("node", {icon:ICON_ROOT, label:(("(" + type) + ")"), target:target}));
};
variables = description..variable;
accessors = description..accessor;
constants = description..constant;
methods = description..method;
variablesArr = new Array();
methodsArr = new Array();
double = false;
permission = "";
icon = "";
double = false;
i = 0;
while (i < variables.length()) {
n = 0;
while (n < variablesArr.length) {
if (variablesArr[n].name == variables[i].@name){
double = true;
break;
};
n = (n + 1);
};
if (!double){
variablesArr.push({name:variables[i].@name, xml:variables[i], access:ACCESS_VARIABLE});
};
i = (i + 1);
};
double = false;
i = 0;
while (i < accessors.length()) {
n = 0;
while (n < variablesArr.length) {
if (variablesArr[n].name == accessors[i].@name){
double = true;
break;
};
n = (n + 1);
};
if (!double){
variablesArr.push({name:accessors[i].@name, xml:accessors[i], access:ACCESS_ACCESSOR});
};
i = (i + 1);
};
double = false;
i = 0;
while (i < constants.length()) {
n = 0;
while (n < variablesArr.length) {
if (variablesArr[n].name == constants[i].@name){
double = true;
break;
};
n = (n + 1);
};
if (!double){
variablesArr.push({name:constants[i].@name, xml:constants[i], access:ACCESS_CONSTANT});
};
i = (i + 1);
};
double = false;
i = 0;
while (i < methods.length()) {
n = 0;
while (n < methodsArr.length) {
if (methodsArr[n].name == methods[i].@name){
double = true;
break;
};
n = (n + 1);
};
if (!double){
methodsArr.push({name:methods[i].@name, xml:methods[i], access:ACCESS_METHOD});
};
i = (i + 1);
};
variablesArr.sortOn("name");
methodsArr.sortOn("name");
i = 0;
while (i < variablesArr.length) {
childType = parseType(variablesArr[i].xml.@type);
childName = variablesArr[i].xml.@name;
childTarget = ((target + ".") + childName);
permission = PERMISSION_READWRITE;
icon = ICON_VARIABLE;
if (variablesArr[i].access == ACCESS_CONSTANT){
permission = PERMISSION_READONLY;
icon = ICON_VARIABLE_READONLY;
};
if (variablesArr[i].xml.@access == PERMISSION_READONLY){
permission = PERMISSION_READONLY;
icon = ICON_VARIABLE_READONLY;
};
if (variablesArr[i].xml.@access == PERMISSION_WRITEONLY){
permission = PERMISSION_WRITEONLY;
icon = ICON_VARIABLE_WRITEONLY;
};
if (permission != PERMISSION_WRITEONLY){
if ((((((((((((childType == TYPE_STRING)) || ((childType == TYPE_BOOLEAN)))) || ((childType == TYPE_NUMBER)))) || ((childType == TYPE_INT)))) || ((childType == TYPE_UINT)))) || ((childType == TYPE_FUNCTION)))){
isXML = false;
isXMLString = new XML();
if (childType == TYPE_STRING){
try {
isXMLString = new XML(object[childName]);
if (((!(isXMLString.hasSimpleContent())) && ((isXMLString.children().length() > 0)))){
isXML = true;
};
} catch(error:TypeError) {
};
};
try {
if (!isXML){
xml = (xml + createNode("node", {icon:icon, label:((((childName + " (") + childType) + ") = ") + printObject(object[childName], childType)), name:childName, type:childType, value:printObject(object[childName], childType), target:childTarget, access:variablesArr[i].access, permission:permission}, true));
} else {
xml = (xml + createNode("node", {icon:icon, label:(((childName + " (") + childType) + ")"), name:childName, type:childType, value:"", target:childTarget, access:variablesArr[i].access, permission:permission}, false));
xml = (xml + parseXML(isXMLString, ((childTarget + ".") + "cildren()"), currentDepth, maxDepth));
xml = (xml + createNode("/node"));
};
} catch(error:Error) {
};
} else {
xml = (xml + createNode("node", {icon:icon, label:(((childName + " (") + childType) + ")"), name:childName, type:childType, target:childTarget, access:variablesArr[i].access, permission:permission}));
try {
xml = (xml + parseObject(object[childName], childTarget, functions, (currentDepth + 1), maxDepth));
} catch(error:Error) {
xml = (xml + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Unreadable", name:"Unreadable"}, true));
};
xml = (xml + createNode("/node"));
};
};
i = (i + 1);
};
if (functions){
i = 0;
while (i < methodsArr.length) {
childType = TYPE_FUNCTION;
childName = methodsArr[i].xml.@name;
childTarget = ((target + ".") + childName);
returnType = parseType(methodsArr[i].xml.@returnType);
parameters = methodsArr[i].xml..parameter;
args = new Array();
n = 0;
while (n < parameters.length()) {
args.push(parseType(parameters[n].@type));
n = (n + 1);
};
xml = (xml + createNode("node", {icon:ICON_FUNCTION, label:((((childName + "(") + args.join(", ")) + "):") + returnType), args:args.join(", "), name:childName, type:TYPE_FUNCTION, access:variablesArr[i].access, returnType:returnType, target:childTarget}, true));
i = (i + 1);
};
};
if (currentDepth == 1){
xml = (xml + createNode("/node"));
};
};
};
};
};
};
};
} catch(error:Error) {
msg = "";
msg = (msg + createNode("root"));
msg = (msg + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Not found", name:"Not found"}, true));
msg = (msg + createNode("/root"));
obj = {text:COMMAND_NOTFOUND, target:target, xml:XML(msg)};
if (isConnected){
send(obj);
} else {
sendToBuffer(obj);
};
};
if (currentDepth == 1){
xml = (xml + createNode("/root"));
};
};
return (xml);
}
protected function getFunctions(_arg1, _arg2:String=""):String{
var description:XML;
var type:String;
var childType:String;
var childName:String;
var childTarget:String;
var methods:XMLList;
var methodsArr:Array;
var returnType:String;
var parameters:XMLList;
var args:Array;
var argsString:String;
var optional:Boolean;
var double:Boolean;
var i:int;
var n:int;
var msg:String;
var obj:Object;
var object = _arg1;
var target = _arg2;
var xml = "";
xml = (xml + createNode("root"));
try {
description = describeType(object);
type = parseType(description.@name);
childType = "";
childName = "";
childTarget = "";
methods = description..method;
methodsArr = new Array();
optional = false;
double = false;
i = 0;
n = 0;
xml = (xml + createNode("node", {icon:ICON_DEFAULT, label:(("(" + type) + ")"), target:target}));
i = 0;
while (i < methods.length()) {
n = 0;
while (n < methodsArr.length) {
if (methodsArr[n].name == methods[i].@name){
double = true;
break;
};
n = (n + 1);
};
if (!double){
methodsArr.push({name:methods[i].@name, xml:methods[i], access:ACCESS_METHOD});
};
i = (i + 1);
};
methodsArr.sortOn("name");
i = 0;
while (i < methodsArr.length) {
childType = TYPE_FUNCTION;
childName = methodsArr[i].xml.@name;
childTarget = ((target + ".") + childName);
returnType = parseType(methodsArr[i].xml.@returnType);
parameters = methodsArr[i].xml..parameter;
args = new Array();
argsString = "";
optional = false;
n = 0;
while (n < parameters.length()) {
if ((((parameters[n].@optional == "true")) && (!(optional)))){
optional = true;
args.push("[");
};
args.push(parseType(parameters[n].@type));
n = (n + 1);
};
if (optional){
args.push("]");
};
argsString = args.join(", ");
argsString = argsString.replace("[, ", "[");
argsString = argsString.replace(", ]", "]");
xml = (xml + createNode("node", {icon:ICON_FUNCTION, label:((((childName + "(") + argsString) + "):") + returnType), args:argsString, name:childName, type:TYPE_FUNCTION, access:ACCESS_METHOD, returnType:returnType, target:childTarget}));
n = 0;
while (n < parameters.length()) {
xml = (xml + createNode("parameter", {type:parseType(parameters[n].@type), index:parameters[n].@index, optional:parameters[n].@optional}, true));
n = (n + 1);
};
xml = (xml + createNode("/node"));
i = (i + 1);
};
xml = (xml + createNode("/node"));
} catch(error:Error) {
msg = "";
msg = (msg + createNode("root"));
msg = (msg + createNode("node", {icon:ICON_WARNING, type:TYPE_WARNING, label:"Not found", name:"Not found"}, true));
msg = (msg + createNode("/root"));
obj = {text:COMMAND_NOTFOUND, target:target, xml:XML(msg)};
if (isConnected){
send(obj);
} else {
sendToBuffer(obj);
};
};
xml = (xml + createNode("/root"));
return (xml);
}
public static function get enabled():Boolean{
if (instance == null){
instance = new MonsterDebugger(null);
};
return (instance.isEnabled);
}
public static function snapshot(_arg1:DisplayObject, _arg2:uint=0x111111):void{
if (instance == null){
instance = new MonsterDebugger(null);
};
if (MonsterDebugger.enabled){
instance.snapshotInternal(_arg1, _arg2);
};
}
public static function trace(_arg1:Object, _arg2, _arg3:uint=0x111111, _arg4:Boolean=false, _arg5:int=4):void{
if (instance == null){
instance = new MonsterDebugger(_arg1);
};
if (MonsterDebugger.enabled){
instance.traceInternal(_arg1, _arg2, _arg3, _arg4, _arg5);
};
}
public static function set enabled(_arg1:Boolean):void{
if (instance == null){
instance = new MonsterDebugger(null);
};
instance.isEnabled = _arg1;
}
public static function inspect(_arg1:Object):void{
var _local2:*;
var _local3:XML;
var _local4:Object;
if (((!((instance == null))) && (!((_arg1 == null))))){
instance.root = _arg1;
_local2 = instance.getObject("", 0);
if (_local2 != null){
_local3 = XML(instance.parseObject(_local2, "", false, 1, 2));
_local4 = {text:instance.COMMAND_INSPECT, xml:_local3};
if (instance.isConnected){
instance.send(_local4);
} else {
instance.sendToBuffer(_local4);
};
if (instance.isDisplayObject(_local2)){
_local3 = XML(instance.parseDisplayObject(_local2, "", false, 1, 2));
_local4 = {text:instance.COMMAND_BASE, xml:_local3};
if (instance.isConnected){
instance.send(_local4);
} else {
instance.sendToBuffer(_local4);
};
};
};
};
}
public static function clearTraces():void{
if (instance == null){
instance = new MonsterDebugger(null);
};
if (MonsterDebugger.enabled){
instance.clearTracesInternal();
};
}
}
}//package nl.demonsters.debugger
Section 147
//BitmapParser (parser.BitmapParser)
package parser {
import flash.display.*;
import flash.utils.*;
public class BitmapParser {
private var m_height:int;
private var m_width:int;
private var m_bmdMap:BitmapData;
private var m_layersList:Array;
private var m_layers:int;
private var m_border:int;
public function BitmapParser(_arg1:BitmapData, _arg2:int, _arg3:int=0){
m_layersList = new Array();
super();
m_layers = _arg2;
m_bmdMap = _arg1.clone();
m_border = _arg3;
m_width = (m_bmdMap.width + (2 * m_border));
m_height = (int((m_bmdMap.height / m_layers)) + (2 * m_border));
parse();
m_bmdMap.dispose();
}
public function get layersList():Array{
return (m_layersList);
}
private function parse():void{
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:int;
var _local9:int;
m_layersList = new Array(m_layers);
var _local1:int;
while (_local1 < m_layers) {
m_layersList[_local1] = new Array(m_height);
_local9 = 0;
while (_local9 < m_height) {
m_layersList[_local1][_local9] = new Array(m_width);
_local9++;
};
_local1++;
};
var _local2:int = (m_layers - 1);
var _local3:ByteArray = m_bmdMap.getPixels(m_bmdMap.rect);
var _local4 = (_local3.length >> 2);
_local1 = 0;
while (_local1 < _local4) {
_local5 = (m_border + (_local1 % (m_width - (2 * m_border))));
_local6 = (m_border + int(((_local1 / (m_width - (2 * m_border))) % (m_height - (2 * m_border)))));
_local7 = _local3[((_local1 << 2) + 2)];
_local8 = _local3[((_local1 << 2) + 3)];
if (_local1 == ((_local4 * (m_layers - _local2)) / m_layers)){
_local2--;
};
m_layersList[_local2][_local6][_local5] = ((_local8 << 8) | _local7);
_local1++;
};
}
}
}//package parser
Section 148
//XMLParser (parser.XMLParser)
package parser {
import flash.geom.*;
import data.*;
import config.*;
public class XMLParser {
public static function getScore(_arg1:XML):String{
return (_arg1.total);
}
public static function getLevels(_arg1:XML, _arg2:String=""):Array{
var _local6:XML;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:XMLList;
var _local13:XML;
var _local14:LevelData;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:int;
var _local20:Rectangle;
var _local21:Array;
var _local22:XMLList;
var _local23:XML;
var _local24:int;
var _local25:int;
var _local3:Array = new Array();
var _local4:int = (_arg1.levels as XMLList).children().length();
var _local5:int;
while (_local5 < _local4) {
_local6 = (_arg1.levels as XMLList).children()[_local5];
_local7 = parseInt(_local6.id);
_local8 = parseInt(_local6.time);
_local9 = parseInt(_local6.min_time);
_local10 = ((_local6.type)=="bonus") ? LevelData.MISSION_TYPE_BONUS : LevelData.MISSION_TYPE_NORMAL;
_local11 = new Array();
_local12 = _local6.secrets.elements("secret");
for each (_local13 in _local12) {
_local15 = parseInt(_local13.@id);
_local16 = (parseInt(_local13.@x) + Config.LEVEL_BORDER);
_local17 = (parseInt(_local13.@y) + Config.LEVEL_BORDER);
_local18 = parseInt(_local13.@width);
_local19 = parseInt(_local13.@height);
_local20 = new Rectangle(_local16, _local17, _local18, _local19);
_local21 = new Array();
_local22 = _local13.elements("entrance");
for each (_local23 in _local22) {
_local24 = (parseInt(_local23.@x) + Config.LEVEL_BORDER);
_local25 = (parseInt(_local23.@y) + Config.LEVEL_BORDER);
_local21.push(new Point(_local24, _local25));
};
_local11.push(new SecretData(_local15, _local20, _local21));
};
_local14 = new LevelData(_arg2, _local7, _local10, _local8, _local9, _local6.map, _local6.tileset, _local6.background, _local11);
_local3.push(_local14);
_local5++;
};
_local3.sortOn("id");
return (_local3);
}
public static function getHints(_arg1:XML):Array{
var _local4:XML;
var _local5:HintData;
var _local2:Array = new Array();
var _local3:XMLList = _arg1.hints.elements("hint");
for each (_local4 in _local3) {
_local5 = new HintData(parseInt(_local4.@id), _local4.@name, _local4.copy);
_local2[_local5.id] = _local5;
};
return (_local2);
}
}
}//package parser
Section 149
//CharacterSelection (screens.CharacterSelection)
package screens {
import flash.display.*;
import flash.events.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
import flash.ui.*;
public class CharacterSelection extends MovieClip {
private var m_isKeyLeftReleased:Boolean;
public var m_girl:CharacterPanel;
private var m_isKeyRightReleased:Boolean;
private var m_selectedPanel:CharacterPanel;
public var m_boy:CharacterPanel;
public static const EVENT_SELECT_CHARACTER:String = "onSelectCharacter";
public function CharacterSelection(){
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("in_end", onFrameInEnd);
m_isKeyLeftReleased = true;
m_isKeyRightReleased = true;
}
private function onRollOverBoy(_arg1:Event):void{
m_girl.deselect();
m_boy.select();
m_selectedPanel = m_boy;
}
private function onFrameInEnd():void{
stop();
EventManager.addEventListener(m_girl, CharacterPanel.EVENT_DISABLE, onDisablePanels);
EventManager.addEventListener(m_girl, CharacterPanel.EVENT_SELECT, onSelectGirl);
EventManager.addEventListener(m_girl, CharacterPanel.EVENT_ROLL_OVER, onRollOverGirl);
EventManager.addEventListener(m_boy, CharacterPanel.EVENT_DISABLE, onDisablePanels);
EventManager.addEventListener(m_boy, CharacterPanel.EVENT_SELECT, onSelectBoy);
EventManager.addEventListener(m_boy, CharacterPanel.EVENT_ROLL_OVER, onRollOverBoy);
m_girl.select();
m_boy.deselect();
m_selectedPanel = m_girl;
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandler);
EventManager.addEventListener(stage, KeyboardEvent.KEY_UP, onKeyUpHandler);
stage.focus = stage;
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.LEFT:
if (m_isKeyLeftReleased){
m_isKeyLeftReleased = false;
changeCharacter();
};
break;
case Keyboard.RIGHT:
if (m_isKeyRightReleased){
m_isKeyRightReleased = false;
changeCharacter();
};
break;
case Keyboard.SPACE:
m_selectedPanel.onSelectClick(null);
break;
};
}
private function onSelectBoy(_arg1:Event):void{
Main.trackEvent(Config.MEME_CHAR_BOY);
EventManager.removeAllListeners(m_girl);
EventManager.removeAllListeners(m_boy);
dispatchEvent(new ObjectEvent(EVENT_SELECT_CHARACTER, {boy:true}));
}
private function onKeyUpHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.LEFT:
m_isKeyLeftReleased = true;
break;
case Keyboard.RIGHT:
m_isKeyRightReleased = true;
break;
};
}
private function onDisablePanels(_arg1:Event):void{
m_boy.disable();
m_girl.disable();
EventManager.removeEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandler);
EventManager.removeEventListener(stage, KeyboardEvent.KEY_UP, onKeyUpHandler);
}
private function changeCharacter():void{
if (m_selectedPanel == m_girl){
onRollOverBoy(null);
} else {
onRollOverGirl(null);
};
}
private function onRollOverGirl(_arg1:Event):void{
m_girl.select();
m_boy.deselect();
m_selectedPanel = m_girl;
}
private function onSelectGirl(_arg1:Event):void{
Main.trackEvent(Config.MEME_CHAR_GIRL);
EventManager.removeAllListeners(m_girl);
EventManager.removeAllListeners(m_boy);
dispatchEvent(new ObjectEvent(EVENT_SELECT_CHARACTER, {boy:false}));
}
}
}//package screens
Section 150
//Front (screens.Front)
package screens {
import flash.display.*;
public class Front extends MovieClip {
public var m_mcMask:MovieClip;
public var m_content:FrontContent;
public function Front(_arg1:Boolean){
if (_arg1){
m_content.mask = m_mcMask;
} else {
m_mcMask.visible = false;
m_mcMask.stop();
m_content.gotoAndPlay("goals");
};
}
}
}//package screens
Section 151
//FrontContent (screens.FrontContent)
package screens {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import events.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
import flash.ui.*;
public class FrontContent extends MovieClip {
public var m_btnRightCTA:MovieClip;
public var m_btnPlayMonday:StandardButton;
public var m_btnInstructions:SimpleButton;
public var m_btnLogo:MovieClip;
public var m_btnLeftCTA:MovieClip;
public var m_btnPlay:StandardButton;
public var m_characterSelection:CharacterSelection;
public var m_instructions:Instructions;
public static const EVENT_CLICK_PLAY:String = "onClickPlay";
public static const EVENT_CLICK_INSTRUCTIONS:String = "onClickInstructions";
public function FrontContent(){
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("splash_end", onFrameSplashEnd);
_local1.setFrameScript("select", onFrameSelect);
_local1.setFrameScript("intro", onFrameIntro);
_local1.setFrameScript("intro_end", onFrameIntroEnd);
_local1.setFrameScript("init", onFrameInit);
_local1.setFrameScript("end", onFrameEnd);
_local1.setFrameScript("instructions_end", onFrameInstructionsEnd);
_local1.setFrameScript("instr_to_char_end", onFrameInstrToCharEnd);
_local1.setFrameScript("front_to_char_end", onFrameFrontToCharEnd);
}
private function onClickPlaySplash(_arg1:MouseEvent):void{
m_btnPlay.removeEventListener(MouseEvent.CLICK, onClickPlaySplash);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandlerSplash);
gotoAndPlay("splash_out");
}
private function onFrameSplashEnd():void{
stop();
m_btnPlay.enable();
m_btnPlay.addEventListener(MouseEvent.CLICK, onClickPlaySplash);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandlerSplash);
m_btnLogo.buttonMode = true;
m_btnLogo.addEventListener(MouseEvent.CLICK, onClickLogo);
m_btnLeftCTA.buttonMode = true;
m_btnLeftCTA.addEventListener(MouseEvent.CLICK, onClickLogo);
m_btnRightCTA.buttonMode = true;
m_btnRightCTA.addEventListener(MouseEvent.CLICK, onClickLogo);
stage.focus = stage;
}
private function onFrameInstructionsEnd():void{
stop();
}
private function onClickPlay(_arg1:MouseEvent):void{
removeEvents();
m_btnInstructions.mouseEnabled = false;
if (m_instructions){
gotoAndPlay("instr_to_char");
} else {
gotoAndPlay("front_to_char");
};
}
private function onClickInstructions(_arg1:MouseEvent):void{
m_btnInstructions.removeEventListener(MouseEvent.CLICK, onClickInstructions);
m_btnInstructions.mouseEnabled = false;
gotoAndPlay("instructions");
}
private function removeEvents():void{
m_btnPlay.removeEventListener(MouseEvent.CLICK, onClickPlay);
m_btnInstructions.removeEventListener(MouseEvent.CLICK, onClickInstructions);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
}
private function onFrameInstrToCharEnd():void{
stop();
EventManager.addEventListener(m_characterSelection, CharacterSelection.EVENT_SELECT_CHARACTER, onSelectCharacter);
}
private function onFrameInit():void{
}
private function onFrameEnd():void{
stop();
m_btnPlay.enable();
m_btnPlay.addEventListener(MouseEvent.CLICK, onClickPlay);
m_btnInstructions.addEventListener(MouseEvent.CLICK, onClickInstructions);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
stage.focus = stage;
}
private function onSelectCharacter(_arg1:ObjectEvent):void{
dispatchEvent(new ObjectEvent(EVENT_CLICK_PLAY, {boy:_arg1.object.boy}));
}
private function onKeyDownHandlerIntro(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.SPACE){
onClickPlayMonday(null);
};
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.SPACE){
onClickPlay(null);
};
}
private function onClickPlayMonday(_arg1:MouseEvent):void{
m_btnPlayMonday.removeEventListener(MouseEvent.CLICK, onClickPlayMonday);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandlerIntro);
gotoAndPlay("goals");
}
private function onKeyDownHandlerSplash(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.SPACE){
onClickPlaySplash(null);
};
}
private function onClickLogo(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://toystorymission.co.uk"), "_blank");
Main.trackClick(Config.MEME_CLICK_TOYSTORY);
}
private function onFrameFrontToCharEnd():void{
stop();
EventManager.addEventListener(m_characterSelection, CharacterSelection.EVENT_SELECT_CHARACTER, onSelectCharacter);
}
private function onFrameSelect():void{
if (Main.getInstance().isMarbleMonday){
gotoAndPlay("intro");
} else {
gotoAndPlay("init");
};
}
private function onFrameIntroEnd():void{
stop();
m_btnPlayMonday.enable();
m_btnPlayMonday.addEventListener(MouseEvent.CLICK, onClickPlayMonday);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandlerIntro);
stage.focus = stage;
}
private function onFrameIntro():void{
}
}
}//package screens
Section 152
//GameOverFailed (screens.GameOverFailed)
package screens {
import flash.display.*;
import data.*;
public class GameOverFailed extends MovieClip {
public var m_mcMask:MovieClip;
public var m_content:GameOverFailedContent;
public function GameOverFailed(_arg1:BitmapData){
m_content.mask = m_mcMask;
var _local2:Bitmap = new Bitmap(_arg1);
addChildAt(_local2, 0);
}
public function init(_arg1:SummaryData):void{
m_content.init(_arg1);
}
}
}//package screens
Section 153
//GameOverFailedContent (screens.GameOverFailedContent)
package screens {
import fl.video.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import data.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
public class GameOverFailedContent extends MovieClip {
public var m_player:FLVPlayback;
public var m_btnRegister:StandardButton;
public var m_summary:Summary;
public var m_endScreen:MovieClip;
public var __setPropDict:Dictionary;
private var m_summaryData:SummaryData;
public var m_btnGoToSite:StandardButton;
public var m_btnRetry:StandardButton;
public static const EVENT_CLICK_RETRY:String = "onClickRetry";
public function GameOverFailedContent(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60);
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("FLV", onFrameFLV);
_local1.setFrameScript("summary", onFrameSummary);
_local1.setFrameScript("canned_end", onFrameCannedEnd);
}
private function onFrameFLV():void{
stop();
m_player.addEventListener(VideoEvent.COMPLETE, onVideoComplete);
m_player.play("http://wdmpi-0.vo.llnwd.net/d1/marbleousMissions/Potato_Pieces.flv");
}
private function onKeyDownHandlerCanned(_arg1:KeyboardEvent):void{
onClickRetryCanned(null);
}
function frame50(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame51(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function __setProp_m_player_FailContent_FLV_49(){
try {
m_player["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_player.align = "center";
m_player.autoPlay = true;
m_player.isLive = false;
m_player.scaleMode = "maintainAspectRatio";
m_player.skin = "";
m_player.skinAutoHide = false;
m_player.skinBackgroundAlpha = 0.7;
m_player.skinBackgroundColor = 4150627;
m_player.source = "";
m_player.volume = 1;
try {
m_player["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame54(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame56(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame57(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
public function init(_arg1:SummaryData):void{
m_summaryData = _arg1;
}
function frame52(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame53(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame58(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame59(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
private function onClickRetryCanned(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_btnRetry, MouseEvent.CLICK, onClickRetryCanned);
EventManager.removeEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.removeEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
dispatchEvent(new Event(EVENT_CLICK_RETRY));
}
function frame55(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
function frame60(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 60))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_FailContent_FLV_49();
};
}
private function onFrameCannedEnd():void{
stop();
m_btnRetry.enable();
m_endScreen.btnVisit.enable();
EventManager.addEventListener(m_btnRetry, MouseEvent.CLICK, onClickRetryCanned);
EventManager.addEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
}
private function onClickGoToSite(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://toystorymission.co.uk"), "_blank");
Main.trackClick(Config.MEME_CLICK_TOYSTORY);
}
private function onVideoComplete(_arg1:VideoEvent):void{
gotoAndPlay("text");
}
private function onFrameSummary():void{
m_summary.init(m_summaryData);
}
}
}//package screens
Section 154
//GameOverSuccess (screens.GameOverSuccess)
package screens {
import flash.display.*;
import data.*;
public class GameOverSuccess extends MovieClip {
public var m_mcMask:MovieClip;
public var m_content:GameOverSuccessContent;
public function GameOverSuccess(_arg1:BitmapData){
m_content.mask = m_mcMask;
var _local2:Bitmap = new Bitmap(_arg1);
addChildAt(_local2, 0);
}
public function init(_arg1:SummaryData):void{
m_content.init(_arg1);
}
public function setSendingParams(_arg1:String):void{
m_content.setSendingParams(_arg1);
}
}
}//package screens
Section 155
//GameOverSuccessContent (screens.GameOverSuccessContent)
package screens {
import fl.video.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import data.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
public class GameOverSuccessContent extends MovieClip {
public var m_btnGoToSite:StandardButton;
public var m_btnPlayAgain:StandardButton;
public var m_btnRegister:StandardButton;
public var __setPropDict:Dictionary;
public var m_btnHighScores:StandardButton;
private var m_params:String;
private var m_summaryData:SummaryData;
private var m_submitPopup:SubmitPopup;
public var m_summary:Summary;
public var m_endScreen:MovieClip;
public var m_player:FLVPlayback;
public static const EVENT_CLICK_PLAY_AGAIN:String = "onClickRetry";
public function GameOverSuccessContent(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60, 60, frame61, 61, frame62, 62, frame63, 63, frame64, 64, frame65, 65, frame66, 66, frame67, 67, frame68, 68, frame69, 69, frame70, 70, frame71, 71, frame72, 72, frame73, 73, frame74, 74, frame75, 75, frame76, 76, frame77, 77, frame78, 78, frame79, 79, frame80, 80, frame81, 81, frame82, 82, frame83, 83, frame84, 84, frame85, 85, frame86, 86, frame87, 87, frame88, 88, frame89, 89, frame90, 90, frame91, 91, frame92, 92, frame93, 93, frame94, 94, frame95, 95, frame96, 96, frame97, 97, frame98, 98, frame99, 99, frame100, 100, frame101, 101, frame102, 102, frame103, 103, frame104, 104, frame105, 105, frame106, 106, frame107, 107, frame108, 108, frame109, 109, frame110, 110, frame111, 111, frame112, 112, frame113, 113, frame114, 114, frame115, 115, frame116, 116, frame117, 117, frame118, 118, frame119, 119, frame120, 120, frame121, 121, frame122, 122, frame123, 123, frame124, 124, frame125, 125, frame126, 126, frame127, 127, frame128, 128, frame129, 129, frame130, 130, frame131, 131, frame132, 132, frame133, 133, frame134, 134, frame135, 135, frame136, 136, frame137, 137, frame138, 138, frame139, 139, frame140, 140, frame141, 141, frame142, 142, frame143, 143, frame144);
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("FLV", onFrameFLV);
_local1.setFrameScript("summary", onFrameSummary);
_local1.setFrameScript("canned_end", onFrameCannedEnd);
}
private function onKeyDownHandlerCanned(_arg1:KeyboardEvent):void{
onClickPlayAgainCanned(null);
}
function frame70(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame71(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame72(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame73(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame74(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame75(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame76(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame77(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame78(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame79(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
public function init(_arg1:SummaryData):void{
m_summaryData = _arg1;
}
function frame80(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame81(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame82(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame84(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame85(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame86(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame87(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame88(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame89(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame83(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
private function onVideoComplete(_arg1:VideoEvent):void{
gotoAndPlay("text");
}
public function setSendingParams(_arg1:String):void{
m_params = _arg1;
}
private function onClickPlayAgainCanned(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_btnPlayAgain, MouseEvent.CLICK, onClickPlayAgainCanned);
EventManager.removeEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.removeEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
dispatchEvent(new Event(EVENT_CLICK_PLAY_AGAIN));
}
function frame91(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame92(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame93(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame94(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame95(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame96(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame98(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame97(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame90(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame99(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame100(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame101(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame102(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame103(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame104(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame105(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame106(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame107(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame108(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame109(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
private function onClickGoToSite(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://toystorymission.co.uk"), "_blank");
Main.trackClick(Config.MEME_CLICK_TOYSTORY);
}
function __setProp_m_player_GameSuccessContent_FLV_49(){
try {
m_player["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_player.align = "center";
m_player.autoPlay = true;
m_player.isLive = false;
m_player.scaleMode = "maintainAspectRatio";
m_player.skin = "";
m_player.skinAutoHide = false;
m_player.skinBackgroundAlpha = 0.7;
m_player.skinBackgroundColor = 4150627;
m_player.source = "";
m_player.volume = 1;
try {
m_player["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame110(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame111(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame112(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame113(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame114(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame115(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame116(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame117(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame118(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame119(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame121(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame122(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame123(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame124(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame125(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame120(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame129(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame126(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
private function onFrameCannedEnd():void{
stop();
m_btnPlayAgain.enable();
m_endScreen.btnVisit.enable();
EventManager.addEventListener(m_btnPlayAgain, MouseEvent.CLICK, onClickPlayAgainCanned);
EventManager.addEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
}
function frame128(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame127(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame130(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
private function onFrameFLV():void{
stop();
m_player.addEventListener(VideoEvent.COMPLETE, onVideoComplete);
m_player.play("http://wdmpi-0.vo.llnwd.net/d1/marbleousMissions/Buzz_Bounce.flv");
}
function frame132(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame133(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame134(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame135(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame136(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame50(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame51(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame52(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame53(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame54(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame55(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame56(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame57(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame58(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame59(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame137(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame138(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame139(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame131(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame140(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame141(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame142(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame143(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame144(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame60(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame61(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame62(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame63(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame64(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame65(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame66(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame67(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame68(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
function frame69(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 144))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_GameSuccessContent_FLV_49();
};
}
private function onFrameSummary():void{
m_summary.init(m_summaryData);
}
}
}//package screens
Section 156
//Instructions (screens.Instructions)
package screens {
import flash.display.*;
import flash.events.*;
import com.gskinner.utils.*;
import utils.*;
public class Instructions extends MovieClip {
private var m_btnNext:StandardButton;
public var m_nextButton:MovieClip;
public var m_content:InstructionsContent;
public var m_prevButton:MovieClip;
private var m_btnPrev:StandardButton;
public function Instructions(){
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("init", onFrameInit);
m_btnPrev = m_prevButton.m_btnPrev;
m_btnNext = m_nextButton.m_btnNext;
EventManager.addEventListener(m_btnPrev, MouseEvent.CLICK, onClickPrev);
EventManager.addEventListener(m_btnNext, MouseEvent.CLICK, onClickNext);
m_prevButton.gotoAndStop(1);
m_nextButton.gotoAndPlay("in");
}
private function onClickNext(_arg1:MouseEvent):void{
m_btnNext.disable();
m_nextButton.gotoAndPlay("out");
m_btnPrev.enable();
m_prevButton.gotoAndPlay("in");
m_content.nextPage();
}
private function onClickPrev(_arg1:MouseEvent):void{
m_btnNext.enable();
m_nextButton.gotoAndPlay("in");
m_btnPrev.disable();
m_prevButton.gotoAndPlay("out");
m_content.prevPage();
}
private function onFrameInit():void{
stop();
m_btnNext.enable();
}
}
}//package screens
Section 157
//InstructionsContent (screens.InstructionsContent)
package screens {
import flash.display.*;
import flash.events.*;
import com.gskinner.utils.*;
import utils.*;
public class InstructionsContent extends MovieClip {
public var m_mcInstr1:MovieClip;
public var m_mcInstr2:MovieClip;
public var m_mcInstr3:MovieClip;
public var m_btnOver1:SimpleButton;
public var m_btnOver2:SimpleButton;
public var m_btnOver3:SimpleButton;
public function InstructionsContent(){
stop();
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("page1", onFramePage);
_local1.setFrameScript("page2", onFramePage);
}
private function onRollOut2(_arg1:MouseEvent):void{
m_mcInstr2.gotoAndStop("off");
}
private function onRollOver1(_arg1:MouseEvent):void{
m_mcInstr1.gotoAndStop("on");
}
private function onRollOver3(_arg1:MouseEvent):void{
m_mcInstr3.gotoAndStop("on");
}
private function onRollOver2(_arg1:MouseEvent):void{
m_mcInstr2.gotoAndStop("on");
}
public function prevPage():void{
gotoAndStop("page1");
}
private function onRollOut3(_arg1:MouseEvent):void{
m_mcInstr3.gotoAndStop("off");
}
public function nextPage():void{
gotoAndStop("page2");
}
private function onFramePage():void{
m_mcInstr1.gotoAndStop("off");
m_mcInstr2.gotoAndStop("off");
m_mcInstr3.gotoAndStop("off");
EventManager.addEventListener(m_btnOver1, MouseEvent.ROLL_OVER, onRollOver1);
EventManager.addEventListener(m_btnOver1, MouseEvent.ROLL_OUT, onRollOut1);
EventManager.addEventListener(m_btnOver2, MouseEvent.ROLL_OVER, onRollOver2);
EventManager.addEventListener(m_btnOver2, MouseEvent.ROLL_OUT, onRollOut2);
EventManager.addEventListener(m_btnOver3, MouseEvent.ROLL_OVER, onRollOver3);
EventManager.addEventListener(m_btnOver3, MouseEvent.ROLL_OUT, onRollOut3);
}
private function onRollOut1(_arg1:MouseEvent):void{
m_mcInstr1.gotoAndStop("off");
}
}
}//package screens
Section 158
//InstructionsInGame (screens.InstructionsInGame)
package screens {
import flash.display.*;
import flash.events.*;
import utils.*;
public class InstructionsInGame extends MovieClip {
public var m_btnClose:StandardButton;
public var m_instructions:Instructions;
public static const EVENT_CLOSE:String = "onCloseInstructions";
public function InstructionsInGame(){
m_btnClose.enable();
EventManager.addEventListener(m_btnClose, MouseEvent.CLICK, onCloseClick);
}
private function onCloseClick(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_btnClose, MouseEvent.CLICK, onCloseClick);
dispatchEvent(new Event(EVENT_CLOSE));
}
}
}//package screens
Section 159
//LevelSummary (screens.LevelSummary)
package screens {
import flash.display.*;
import data.*;
public class LevelSummary extends MovieClip {
public var m_mcMask:MovieClip;
public var m_content:LevelSummaryContent;
public function LevelSummary(_arg1:BitmapData){
m_content.mask = m_mcMask;
var _local2:Bitmap = new Bitmap(_arg1);
addChildAt(_local2, 0);
}
public function init(_arg1:SummaryData, _arg2:Boolean):void{
m_content.init(_arg1, _arg2);
}
}
}//package screens
Section 160
//LevelSummaryContent (screens.LevelSummaryContent)
package screens {
import fl.video.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import data.*;
import com.gskinner.utils.*;
import config.*;
import utils.*;
public class LevelSummaryContent extends MovieClip {
public var m_summary:Summary;
public var m_endScreen:MovieClip;
private var m_isBonusNext:Boolean;
public var __setPropDict:Dictionary;
private var m_summaryData:SummaryData;
public var m_btnNextLevel:StandardButton;
public var m_player:FLVPlayback;
public static const EVENT_CLICK_NEXT_LEVEL:String = "onClickNextLevel";
public function LevelSummaryContent(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60, 60, frame61, 61, frame62, 62, frame63);
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("FLV", onFrameFLV);
_local1.setFrameScript("summary", onFrameSummary);
_local1.setFrameScript("canned", onFrameCanned);
_local1.setFrameScript("canned_end", onFrameCannedEnd);
}
private function onFrameFLV():void{
stop();
m_player.addEventListener(VideoEvent.COMPLETE, onVideoComplete);
m_player.play("http://wdmpi-0.vo.llnwd.net/d1/marbleousMissions/Buzz_Bounce.flv");
}
private function onClickNextLevelCanned(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_btnNextLevel, MouseEvent.CLICK, onClickNextLevelCanned);
EventManager.removeEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.removeEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
dispatchEvent(new Event(EVENT_CLICK_NEXT_LEVEL));
}
function frame50(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame51(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame52(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
private function onKeyDownHandlerCanned(_arg1:KeyboardEvent):void{
onClickNextLevelCanned(null);
}
function frame55(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame57(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
public function init(_arg1:SummaryData, _arg2:Boolean):void{
m_summaryData = _arg1;
m_isBonusNext = _arg2;
}
function frame59(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame53(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame54(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame58(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame56(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
function frame62(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
private function onFrameCanned():void{
if (m_isBonusNext){
m_btnNextLevel.setLabel("BONUS LEVEL");
};
}
function __setProp_m_player_LevelSummaryContent_FLV_49(){
try {
m_player["componentInspectorSetting"] = true;
} catch(e:Error) {
};
m_player.align = "center";
m_player.autoPlay = true;
m_player.isLive = false;
m_player.scaleMode = "maintainAspectRatio";
m_player.skin = "";
m_player.skinAutoHide = false;
m_player.skinBackgroundAlpha = 0.7;
m_player.skinBackgroundColor = 4150627;
m_player.source = "";
m_player.volume = 1;
try {
m_player["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame61(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
private function onFrameCannedEnd():void{
stop();
m_btnNextLevel.enable();
m_endScreen.btnVisit.enable();
EventManager.addEventListener(m_btnNextLevel, MouseEvent.CLICK, onClickNextLevelCanned);
EventManager.addEventListener(m_endScreen.btnVisit, MouseEvent.CLICK, onClickGoToSite);
EventManager.addEventListener(stage, KeyboardEvent.KEY_DOWN, onKeyDownHandlerCanned);
}
function frame63(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
private function onClickGoToSite(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://toystorymission.co.uk"), "_blank");
Main.trackClick(Config.MEME_CLICK_TOYSTORY);
}
private function onVideoComplete(_arg1:VideoEvent):void{
gotoAndPlay("text");
}
private function onFrameSummary():void{
m_summary.init(m_summaryData);
}
function frame60(){
if ((((__setPropDict[m_player] == undefined)) || (!((((int(__setPropDict[m_player]) >= 50)) && ((int(__setPropDict[m_player]) <= 63))))))){
__setPropDict[m_player] = currentFrame;
__setProp_m_player_LevelSummaryContent_FLV_49();
};
}
}
}//package screens
Section 161
//SubmitPopup (screens.SubmitPopup)
package screens {
import flash.display.*;
import flash.events.*;
import com.gskinner.utils.*;
import utils.*;
public class SubmitPopup extends MovieClip {
public var m_content:SubmitPopupContent;
private var m_params:String;
public function SubmitPopup(_arg1:String){
addFrameScript(41, frame42);
m_params = _arg1;
var _local2:FrameScriptManager = new FrameScriptManager(this);
_local2.setFrameScript("in_end", onFrameInEnd);
}
private function onContentEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
function frame42(){
stop();
}
private function onFrameInEnd():void{
stop();
m_content.init(m_params);
EventManager.addEventListener(m_content, SubmitPopupContent.EVENT_CLOSE, onContentEvent);
EventManager.addEventListener(m_content, SubmitPopupContent.EVENT_CLICK_PLAY_AGAIN, onContentEvent);
}
}
}//package screens
Section 162
//SubmitPopupContent (screens.SubmitPopupContent)
package screens {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import com.gskinner.utils.*;
import utils.*;
public class SubmitPopupContent extends MovieClip {
public var m_btnPlayAgain:StandardButton;
public var m_btnSubmit:StandardButton;
public var m_btnClose:StandardButton;
private var m_params:String;
public static const EVENT_CLICK_PLAY_AGAIN:String = "onClickPlayAgain";
public static const EVENT_CLOSE:String = "onCloseSubmit";
public function SubmitPopupContent(){
addFrameScript(0, frame1);
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("sending", onFrameSending);
_local1.setFrameScript("confirm", onFrameConfirm);
m_btnSubmit.enable();
EventManager.addEventListener(m_btnSubmit, MouseEvent.CLICK, onSubmitClick);
m_btnPlayAgain.enable();
EventManager.addEventListener(m_btnPlayAgain, MouseEvent.CLICK, onPlayAgainClick);
m_btnClose.enable();
EventManager.addEventListener(m_btnClose, MouseEvent.CLICK, onCloseClick);
}
function frame1(){
stop();
}
private function sendScore():void{
var _local1:URLRequest = new URLRequest(((Main.getInstance().basePath + "flash/postuserstats") + m_params));
var _local2:URLLoader = new URLLoader(_local1);
_local2.addEventListener(Event.COMPLETE, onSubmitScore);
}
private function onFrameSending():void{
}
private function onCloseClick(_arg1:MouseEvent):void{
dispatchEvent(new Event(EVENT_CLOSE));
}
private function onSubmitClick(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_btnSubmit, MouseEvent.CLICK, onSubmitClick);
gotoAndStop("sending");
sendScore();
}
private function onFrameConfirm():void{
m_btnClose.enable();
}
public function init(_arg1:String):void{
m_params = _arg1;
}
private function onPlayAgainClick(_arg1:MouseEvent):void{
dispatchEvent(new Event(EVENT_CLICK_PLAY_AGAIN));
}
private function onSubmitScore(_arg1:Event):void{
var _local2:URLLoader = (_arg1.target as URLLoader);
}
}
}//package screens
Section 163
//Summary (screens.Summary)
package screens {
import flash.display.*;
import data.*;
import utils.*;
import flash.text.*;
public class Summary extends MovieClip {
public var m_tfPercent:TextField;
public var m_tfRare:TextField;
public var m_tfPoints:TextField;
public var m_tfTimeBonus:TextField;
public var m_tfTime:TextField;
public var m_tfMarbz:TextField;
public var m_tfSecrets:TextField;
public function init(_arg1:SummaryData):void{
var _local2:int = int((_arg1.time / 60));
var _local3:int = (_arg1.time % 60);
m_tfPercent.text = (_arg1.percent + "%");
m_tfTime.text = ((((_local2)<10) ? ("0" + _local2) : _local2 + ":") + ((_local3)<10) ? ("0" + _local3) : _local3);
m_tfTimeBonus.text = ((_arg1.timeBonus)==0) ? "n/a" : StringHelper.formatScore(_arg1.timeBonus);
m_tfMarbz.text = (_arg1.marbz + "");
m_tfRare.text = (_arg1.rare + "/2");
m_tfSecrets.text = (_arg1.secrets + "/3");
m_tfPoints.text = StringHelper.formatScore(_arg1.points);
}
}
}//package screens
Section 164
//SoundInstance (sound.SoundInstance)
package sound {
import flash.events.*;
import flash.media.*;
import caurina.transitions.*;
public class SoundInstance {
private var m_channel:SoundChannel;
private var m_isPlaying:Boolean;// = false
private var m_soundRef:Sound;
private var m_name:String;
private var m_volumeScale:Number;// = 1
public function SoundInstance(_arg1:String, _arg2:Sound){
m_soundRef = _arg2;
m_name = _arg1;
m_isPlaying = false;
}
public function get volume():Number{
return ((m_channel.soundTransform.volume / m_volumeScale));
}
public function get channel():SoundChannel{
return (m_channel);
}
public function get playing():Boolean{
return (m_isPlaying);
}
private function onSoundComplete(_arg1:Event):void{
m_channel.removeEventListener(Event.SOUND_COMPLETE, onSoundComplete);
m_isPlaying = false;
}
public function get soundRef():Sound{
return (m_soundRef);
}
public function get name():String{
return (m_name);
}
public function setVolumeScale(_arg1:Number):void{
if (m_channel){
m_volumeScale = _arg1;
volume = 1;
} else {
m_volumeScale = _arg1;
};
}
public function stop():void{
if (m_isPlaying){
m_channel.stop();
m_isPlaying = false;
};
}
public function play(_arg1:Number, _arg2:int, _arg3:SoundTransform):void{
m_channel = m_soundRef.play(_arg1, _arg2, _arg3);
volume = 1;
m_channel.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
m_isPlaying = true;
}
public function volumeTo(_arg1:Number, _arg2:Number=0.5, _arg3:Boolean=false):void{
if (_arg3){
Tweener.addTween(this, {volume:_arg1, time:_arg2, transition:"easeOutSine", onComplete:stop});
} else {
Tweener.addTween(this, {volume:_arg1, time:_arg2, transition:"easeOutSine"});
};
}
public function set volume(_arg1:Number):void{
var _local2:SoundTransform;
if (m_channel){
_local2 = m_channel.soundTransform;
_local2.volume = (_arg1 * m_volumeScale);
m_channel.soundTransform = _local2;
};
}
}
}//package sound
Section 165
//SoundManager (sound.SoundManager)
package sound {
import flash.utils.*;
import flash.media.*;
public class SoundManager {
private var m_musicsList:Array;
private var m_musicVolume:Number;// = 1
private var m_soundsList:Array;
private var m_mute:Boolean;// = false
private var m_ambientsList:Array;
private var m_soundVolume:Number;// = 1
private static var s_instance:SoundManager;
public function SoundManager(){
if (s_instance){
throw (new Error("Only one singleton instance should be instanciated."));
};
m_soundsList = new Array();
m_ambientsList = new Array();
m_musicsList = new Array();
}
public function addMusic(_arg1:String, _arg2:Sound=null):void{
var _local4:Class;
if (_arg2 == null){
_local4 = (getDefinitionByName(_arg1) as Class);
_arg2 = (new (_local4) as Sound);
};
var _local3:SoundInstance = new SoundInstance(_arg1, _arg2);
m_musicsList.push(_local3);
}
public function get soundVolume():Number{
return (m_soundVolume);
}
public function playAmbient(_arg1:String, _arg2:SoundTransform):void{
var _local3:int;
while (_local3 < m_ambientsList.length) {
if (m_ambientsList[_local3].name == _arg1){
m_ambientsList[_local3].play(0, 99999, _arg2);
};
_local3++;
};
}
public function playMusic(_arg1:String, _arg2:int=1, _arg3:SoundTransform=null):void{
var _local4:int;
while (_local4 < m_musicsList.length) {
if (m_musicsList[_local4].name == _arg1){
m_musicsList[_local4].play(0, _arg2, _arg3);
};
_local4++;
};
}
public function set musicVolume(_arg1:Number):void{
var _local2:SoundInstance;
m_musicVolume = _arg1;
for each (_local2 in m_musicsList) {
_local2.setVolumeScale(m_musicVolume);
};
}
public function getSound(_arg1:String):SoundInstance{
var _local2:int;
while (_local2 < m_soundsList.length) {
if (m_soundsList[_local2].name == _arg1){
return (m_soundsList[_local2]);
};
_local2++;
};
return (null);
}
public function get musicVolume():Number{
return (m_musicVolume);
}
public function get mute():Boolean{
return (m_mute);
}
public function set soundVolume(_arg1:Number):void{
var _local2:SoundInstance;
m_soundVolume = _arg1;
for each (_local2 in m_soundsList) {
_local2.setVolumeScale(m_soundVolume);
};
}
public function getAmbient(_arg1:String){
var _local2:int;
while (_local2 < m_ambientsList.length) {
if (m_ambientsList[_local2].name == _arg1){
return (m_ambientsList[_local2]);
};
_local2++;
};
}
public function globalSoundOff():void{
m_mute = true;
var _local1:SoundTransform = new SoundTransform();
_local1.volume = 0;
SoundMixer.soundTransform = _local1;
}
public function getMusic(_arg1:String):SoundInstance{
var _local2:int;
while (_local2 < m_musicsList.length) {
if (m_musicsList[_local2].name == _arg1){
return (m_musicsList[_local2]);
};
_local2++;
};
return (null);
}
public function addSound(_arg1:String, _arg2:Sound=null):void{
var _local4:Class;
if (_arg2 == null){
_local4 = (getDefinitionByName(_arg1) as Class);
_arg2 = (new (_local4) as Sound);
};
var _local3:SoundInstance = new SoundInstance(_arg1, _arg2);
m_soundsList.push(_local3);
}
public function addAmbient(_arg1:String, _arg2:Sound):void{
var _local3:SoundInstance = new SoundInstance(_arg1, _arg2);
m_ambientsList.push(_local3);
}
public function globalSoundOn():void{
m_mute = false;
var _local1:SoundTransform = new SoundTransform();
_local1.volume = 1;
SoundMixer.soundTransform = _local1;
}
public function playSound(_arg1:String, _arg2:int=1, _arg3:SoundTransform=null):void{
var _local4:int;
while (_local4 < m_soundsList.length) {
if (m_soundsList[_local4].name == _arg1){
m_soundsList[_local4].play(0, _arg2, _arg3);
};
_local4++;
};
}
public function stopAll():void{
SoundMixer.stopAll();
}
public static function getInstance():SoundManager{
if (!s_instance){
s_instance = new (SoundManager);
};
return (s_instance);
}
}
}//package sound
Section 166
//Button (utils.Button)
package utils {
import flash.display.*;
import flash.events.*;
public class Button extends MovieClip {
public var m_mcAsset:MovieClip;
public function Button(){
buttonMode = true;
addEventListener(MouseEvent.ROLL_OVER, onRollOverMe);
addEventListener(MouseEvent.ROLL_OUT, onRollOutMe);
addEventListener(MouseEvent.CLICK, onClickMe);
addEventListener(Event.REMOVED_FROM_STAGE, onRemoveMe);
}
private function onClickMe(_arg1:MouseEvent):void{
}
public function enable():void{
buttonMode = true;
enabled = true;
mouseEnabled = true;
mouseChildren = true;
addEventListener(MouseEvent.ROLL_OVER, onRollOverMe);
addEventListener(MouseEvent.ROLL_OUT, onRollOutMe);
addEventListener(MouseEvent.CLICK, onClickMe);
}
private function onRollOverMe(_arg1:MouseEvent):void{
gotoAndPlay("over");
}
private function onRollOutMe(_arg1:MouseEvent):void{
gotoAndPlay("out");
}
private function onRemoveMe(_arg1:Event):void{
removeEventListener(MouseEvent.ROLL_OVER, onRollOverMe);
removeEventListener(MouseEvent.ROLL_OUT, onRollOutMe);
removeEventListener(MouseEvent.CLICK, onClickMe);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoveMe);
}
public function disable():void{
buttonMode = false;
enabled = false;
mouseEnabled = false;
mouseChildren = false;
removeEventListener(MouseEvent.ROLL_OVER, onRollOverMe);
removeEventListener(MouseEvent.ROLL_OUT, onRollOutMe);
removeEventListener(MouseEvent.CLICK, onClickMe);
}
}
}//package utils
Section 167
//CharacterPanel (utils.CharacterPanel)
package utils {
import flash.display.*;
import flash.events.*;
import com.gskinner.utils.*;
public class CharacterPanel extends MovieClip {
public var m_mcCharacter:MovieClip;
public var m_btnSelect:MovieClip;
public static const EVENT_ROLL_OVER:String = "onRollOverCharacter";
public static const EVENT_DISABLE:String = "onDisableButtons";
public static const EVENT_SELECT:String = "onSelect";
public function CharacterPanel(){
stop();
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("select_end", onFrameSelectEnd);
m_mcCharacter.mouseEnabled = false;
m_mcCharacter.mouseChildren = false;
EventManager.addEventListener(m_btnSelect, MouseEvent.CLICK, onSelectClick);
EventManager.addEventListener(m_btnSelect, MouseEvent.ROLL_OVER, onSelectRollOver);
m_btnSelect.mouseChildren = false;
m_btnSelect.useHandCursor = true;
m_btnSelect.buttonMode = true;
}
private function onFrameSelectEnd():void{
stop();
dispatchEvent(new Event(EVENT_SELECT));
}
private function onSelectRollOver(_arg1:MouseEvent):void{
dispatchEvent(new Event(EVENT_ROLL_OVER));
}
public function onSelectClick(_arg1:MouseEvent):void{
gotoAndPlay("select");
dispatchEvent(new Event(EVENT_ROLL_OVER));
dispatchEvent(new Event(EVENT_DISABLE));
}
public function disable():void{
EventManager.removeAllListeners(m_btnSelect);
}
public function select():void{
m_btnSelect.gotoAndStop("over");
}
public function deselect():void{
m_btnSelect.gotoAndStop("up");
}
}
}//package utils
Section 168
//EventManager (utils.EventManager)
package utils {
import flash.events.*;
import flash.utils.*;
public class EventManager {
public static var SHOW_WARNING:Boolean = false;
private static var objectMap:Dictionary = new Dictionary(true);
public static function cleanUpObject(_arg1:IEventDispatcher):void{
var _local2:Object;
var _local3:int;
if (objectMap[_arg1] == null){
return;
};
for each (_local2 in objectMap[_arg1]) {
if ((((_local2 is Number)) || ((_local2 == null)))){
} else {
_local3 = ((objectMap[_arg1][_local2[1]] as Array).length - 2);
if (!(_local2[0] as EventDispatcher).hasEventListener(_local2[1])){
removeEventListener(_local2[0], _local2[1], _local2[2]);
};
};
};
}
public static function cleanUp():void{
var _local2:Object;
var _local3:Object;
var _local1:Object = new Object();
for each (_local2 in objectMap) {
for each (_local3 in _local2) {
if ((((_local3 is Number)) || ((_local3 == null)))){
} else {
if (_local3[0] == _local1){
} else {
(cleanUpObject((_local3[0] as IEventDispatcher)) + "\n");
_local1 = _local3[0];
};
};
};
};
}
public static function getMap():Dictionary{
return (objectMap);
}
public static function removeAllListeners(_arg1:IEventDispatcher=null, _arg2:String=null, _arg3:Function=null):void{
var _local4:Object;
var _local5:Object;
var _local6:Object;
if (((((((SHOW_WARNING) && ((_arg1 == null)))) && ((_arg2 == null)))) && ((_arg3 == null)))){
trace("EventManager warning! A call to removeAllListeners had all null parameters (meaning all listeners are being removed). You might want to check your filters. (Turn off this warning by setting EventManager.SHOW_WARNING to false.)");
};
for (_local4 in objectMap) {
if (_arg1 != null){
_local4 = _arg1;
};
_local5 = objectMap[_local4];
for each (_local6 in _local5) {
if ((((((((_local6 is Number)) || ((_local6 == null)))) || (((!((_arg2 == null))) && (!((_local6[1] == _arg2))))))) || (((!((_arg3 == null))) && (!((_local6[2] == _arg3))))))){
} else {
removeEventListener(_local6[0], _local6[1], _local6[2], false, true);
};
};
if (_arg1 != null){
break;
};
};
}
public static function removeEventListener(_arg1:IEventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean=false, _arg5:Boolean=true):void{
if (_arg5){
_arg1.removeEventListener(_arg2, _arg3, _arg4);
};
if (objectMap[_arg1] == null){
return;
};
var _local6:Array = objectMap[_arg1][_arg2];
if (_local6 == null){
return;
};
var _local7:int = _local6.length;
var _local8 = 2;
while (_local8 < _local7) {
if (_local6[_local8] == _arg3){
_local6.splice(_local8, 1);
};
_local8++;
};
if (_local6.length == 2){
objectMap[_arg1][_arg2] = null;
objectMap[_arg1].numListeners--;
if (objectMap[_arg1].numListeners == 0){
objectMap[_arg1] = null;
};
};
}
public static function addEventListeners(_arg1:IEventDispatcher, _arg2:Array, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=true, _arg6:Boolean=true):void{
var _local7:int;
while (_local7 < _arg2.length) {
trace(_arg2[_local7], _arg2[(_local7 + 1)]);
addEventListener(_arg1, (_arg2[_local7] as String), (_arg2[(_local7 + 1)] as Function), _arg3, _arg4, _arg5, _arg6);
_local7 = (_local7 + 2);
};
}
public static function objectTrace(_arg1:IEventDispatcher):String{
var _local3:Object;
var _local4:int;
cleanUpObject(_arg1);
var _local2 = "";
if (objectMap[_arg1] == null){
_local2 = (_local2 + (("" + _arg1) + " has no listeners in EventManager (or gc got it)\n"));
return (_local2);
};
_local2 = (_local2 + (((_arg1 + " has ") + objectMap[_arg1].numListeners) + " listeners \n\t"));
for each (_local3 in objectMap[_arg1]) {
if ((((_local3 is Number)) || ((_local3 == null)))){
} else {
_local4 = ((objectMap[_arg1][_local3[1]] as Array).length - 2);
_local2 = (_local2 + (((("" + _local4) + " listeners of ") + _local3[1]) + ", "));
};
};
_local2 = _local2.substr(0, (_local2.length - 2));
_local2 = (_local2 + "");
return (_local2);
}
public static function deepTrace():String{
var _local4:Object;
var _local5:Object;
var _local1 = "";
var _local2:int;
var _local3:Object = new Object();
for each (_local4 in objectMap) {
for each (_local5 in _local4) {
if ((((_local5 is Number)) || ((_local5 == null)))){
} else {
if (_local5[0] == _local3){
} else {
_local1 = (_local1 + (objectTrace((_local5[0] as IEventDispatcher)) + "\n"));
if (objectMap[_local5[0]] != null){
_local2 = (_local2 + objectMap[_local5[0]].numListeners);
};
_local3 = _local5[0];
};
};
};
};
_local1 = (_local1 + ("\nTotal Listeners: " + _local2));
return (_local1);
}
public static function addEventListener(_arg1:IEventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean=false, _arg5:int=0, _arg6:Boolean=true, _arg7:Boolean=true):void{
if (_arg7){
_arg1.addEventListener(_arg2, _arg3, _arg4, _arg5, _arg6);
};
if (objectMap[_arg1] == null){
objectMap[_arg1] = new Dictionary();
objectMap[_arg1].numListeners = 0;
};
if (objectMap[_arg1][_arg2] == null){
objectMap[_arg1].numListeners++;
objectMap[_arg1][_arg2] = new Array();
(objectMap[_arg1][_arg2] as Array).push(_arg1, _arg2);
};
(objectMap[_arg1][_arg2] as Array).push(_arg3);
}
}
}//package utils
Section 169
//HintBoard (utils.HintBoard)
package utils {
import flash.display.*;
import flash.events.*;
import com.gskinner.utils.*;
import config.*;
import flash.text.*;
public class HintBoard extends MovieClip {
public var m_tfCopy:TextField;
private var m_hintCopy:String;
public static const EVENT_CLICK_OK:String = "onClickOk";
public function HintBoard(_arg1:String){
m_hintCopy = _arg1;
var _local2:FrameScriptManager = new FrameScriptManager(this);
_local2.setFrameScript("end", onFrameEnd);
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Config.KEY_CONFIRM){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
dispatchEvent(new Event(EVENT_CLICK_OK));
};
}
private function onFrameEnd():void{
stop();
m_tfCopy.text = m_hintCopy;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
}
}
}//package utils
Section 170
//PointsCloud (utils.PointsCloud)
package utils {
import flash.display.*;
import events.*;
public class PointsCloud extends MovieClip {
public var m_mcText:MovieClip;
private var m_counter:int;
public function PointsCloud(_arg1:Number, _arg2:Number, _arg3:int){
stop();
m_counter = 30;
x = _arg1;
y = _arg2;
m_mcText.tfPoints.text = _arg3;
}
public function draw():void{
nextFrame();
}
public function remove():void{
parent.removeChild(this);
dispatchEvent(new ActiveObjectEvent(ActiveObjectEvent.REMOVED));
stop();
delete ??getglobalscope
[this];
}
public function step(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
m_counter--;
if (m_counter <= 0){
remove();
};
}
}
}//package utils
Section 171
//Preloader (utils.Preloader)
package utils {
import flash.display.*;
public class Preloader extends MovieClip {
public var m_mcProgressBar:MovieClip;
public function Preloader(){
m_mcProgressBar.mcBall.gotoAndStop(1);
}
public function setPercents(_arg1:int):void{
m_mcProgressBar.mcBall.gotoAndStop(_arg1);
}
}
}//package utils
Section 172
//SoundButton (utils.SoundButton)
package utils {
import flash.display.*;
import flash.events.*;
import sound.*;
import com.gskinner.utils.*;
public class SoundButton extends MovieClip {
public var m_button:SimpleButton;
public function SoundButton(){
var _local1:FrameScriptManager = new FrameScriptManager(this);
_local1.setFrameScript("onIcon", onSoundFrameOnIcon);
_local1.setFrameScript("offIcon", onSoundFrameOffIcon);
if (SoundManager.getInstance().mute){
gotoAndStop("offIcon");
} else {
gotoAndStop("onIcon");
};
addEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
}
private function onRemoveFromStage(_arg1:Event):void{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemoveFromStage);
EventManager.removeEventListener(m_button, MouseEvent.CLICK, onClickSoundHandler);
}
private function onSoundFrameOnIcon():void{
EventManager.addEventListener(m_button, MouseEvent.CLICK, onClickSoundHandler);
}
private function onSoundFrameOffIcon():void{
EventManager.addEventListener(m_button, MouseEvent.CLICK, onClickSoundHandler);
}
private function onClickSoundHandler(_arg1:MouseEvent):void{
EventManager.removeEventListener(m_button, MouseEvent.CLICK, onClickSoundHandler);
if (SoundManager.getInstance().mute){
SoundManager.getInstance().globalSoundOn();
gotoAndStop("onIcon");
} else {
SoundManager.getInstance().globalSoundOff();
gotoAndStop("offIcon");
};
}
}
}//package utils
Section 173
//StandardButton (utils.StandardButton)
package utils {
import flash.display.*;
public class StandardButton extends MovieClip {
private var m_isOver:Boolean;
public var m_mcLabel:MovieClip;
public function StandardButton(){
mouseChildren = false;
buttonMode = true;
m_isOver = false;
stop();
disable();
}
public function setLabel(_arg1:String):void{
m_mcLabel.tfLabel.text = _arg1;
}
public function enable():void{
mouseEnabled = true;
}
public function set isOver(_arg1:Boolean):void{
m_isOver = _arg1;
}
public function get isOver():Boolean{
return (m_isOver);
}
public function disable():void{
mouseEnabled = false;
}
}
}//package utils
Section 174
//StringHelper (utils.StringHelper)
package utils {
public class StringHelper {
public static function formatScore(_arg1:int):String{
var _local4:int;
var _local5:int;
var _local2:String = _arg1.toString();
var _local3:Array = _arg1.toString().split("");
if (_local3.length > 3){
_local2 = "";
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = ((_local3.length - 1) - _local4);
_local2 = (_local3[_local5] + _local2);
if ((((((((_local4 + 1) % 3) == 0)) && (((_local4 + 1) > 0)))) && (((_local4 + 1) < _local3.length)))){
_local2 = ("," + _local2);
};
_local4++;
};
};
return (_local2);
}
}
}//package utils
Section 175
//background1 (background1)
package {
import flash.display.*;
public dynamic class background1 extends BitmapData {
public function background1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 176
//background1_bonus1 (background1_bonus1)
package {
import flash.display.*;
public dynamic class background1_bonus1 extends BitmapData {
public function background1_bonus1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 177
//char_girl_mc (char_girl_mc)
package {
import utils.*;
public dynamic class char_girl_mc extends CharacterPanel {
}
}//package
Section 178
//char_select_boy (char_select_boy)
package {
import utils.*;
public dynamic class char_select_boy extends CharacterPanel {
}
}//package
Section 179
//Crypto (Crypto)
package {
public final class Crypto {
private static var KEYS:Array = new Array("98sdfa23Ql", "ADF8b3w2fq", "ER2b79hwfO", "clkenf0FSj", "4R7d6ASYU3", "ASDQsjhW02", "kCQ6YH9asc", "ADIx7g19SP", "Nd98fhiOAF", "a09hADNFkf");
private static var SALT:String = "8008135";
public static function encrypt(_arg1:int):String{
var _local2:String = ((_arg1 + "") + SALT);
var _local3 = "";
var _local4:int = Math.floor((Math.random() * KEYS.length));
var _local5:int = _local4;
var _local6:int;
while (_local6 < _local2.length) {
_local3 = (_local3 + KEYS[_local5].charAt(parseInt(_local2.charAt(_local6))));
_local5 = ((_local5 + 1) % KEYS.length);
_local6++;
};
_local3 = (_local3 + ("" + _local4));
return (_local3);
}
public static function decrypt(_arg1:String):int{
var _local6:int;
var _local2:int = parseInt(_arg1.substr(-1));
var _local3:String = _arg1.substr(0, (_arg1.length - 1));
var _local4 = "";
var _local5:int;
while (_local5 < _local3.length) {
_local6 = KEYS[_local2].indexOf(_local3.charAt(_local5));
if (_local6 > -1){
_local4 = (_local4 + ("" + _local6));
} else {
return (0);
};
_local2 = ((_local2 + 1) % KEYS.length);
_local5++;
};
if (_local4.substr(-(SALT.length)) != SALT){
return (0);
};
return (parseInt(_local4.substr(0, (_local4.length - SALT.length))));
}
}
}//package
Section 180
//HUDpausebtn (HUDpausebtn)
package {
import utils.*;
public dynamic class HUDpausebtn extends StandardButton {
public function HUDpausebtn(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 181
//HUDplaybtn (HUDplaybtn)
package {
import utils.*;
public dynamic class HUDplaybtn extends StandardButton {
public function HUDplaybtn(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 182
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import sound.*;
import br.com.stimuli.loading.*;
import nl.demonsters.debugger.*;
import parser.*;
import config.*;
import com.memecounter.*;
import game.*;
import utils.*;
import flash.system.*;
public class Main extends MovieClip {
private const LEVELS_CONFIG_URL:String = "files/config/mission1.xml";
private var m_isMarbleMonday:Boolean;
private var m_levelConfigsList:Array;
private var m_isLoggedIn:Boolean;
public var m_preloader:Preloader;
private var m_loader:BulkLoader;
private var m_basePath:String;// = ""
private var m_total:String;
private var m_debugger:MonsterDebugger;
private var m_hints:Array;
public static const SO_FILENAME:String = "toystory_game";
public static const DEBUG:Boolean = false;
public static const CANNED:Boolean = true;
private static var s_instance:Main;
public function Main(){
Security.allowDomain("*");
if (loaderInfo.parameters.crossdomain != null){
Security.loadPolicyFile(loaderInfo.parameters.crossdomain);
};
if (loaderInfo.parameters.baseurl != null){
m_basePath = loaderInfo.parameters.baseurl;
};
m_isLoggedIn = false;
m_isMarbleMonday = false;
stop();
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
loaderInfo.addEventListener(Event.COMPLETE, onLoadMain);
s_instance = this;
Tracker.init(Config.MEME_CID, this);
}
private function onLoadConfig(_arg1:BulkProgressEvent):void{
var _local2:XML = Config.getMission1XML();
m_levelConfigsList = XMLParser.getLevels(_local2, m_basePath);
HintsManager.init(XMLParser.getHints(_local2), getHintsInfo());
m_total = XMLParser.getScore(_local2);
gotoAndStop(3);
var _local3:SoundManager = SoundManager.getInstance();
_local3.addMusic(SoundConfig.MUSIC_1);
_local3.addMusic(SoundConfig.MUSIC_GAMEOVER_SUCCESS);
_local3.addMusic(SoundConfig.MUSIC_GAMEOVER_FAILED);
_local3.addMusic(SoundConfig.MUSIC_MENU_PANEL);
_local3.addSound(SoundConfig.SFX_BADDIE_DESTROYED);
_local3.addSound(SoundConfig.SFX_COLLECT);
_local3.addSound(SoundConfig.SFX_COLLECT_ALIEN);
_local3.addSound(SoundConfig.SFX_DOOR_OPEN);
_local3.addSound(SoundConfig.SFX_FOOT_STEPS);
_local3.addSound(SoundConfig.SFX_LIFE_COLLECT);
_local3.addSound(SoundConfig.SFX_HERO_DEATH);
_local3.addSound(SoundConfig.SFX_HERO_HURT);
_local3.addSound(SoundConfig.SFX_JUMP);
_local3.addSound(SoundConfig.SFX_ENERGY_COLLECT);
_local3.addSound(SoundConfig.SFX_HERO_SHOT);
_local3.addSound(SoundConfig.SFX_SAVEPOINT);
_local3.addSound(SoundConfig.SFX_TRIGGER);
_local3.addSound(SoundConfig.SFX_BUMPER);
_local3.addSound(SoundConfig.SFX_BRICK);
_local3.addSound(SoundConfig.SFX_THUNDER);
}
public function get levelConfigsList():Array{
return (m_levelConfigsList);
}
public function get total():String{
return (m_total);
}
public function get basePath():String{
return (m_basePath);
}
public function get isLoggedIn():Boolean{
return (m_isLoggedIn);
}
public function saveHint(_arg1:int):void{
var _local2:SharedObject = SharedObject.getLocal(SO_FILENAME);
var _local3:Array = _local2.data.hints;
_local3[_arg1] = true;
_local2.data.hints = _local3;
_local2.flush();
}
public function get isMarbleMonday():Boolean{
return (m_isMarbleMonday);
}
private function onLoadProgress(_arg1:ProgressEvent):void{
m_preloader.setPercents(Math.round(((100 * _arg1.bytesLoaded) / _arg1.bytesTotal)));
}
public function getHintsInfo():Array{
var _local1:SharedObject = SharedObject.getLocal(SO_FILENAME);
var _local2:Array = _local1.data.hints;
if (_local2 == null){
_local2 = new Array();
_local1.data.hints = _local2;
_local1.flush();
};
return (_local2);
}
private function onLoadMain(_arg1:Event):void{
onLoadConfig(null);
}
public static function getInstance():Main{
return (s_instance);
}
public static function trackClick(_arg1:uint):void{
Tracker.kvClick(_arg1);
}
public static function trackEvent(_arg1:uint):void{
Tracker.kvEvent(_arg1);
}
}
}//package
Section 183
//map1_1 (map1_1)
package {
import flash.display.*;
public dynamic class map1_1 extends BitmapData {
public function map1_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 184
//map1_2 (map1_2)
package {
import flash.display.*;
public dynamic class map1_2 extends BitmapData {
public function map1_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 185
//map1_bonus1 (map1_bonus1)
package {
import flash.display.*;
public dynamic class map1_bonus1 extends BitmapData {
public function map1_bonus1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 186
//map1_bonus2 (map1_bonus2)
package {
import flash.display.*;
public dynamic class map1_bonus2 extends BitmapData {
public function map1_bonus2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 187
//Nav (Nav)
package {
import data.*;
import events.*;
import flash.events.*;
import flash.display.*;
import game.*;
import screens.*;
import sound.*;
import utils.*;
import config.*;
import flash.net.*;
public class Nav extends MovieClip {
private var m_game:Game;
private var m_pointsGame:String;
private var m_gamesCounter:int;
private var m_timeBonus:String;
private var m_collectedMarbs:String;
private var m_levelSummary:LevelSummary;
private var m_level:int;
private var m_mode:int;
private var m_instructions:Instructions;
private var m_bonusArtifact:Boolean;
private var m_info:Object;
private var m_frontMasked:Boolean;
private var m_front:Front;
private var m_marbs:Array;
private var m_time:String;
private var m_gameFailed:GameOverFailed;
private var m_gameSuccess:GameOverSuccess;
private var m_points:String;
private var m_secrets:Array;
private var m_isBoy:Boolean;
public static const MODE_INSTRUCTIONS:int = 2;
public static const MODE_FRONT:int = 1;
public static const MODE_GAME_FAILED:int = 6;
public static const MODE_LEVEL_SUMMARY:int = 4;
public static const MODE_GAME_SUCCESS:int = 5;
public static const MODE_GAME:int = 3;
public function Nav(){
m_mode = -1;
m_frontMasked = true;
m_gamesCounter = -1;
setMode(MODE_FRONT);
}
private function onGameFailed(_arg1:ObjectEvent):void{
m_info = _arg1.object;
m_timeBonus = m_info.timeBonus;
m_points = m_info.points;
m_pointsGame = m_info.gamePoints;
m_collectedMarbs = Crypto.encrypt((Crypto.decrypt(m_collectedMarbs) + Crypto.decrypt(m_info.collectedMarbs)));
m_time = Crypto.encrypt((Crypto.decrypt(m_time) + (LevelData(Main.getInstance().levelConfigsList[m_level]).time - int((Crypto.decrypt(m_info.time) / Config.FPS)))));
if (m_info.rare != null){
m_marbs[m_info.rare] = true;
};
var _local2:int;
while (_local2 < m_info.secrets.length) {
if (!m_secrets[_local2]){
m_secrets[_local2] = m_info.secrets[_local2];
};
_local2++;
};
setMode(MODE_GAME_FAILED);
}
private function onFailedClickRetry(_arg1:Event):void{
m_frontMasked = false;
setMode(MODE_FRONT);
}
private function setMode(_arg1:int):void{
var _local2:SoundManager;
var _local3:Boolean;
var _local4:Boolean;
var _local5:SoundInstance;
var _local6:SoundInstance;
var _local7:SoundInstance;
switch (m_mode){
case MODE_FRONT:
EventManager.removeAllListeners(m_front.m_content);
removeChild(m_front);
m_front = null;
m_level = 0;
m_secrets = new Array();
m_marbs = new Array();
m_points = Crypto.encrypt(0);
m_pointsGame = Crypto.encrypt(0);
m_time = Crypto.encrypt(0);
m_collectedMarbs = Crypto.encrypt(0);
m_bonusArtifact = false;
m_gamesCounter++;
if (m_gamesCounter > 0){
m_gamesCounter = Math.min(5, m_gamesCounter);
Main.trackEvent((Config.MEME_REPLAY + (m_gamesCounter - 1)));
};
break;
case MODE_INSTRUCTIONS:
EventManager.removeAllListeners(m_instructions);
removeChild(m_instructions);
m_instructions = null;
break;
case MODE_GAME:
EventManager.removeAllListeners(m_game);
removeChild(m_game);
m_game = null;
break;
case MODE_LEVEL_SUMMARY:
EventManager.removeAllListeners(m_levelSummary.m_content);
removeChild(m_levelSummary);
m_levelSummary = null;
break;
case MODE_GAME_SUCCESS:
EventManager.removeAllListeners(m_gameSuccess.m_content);
removeChild(m_gameSuccess);
m_gameSuccess = null;
SoundManager.getInstance().getMusic(SoundConfig.MUSIC_GAMEOVER_SUCCESS).stop();
SoundManager.getInstance().getMusic(SoundConfig.MUSIC_MENU_PANEL).stop();
break;
case MODE_GAME_FAILED:
EventManager.removeAllListeners(m_gameFailed.m_content);
removeChild(m_gameFailed);
m_gameFailed = null;
SoundManager.getInstance().getMusic(SoundConfig.MUSIC_GAMEOVER_FAILED).stop();
break;
};
m_mode = _arg1;
switch (m_mode){
case MODE_FRONT:
m_front = new Front(m_frontMasked);
EventManager.addEventListener(m_front.m_content, FrontContent.EVENT_CLICK_PLAY, onFrontClickPlay);
EventManager.addEventListener(m_front.m_content, FrontContent.EVENT_CLICK_INSTRUCTIONS, onFrontClickInstructions);
addChild(m_front);
_local2 = SoundManager.getInstance();
if (!_local2.getMusic(SoundConfig.MUSIC_MENU_PANEL).playing){
_local2.playMusic(SoundConfig.MUSIC_MENU_PANEL);
_local2.getMusic(SoundConfig.MUSIC_MENU_PANEL).volume = 1;
};
break;
case MODE_INSTRUCTIONS:
break;
case MODE_GAME:
m_game = new Game();
addChild(m_game);
m_game.initGame(Main.getInstance().levelConfigsList, m_points, m_pointsGame, m_level, m_isBoy, m_marbs);
EventManager.addEventListener(m_game, Game.EVENT_GAME_FAILED, onGameFailed);
EventManager.addEventListener(m_game, Game.EVENT_LEVEL_FINISHED, onLevelFinished);
break;
case MODE_LEVEL_SUMMARY:
m_levelSummary = new LevelSummary(m_info.bg);
_local3 = false;
_local4 = true;
if ((((m_level == 0)) && (!(m_info.bonus)))){
_local4 = false;
};
if ((((LevelData(Main.getInstance().levelConfigsList[(m_level + 1)]).type == LevelData.MISSION_TYPE_BONUS)) && (_local4))){
_local3 = true;
};
m_levelSummary.init(getSummaryData(), _local3);
addChild(m_levelSummary);
EventManager.addEventListener(m_levelSummary.m_content, LevelSummaryContent.EVENT_CLICK_NEXT_LEVEL, onSummaryClickOk);
_local2 = SoundManager.getInstance();
_local5 = _local2.getMusic(SoundConfig.MUSIC_1);
if (((_local5) && (_local5.playing))){
_local5.volumeTo(0, 2, true);
};
_local6 = _local2.getMusic(SoundConfig.MUSIC_MENU_PANEL);
_local2.playMusic(SoundConfig.MUSIC_MENU_PANEL);
_local6.volume = 0;
_local6.volumeTo(1, 2);
break;
case MODE_GAME_SUCCESS:
m_gameSuccess = new GameOverSuccess(m_info.bg);
m_gameSuccess.init(getSummaryData());
addChild(m_gameSuccess);
EventManager.addEventListener(m_gameSuccess.m_content, GameOverSuccessContent.EVENT_CLICK_PLAY_AGAIN, onSuccessClickPlayAgain);
_local2 = SoundManager.getInstance();
_local7 = _local2.getMusic(SoundConfig.MUSIC_MENU_PANEL);
_local7.volumeTo(0, 2, true);
_local5 = _local2.getMusic(SoundConfig.MUSIC_GAMEOVER_SUCCESS);
_local2.playMusic(SoundConfig.MUSIC_GAMEOVER_SUCCESS);
_local5.volume = 0;
_local5.volumeTo(1, 2);
break;
case MODE_GAME_FAILED:
m_gameFailed = new GameOverFailed(m_info.bg);
m_gameFailed.init(getSummaryData());
addChild(m_gameFailed);
EventManager.addEventListener(m_gameFailed.m_content, GameOverFailedContent.EVENT_CLICK_RETRY, onFailedClickRetry);
_local2 = SoundManager.getInstance();
_local5 = _local2.getMusic(SoundConfig.MUSIC_1);
if (((_local5) && (_local5.playing))){
_local5.volumeTo(0, 2, true);
};
_local6 = _local2.getMusic(SoundConfig.MUSIC_GAMEOVER_FAILED);
_local2.playMusic(SoundConfig.MUSIC_GAMEOVER_FAILED);
_local6.volume = 0;
_local6.volumeTo(1, 2);
break;
};
}
private function onSuccessClickPlayAgain(_arg1:Event):void{
setMode(MODE_FRONT);
}
private function getSummaryData():SummaryData{
var _local1:int = Crypto.decrypt(m_time);
var _local2:int = Crypto.decrypt(m_timeBonus);
var _local3:int = Crypto.decrypt(m_points);
var _local4:int = Crypto.decrypt(m_pointsGame);
var _local5:int = Crypto.decrypt(m_collectedMarbs);
var _local6:int = ((m_marbs[0]) ? 1 : 0 + (m_marbs[1]) ? 1 : 0);
var _local7:int = (((m_secrets[1]) ? 1 : 0 + (m_secrets[2]) ? 1 : 0) + (m_secrets[3]) ? 1 : 0);
var _local8:int = ((100 * _local4) / Crypto.decrypt(Main.getInstance().total));
return (new SummaryData(_local8, _local1, _local5, _local6, _local7, _local3, _local4, _local2));
}
private function onSummaryClickOk(_arg1:Event):void{
m_level++;
if ((((((m_level == 1)) && (!(m_info.bonus)))) && ((LevelData(Main.getInstance().levelConfigsList[m_level]).type == LevelData.MISSION_TYPE_BONUS)))){
m_level++;
};
SoundManager.getInstance().getMusic(SoundConfig.MUSIC_MENU_PANEL).stop();
setMode(MODE_GAME);
}
private function getSendingParams():String{
var _local1 = "";
var _local2:int = Crypto.decrypt(m_time);
var _local3:int = int((_local2 / 60));
var _local4:int = (_local2 % 60);
_local1 = (_local1 + ("/" + "1"));
_local1 = (_local1 + ("/" + m_points));
_local1 = (_local1 + ("/" + m_time));
_local1 = (_local1 + ("/" + (m_marbs[0]) ? 1 : 0));
_local1 = (_local1 + ("/" + (m_marbs[1]) ? 1 : 0));
_local1 = (_local1 + ("/" + (m_secrets[1]) ? 1 : 0));
_local1 = (_local1 + ("/" + (m_secrets[2]) ? 1 : 0));
_local1 = (_local1 + ("/" + (m_secrets[3]) ? 1 : 0));
_local1 = (_local1 + ("/" + (Main.getInstance().isMarbleMonday) ? Crypto.encrypt(0) : m_collectedMarbs));
_local1 = (_local1 + ("/" + Crypto.encrypt(int(((100 * Crypto.decrypt(m_pointsGame)) / Crypto.decrypt(Main.getInstance().total))))));
_local1 = (_local1 + ("/" + (Main.getInstance().isMarbleMonday) ? 1 : 0));
return (_local1);
}
private function onFrontClickInstructions(_arg1:Event):void{
setMode(MODE_INSTRUCTIONS);
}
private function sendScore():void{
var _local1:URLRequest = new URLRequest(((Main.getInstance().basePath + "flash/postuserstats") + getSendingParams()));
var _local2:URLLoader = new URLLoader(_local1);
_local2.addEventListener(Event.COMPLETE, onSubmitScore);
}
private function onFrontClickPlay(_arg1:ObjectEvent):void{
m_isBoy = _arg1.object.boy;
setMode(MODE_GAME);
}
private function onLevelFinished(_arg1:ObjectEvent):void{
m_info = _arg1.object;
m_timeBonus = m_info.timeBonus;
m_points = Crypto.encrypt((Crypto.decrypt(m_info.points) + Crypto.decrypt(m_timeBonus)));
m_pointsGame = m_info.gamePoints;
m_collectedMarbs = Crypto.encrypt((Crypto.decrypt(m_collectedMarbs) + Crypto.decrypt(m_info.collectedMarbs)));
m_bonusArtifact = (m_info.bonus) ? true : m_bonusArtifact;
m_time = Crypto.encrypt((Crypto.decrypt(m_time) + (LevelData(Main.getInstance().levelConfigsList[m_level]).time - int((Crypto.decrypt(m_info.time) / Config.FPS)))));
if (m_info.rare != null){
m_marbs[m_info.rare] = true;
};
var _local2:int;
while (_local2 < m_info.secrets.length) {
if (!m_secrets[_local2]){
m_secrets[_local2] = m_info.secrets[_local2];
};
_local2++;
};
if (m_level == 0){
Main.trackEvent(Config.MEME_LEVEL_1_COMPLETED);
} else {
if (m_level == 2){
Main.trackEvent(Config.MEME_LEVEL_2_COMPLETED);
};
};
if (m_level < (Main.getInstance().levelConfigsList.length - 1)){
setMode(MODE_LEVEL_SUMMARY);
} else {
setMode(MODE_GAME_SUCCESS);
};
}
private function onSubmitScore(_arg1:Event):void{
var _local2:URLLoader = (_arg1.target as URLLoader);
_local2.removeEventListener(Event.COMPLETE, onSubmitScore);
}
}
}//package
Section 188
//next_butt (next_butt)
package {
import utils.*;
public dynamic class next_butt extends StandardButton {
public function next_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 189
//next_level_butt (next_level_butt)
package {
import utils.*;
public dynamic class next_level_butt extends StandardButton {
public function next_level_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 190
//play_again_butt (play_again_butt)
package {
import utils.*;
public dynamic class play_again_butt extends StandardButton {
public function play_again_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 191
//play_butt (play_butt)
package {
import utils.*;
public dynamic class play_butt extends StandardButton {
public function play_butt(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 192
//play_mm_butt (play_mm_butt)
package {
import utils.*;
public dynamic class play_mm_butt extends StandardButton {
public function play_mm_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 193
//popup_butt_close (popup_butt_close)
package {
import utils.*;
public dynamic class popup_butt_close extends StandardButton {
public function popup_butt_close(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 194
//popup_submit_butt (popup_submit_butt)
package {
import utils.*;
public dynamic class popup_submit_butt extends StandardButton {
public function popup_submit_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 195
//prev_butt (prev_butt)
package {
import utils.*;
public dynamic class prev_butt extends StandardButton {
public function prev_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 196
//retry_butt (retry_butt)
package {
import utils.*;
public dynamic class retry_butt extends StandardButton {
public function retry_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 197
//SFX_BADDIE_DESTROYED (SFX_BADDIE_DESTROYED)
package {
import flash.media.*;
public dynamic class SFX_BADDIE_DESTROYED extends Sound {
}
}//package
Section 198
//SFX_BUMPER (SFX_BUMPER)
package {
import flash.media.*;
public dynamic class SFX_BUMPER extends Sound {
}
}//package
Section 199
//SFX_COLLECT (SFX_COLLECT)
package {
import flash.media.*;
public dynamic class SFX_COLLECT extends Sound {
}
}//package
Section 200
//SFX_DESTROY_BRICK (SFX_DESTROY_BRICK)
package {
import flash.media.*;
public dynamic class SFX_DESTROY_BRICK extends Sound {
}
}//package
Section 201
//SFX_DOOR_OPEN (SFX_DOOR_OPEN)
package {
import flash.media.*;
public dynamic class SFX_DOOR_OPEN extends Sound {
}
}//package
Section 202
//SFX_ENERGY_COLLECT (SFX_ENERGY_COLLECT)
package {
import flash.media.*;
public dynamic class SFX_ENERGY_COLLECT extends Sound {
}
}//package
Section 203
//SFX_FOOT_STEPS (SFX_FOOT_STEPS)
package {
import flash.media.*;
public dynamic class SFX_FOOT_STEPS extends Sound {
}
}//package
Section 204
//SFX_HERO_DEATH (SFX_HERO_DEATH)
package {
import flash.media.*;
public dynamic class SFX_HERO_DEATH extends Sound {
}
}//package
Section 205
//SFX_HERO_HURT (SFX_HERO_HURT)
package {
import flash.media.*;
public dynamic class SFX_HERO_HURT extends Sound {
}
}//package
Section 206
//SFX_HERO_SHOT (SFX_HERO_SHOT)
package {
import flash.media.*;
public dynamic class SFX_HERO_SHOT extends Sound {
}
}//package
Section 207
//SFX_JUMP (SFX_JUMP)
package {
import flash.media.*;
public dynamic class SFX_JUMP extends Sound {
}
}//package
Section 208
//SFX_LIFE_COLLECT (SFX_LIFE_COLLECT)
package {
import flash.media.*;
public dynamic class SFX_LIFE_COLLECT extends Sound {
}
}//package
Section 209
//SFX_SAVEPOINT (SFX_SAVEPOINT)
package {
import flash.media.*;
public dynamic class SFX_SAVEPOINT extends Sound {
}
}//package
Section 210
//SFX_TRIGGER (SFX_TRIGGER)
package {
import flash.media.*;
public dynamic class SFX_TRIGGER extends Sound {
}
}//package
Section 211
//sndCollectAlien (sndCollectAlien)
package {
import flash.media.*;
public dynamic class sndCollectAlien extends Sound {
}
}//package
Section 212
//sndDoorOpen (sndDoorOpen)
package {
import flash.media.*;
public dynamic class sndDoorOpen extends Sound {
}
}//package
Section 213
//sndMissionFail (sndMissionFail)
package {
import flash.media.*;
public dynamic class sndMissionFail extends Sound {
}
}//package
Section 214
//sndMissionSuccess (sndMissionSuccess)
package {
import flash.media.*;
public dynamic class sndMissionSuccess extends Sound {
}
}//package
Section 215
//sndMusicInGame (sndMusicInGame)
package {
import flash.media.*;
public dynamic class sndMusicInGame extends Sound {
}
}//package
Section 216
//sndMusicMenu (sndMusicMenu)
package {
import flash.media.*;
public dynamic class sndMusicMenu extends Sound {
}
}//package
Section 217
//sndThunder (sndThunder)
package {
import flash.media.*;
public dynamic class sndThunder extends Sound {
}
}//package
Section 218
//tileset1 (tileset1)
package {
import flash.display.*;
public dynamic class tileset1 extends BitmapData {
public function tileset1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 219
//tileset1_bonus1 (tileset1_bonus1)
package {
import flash.display.*;
public dynamic class tileset1_bonus1 extends BitmapData {
public function tileset1_bonus1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 220
//visit_site_butt (visit_site_butt)
package {
import utils.*;
public dynamic class visit_site_butt extends StandardButton {
public function visit_site_butt(){
addFrameScript(4, frame5, 9, frame10, 14, frame15);
}
function frame5(){
stop();
}
function frame15(){
stop();
}
function frame10(){
stop();
}
}
}//package