Section 1
//MD5 (be.boulevart.as3.security.MD5)
package be.boulevart.as3.security {
public class MD5 {
protected static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
protected static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
protected static function str2binl(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
var _local4:Number;
_local2 = new Array();
_local3 = ((1 << 8) - 1);
_local4 = 0;
while (_local4 < (_arg1.length * 8)) {
_local2[(_local4 >> 5)] = (_local2[(_local4 >> 5)] | ((_arg1.charCodeAt((_local4 / 8)) & _local3) << (_local4 % 32)));
_local4 = (_local4 + 8);
};
return (_local2);
}
protected static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function calculate(_arg1:String):String{
return (hex_md5(_arg1));
}
protected static function binl2hex(_arg1:Array):String{
var _local2:String;
var _local3:String;
var _local4:Number;
_local2 = new String("");
_local3 = new String("0123456789abcdef");
_local4 = 0;
while (_local4 < (_arg1.length * 4)) {
_local2 = (_local2 + (_local3.charAt(((_arg1[(_local4 >> 2)] >> (((_local4 % 4) * 8) + 4)) & 15)) + _local3.charAt(((_arg1[(_local4 >> 2)] >> ((_local4 % 4) * 8)) & 15))));
_local4++;
};
return (_local2);
}
protected static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
_local4 = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
protected static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
protected static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
protected static function hex_md5(_arg1:String):String{
return (binl2hex(core_md5(str2binl(_arg1), (_arg1.length * 8))));
}
protected static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
protected static function core_md5(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = -271733879;
_local5 = -1732584194;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return (new Array(_local3, _local4, _local5, _local6));
}
}
}//package be.boulevart.as3.security
Section 2
//MemoryCrypto (com.electrotank.util.MemoryCrypto)
package com.electrotank.util {
import com.meychi.ascrypt3.*;
public class MemoryCrypto {
private static var crypto:TEA = null;
private static var INCREMENT:int = 0;
private static var initialized:Boolean = false;
public static var key:String = null;
private static var MULTIPLY:int = 2;
private static var DECREMENT:int = 1;
private static var dataHolder:Object = null;
private static var DIVIDE:int = 3;
public static function incrementValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, INCREMENT));
}
public static function getValue(_arg1:String):Number{
var _local2:Number;
initIfNeeded();
_local2 = 0;
if (!isValueSet(_arg1)){
setValue(_arg1, _local2);
} else {
_local2 = new Number(crypto.decrypt(dataHolder[_arg1], key));
};
return (_local2);
}
private static function processValue(_arg1:String, _arg2:Number, _arg3:int):Number{
var _local4:Number;
initIfNeeded();
_local4 = getValue(_arg1);
switch (_arg3){
case INCREMENT:
_local4 = (_local4 + _arg2);
break;
case DECREMENT:
_local4 = (_local4 - _arg2);
break;
case MULTIPLY:
_local4 = (_local4 * _arg2);
break;
case DIVIDE:
_local4 = (_local4 / _arg2);
break;
};
setValue(_arg1, _local4);
return (_local4);
}
public static function reset():void{
initialized = false;
initIfNeeded();
}
public static function decrementValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, DECREMENT));
}
private static function initIfNeeded():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:String;
if (!initialized){
_local1 = Math.random();
_local2 = new String(_local1);
_local2 = _local2.substr(2, (_local2.length - 2));
_local3 = Math.random();
_local4 = new String(_local3);
_local4 = _local4.substr(2, (_local4.length - 2));
key = (_local2 + _local4);
crypto = new TEA();
dataHolder = new Object();
initialized = true;
};
}
public static function multiplyValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, MULTIPLY));
}
public static function setValue(_arg1:String, _arg2:Number):Number{
initIfNeeded();
dataHolder[_arg1] = crypto.encrypt(_arg2.toString(), key);
return (_arg2);
}
public static function divideValue(_arg1:String, _arg2:Number):Number{
if (_arg2 == 0){
throw (new Error("Amount can't be zero when dividing!"));
};
return (processValue(_arg1, _arg2, DIVIDE));
}
public static function isValueSet(_arg1:String):Boolean{
var _local2:Boolean;
initIfNeeded();
_local2 = false;
if (dataHolder[_arg1] != null){
_local2 = true;
};
return (_local2);
}
}
}//package com.electrotank.util
Section 3
//Particle (com.footloosemoose.particlegenerator.Particle)
package com.footloosemoose.particlegenerator {
import flash.display.*;
import flash.events.*;
import de.polygonal.math.*;
public class Particle extends Shape {
private var ymov:Number;// = 0
private var mWallX:Number;
private var pid:int;
private var sideLength:Number;
private var tempy:Number;// = 0
private var xmov:Number;// = 0
private var isGrowing:Boolean;
private var mTargetY:Number;
private var mTargetX:Number;
private var mType:int;
private var tempx:Number;// = 0
private var mWallY:Number;
public function Particle(){
xmov = 0;
ymov = 0;
tempx = 0;
tempy = 0;
isGrowing = (Math.random() > 0.5);
super();
}
private function onRemoved(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
removeEventListener(Event.REMOVED, onRemoved);
}
private function grow():Boolean{
this.scaleX = (this.scaleY = (this.scaleY + (this.isGrowing) ? 0.02 : -0.02));
if (mType == 0){
this.alpha = (this.alpha - 0.03);
} else {
if (mType == 1){
this.alpha = (this.alpha + 0.03);
};
};
return ((((this.alpha > 0)) && ((this.scaleX > 0))));
}
public function init(_arg1:int, _arg2:Object):Particle{
var _local3:Number;
var _local4:Number;
var _local5:Number;
this.pid = _arg1;
this.sideLength = (2 + (Math.random() * 20));
this.x = _arg2.xpos;
this.y = _arg2.ypos;
mTargetX = x;
mTargetY = y;
mWallX = _arg2.wallx;
mWallY = _arg2.wally;
mType = _arg2.type;
if (mType == 1){
this.x = (this.x + (PM_PRNG.nextIntRange(0, 1000) - 500));
this.y = (this.y + (PM_PRNG.nextIntRange(0, 1000) - 500));
};
if (mType == 0){
_local3 = (PM_PRNG.nextIntRange(0, 360) - 180);
_local4 = 3;
_local5 = (_local3 * 0.0174532925);
_local5 = (_local5 + (-5 + (Math.random() * 10)));
_local3 = (_local5 * 57.2957795);
this.xmov = (_local4 * Math.cos(_local3));
this.ymov = (_local4 * Math.sin(_local3));
} else {
if (mType == 1){
_local4 = 3;
_local3 = Global.AngleOfTwoLines(_arg2.xpos, _arg2.ypos, x, y);
this.xmov = (_local4 * Math.cos(_local3));
this.ymov = (_local4 * Math.sin(_local3));
this.alpha = 0;
this.isGrowing = false;
};
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.REMOVED, onRemoved);
draw();
return (this);
}
private function killMe():void{
ParticleManager.getInstance().removeParticle(this.pid);
this.parent.removeChild(this);
}
private function onEnterFrame(_arg1:Event):void{
this.tempx = this.x;
this.tempy = this.y;
if (mType == 0){
this.tempx = (this.tempx + this.xmov);
this.tempy = (this.tempy + this.ymov);
} else {
if (mType == 1){
this.tempx = (this.tempx + this.xmov);
this.tempy = (this.tempy + this.ymov);
if (Global.Distance(x, y, mTargetX, mTargetY) <= 30){
killMe();
return;
};
};
};
if (((!(grow())) || (!(checkForWalls())))){
killMe();
} else {
this.x = this.tempx;
this.y = this.tempy;
};
}
private function checkForWalls():Boolean{
if (((((((((this.tempy + this.sideLength) < 0)) || (((this.tempy - this.sideLength) > mWallY)))) || (((this.tempx + this.sideLength) < 0)))) || (((this.tempx - this.sideLength) > mWallX)))){
return (false);
};
return (true);
}
private function draw():void{
graphics.beginFill((Math.random() * 0xFF0000));
graphics.drawCircle(0, 0, this.sideLength);
graphics.endFill();
}
override public function toString():String{
return ("[Particle]");
}
}
}//package com.footloosemoose.particlegenerator
Section 4
//ParticleManager (com.footloosemoose.particlegenerator.ParticleManager)
package com.footloosemoose.particlegenerator {
import flash.display.*;
public class ParticleManager {
private var allParticles:Array;
private var recycle:Array;
private var mContainer:MovieClip;
private static var instance:ParticleManager;
public function ParticleManager(_arg1:SingletonEnforcer){
}
public function createParticle(_arg1:int, _arg2:Object):void{
var _local3:int;
var _local4:int;
_local3 = 0;
while (_local3 < _arg1) {
_local4 = getNextSlot();
this.allParticles[_local4] = new Particle().init(_local4, _arg2);
mContainer.addChild(this.allParticles[_local4]);
_local3++;
};
}
public function removeParticle(_arg1:int):void{
this.recycle.push(_arg1);
}
private function getNextSlot():int{
if (this.recycle.length > 0){
return (int(this.recycle.pop()));
};
return (this.allParticles.length);
}
public function init(_arg1:MovieClip):void{
this.allParticles = [];
this.recycle = [];
this.mContainer = _arg1;
}
public static function getInstance():ParticleManager{
if (ParticleManager.instance == null){
ParticleManager.instance = new ParticleManager(new SingletonEnforcer());
};
return (ParticleManager.instance);
}
}
}//package com.footloosemoose.particlegenerator
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 5
//TEA (com.meychi.ascrypt3.TEA)
package com.meychi.ascrypt3 {
public class TEA {
public function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local3 = charsToLongs(strToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
if (_local5 == 1){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local14 = _temp1;
_local3[_local14] = 0;
};
_local6 = _local3[(_local5 - 1)];
_local7 = _local3[0];
_local8 = 2654435769;
_local11 = Math.floor((6 + (52 / _local5)));
_local12 = 0;
while (_local11-- > 0) {
_local12 = (_local12 + _local8);
_local10 = ((_local12 >>> 2) & 3);
_local13 = 0;
while (_local13 < (_local5 - 1)) {
_local7 = _local3[(_local13 + 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local6 = (_local3[_local13] = (_local3[_local13] + _local9));
_local13++;
};
_local7 = _local3[0];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local6 = (_local3[(_local5 - 1)] = (_local3[(_local5 - 1)] + _local9));
};
return (charsToHex(longsToChars(_local3)));
}
public function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local3 = charsToLongs(hexToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
_local6 = _local3[(_local5 - 1)];
_local7 = _local3[0];
_local8 = 2654435769;
_local11 = Math.floor((6 + (52 / _local5)));
_local12 = (_local11 * _local8);
while (_local12 != 0) {
_local10 = ((_local12 >>> 2) & 3);
_local13 = (_local5 - 1);
while (_local13 > 0) {
_local6 = _local3[(_local13 - 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local7 = (_local3[_local13] = (_local3[_local13] - _local9));
_local13--;
};
_local6 = _local3[(_local5 - 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local7 = (_local3[0] = (_local3[0] - _local9));
_local12 = (_local12 - _local8);
};
return (charsToStr(longsToChars(_local3)));
}
private static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function longsToChars(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push((_arg1[_local3] & 0xFF), ((_arg1[_local3] >>> 8) & 0xFF), ((_arg1[_local3] >>> 16) & 0xFF), ((_arg1[_local3] >>> 24) & 0xFF));
_local3++;
};
return (_local2);
}
private static function charsToLongs(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array(Math.ceil((_arg1.length / 4)));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = (((_arg1[(_local3 * 4)] + (_arg1[((_local3 * 4) + 1)] << 8)) + (_arg1[((_local3 * 4) + 2)] << 16)) + (_arg1[((_local3 * 4) + 3)] << 24));
_local3++;
};
return (_local2);
}
}
}//package com.meychi.ascrypt3
Section 6
//KeyObject (com.senocular.utils.KeyObject)
package com.senocular.utils {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.ui.*;
public dynamic class KeyObject extends Proxy {
private static var keysDown:Object;
private static var stage:Stage;
public function KeyObject(_arg1:Stage){
construct(_arg1);
}
private function keyPressed(_arg1:KeyboardEvent):void{
keysDown[_arg1.keyCode] = true;
}
public function construct(_arg1:Stage):void{
KeyObject.stage = _arg1;
keysDown = new Object();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (((_arg1 in Keyboard)) ? Keyboard[_arg1] : -1);
}
public function isDown(_arg1:uint):Boolean{
return (Boolean((_arg1 in keysDown)));
}
private function keyReleased(_arg1:KeyboardEvent):void{
delete keysDown[_arg1.keyCode];
}
public function deconstruct():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keysDown = new Object();
KeyObject.stage = null;
}
}
}//package com.senocular.utils
Section 7
//PM_PRNG (de.polygonal.math.PM_PRNG)
package de.polygonal.math {
public class PM_PRNG {
public static var seed:uint = now.getTime();
public static var now:Date = new Date();
public function PM_PRNG(){
var _local1:Date;
super();
_local1 = new Date();
}
public static function nextDoubleRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * nextDouble())));
}
public static function nextDouble():Number{
return ((gen() / 2147483647));
}
private static function gen():uint{
return ((seed = ((seed * 16807) % 2147483647)));
}
public static function nextIntRange(_arg1:Number, _arg2:Number):uint{
_arg1 = (_arg1 - 0.4999);
_arg2 = (_arg2 + 0.4999);
return (Math.round((_arg1 + ((_arg2 - _arg1) * nextDouble()))));
}
public static function nextInt():uint{
return (gen());
}
}
}//package de.polygonal.math
Section 8
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.geom.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 9
//DataGridCellEditor (fl.controls.dataGridClasses.DataGridCellEditor)
package fl.controls.dataGridClasses {
import fl.controls.listClasses.*;
import fl.controls.*;
public class DataGridCellEditor extends TextInput implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {textPadding:1, textFormat:null, upSkin:"DataGridCellEditor_skin"};
public function DataGridCellEditor():void{
}
public function get selected():Boolean{
return (false);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
text = _listData.label;
}
public function setMouseState(_arg1:String):void{
}
public function set selected(_arg1:Boolean):void{
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.dataGridClasses
Section 10
//DataGridColumn (fl.controls.dataGridClasses.DataGridColumn)
package fl.controls.dataGridClasses {
import fl.core.*;
import fl.controls.*;
public class DataGridColumn {
private var _headerText:String;
public var editorDataField:String;// = "text"
private var forceImport:DataGridCellEditor;
private var _headerRenderer:Object;
public var sortOptions:uint;// = 0
private var _cellRenderer:Object;
private var _columnName:String;
public var resizable:Boolean;// = true
private var _sortCompareFunction:Function;
private var _visible:Boolean;// = true
public var sortDescending:Boolean;// = false
public var owner:DataGrid;
private var _imeMode:String;
private var _width:Number;// = 100
public var editable:Boolean;// = true
public var itemEditor:Object;// = "fl.controls.dataGridClasses.DataGridCellEditor"
public var explicitWidth:Number;
private var _minWidth:Number;// = 20
private var _labelFunction:Function;
public var sortable:Boolean;// = true
public var colNum:Number;
public var dataField:String;
public function DataGridColumn(_arg1:String=null){
_minWidth = 20;
_width = 100;
_visible = true;
sortable = true;
resizable = true;
editable = true;
itemEditor = "fl.controls.dataGridClasses.DataGridCellEditor";
editorDataField = "text";
sortDescending = false;
sortOptions = 0;
super();
if (_arg1){
dataField = _arg1;
headerText = _arg1;
};
}
public function set headerRenderer(_arg1:Object):void{
_headerRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get imeMode():String{
return (_imeMode);
}
public function setWidth(_arg1:Number):void{
_width = _arg1;
}
public function set width(_arg1:Number):void{
var _local2:Boolean;
explicitWidth = _arg1;
if (owner != null){
_local2 = resizable;
resizable = false;
owner.resizeColumn(colNum, _arg1);
resizable = _local2;
} else {
_width = _arg1;
};
}
public function set cellRenderer(_arg1:Object):void{
_cellRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get minWidth():Number{
return (_minWidth);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function toString():String{
return ("[object DataGridColumn]");
}
public function get visible():Boolean{
return (_visible);
}
public function itemToLabel(_arg1:Object):String{
var data = _arg1;
if (!data){
return (" ");
};
if (labelFunction != null){
return (labelFunction(data));
};
if (owner.labelFunction != null){
return (owner.labelFunction(data, this));
};
if ((((typeof(data) == "object")) || ((typeof(data) == "xml")))){
try {
data = data[dataField];
} catch(e:Error) {
data = null;
};
};
if ((data is String)){
return (String(data));
};
try {
return (data.toString());
} catch(e:Error) {
};
return (" ");
}
public function set minWidth(_arg1:Number):void{
_minWidth = _arg1;
if (_width < _arg1){
_width = _arg1;
};
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
}
public function set headerText(_arg1:String):void{
_headerText = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function set sortCompareFunction(_arg1:Function):void{
_sortCompareFunction = _arg1;
}
public function get width():Number{
return (_width);
}
public function get cellRenderer():Object{
return (_cellRenderer);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get headerText():String{
return (((_headerText)!=null) ? _headerText : dataField);
}
public function get sortCompareFunction():Function{
return (_sortCompareFunction);
}
public function get headerRenderer():Object{
return (_headerRenderer);
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set visible(_arg1:Boolean):void{
if (_visible != _arg1){
_visible = _arg1;
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
};
}
}
}//package fl.controls.dataGridClasses
Section 11
//HeaderRenderer (fl.controls.dataGridClasses.HeaderRenderer)
package fl.controls.dataGridClasses {
import fl.controls.*;
public class HeaderRenderer extends LabelButton {
public var _column:uint;
private static var defaultStyles:Object = {upSkin:"HeaderRenderer_upSkin", downSkin:"HeaderRenderer_downSkin", overSkin:"HeaderRenderer_overSkin", disabledSkin:"HeaderRenderer_disabledSkin", selectedDisabledSkin:"HeaderRenderer_selectedDisabledSkin", selectedUpSkin:"HeaderRenderer_selectedUpSkin", selectedDownSkin:"HeaderRenderer_selectedDownSkin", selectedOverSkin:"HeaderRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, textPadding:5};
public function HeaderRenderer():void{
focusEnabled = false;
}
public function set column(_arg1:uint):void{
_column = _arg1;
}
public function get column():uint{
return (_column);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = Number(getStyleValue("textPadding"));
textField.height = (textField.textHeight + 4);
textField.visible = (label.length > 0);
_local2 = (textField.textWidth + 4);
_local3 = (textField.textHeight + 4);
_local4 = ((icon)==null) ? 0 : (icon.width + 4);
_local5 = Math.max(0, Math.min(_local2, ((width - (2 * _local1)) - _local4)));
if (icon != null){
icon.x = (((width - _local1) - icon.width) - 2);
icon.y = Math.round(((height - icon.height) / 2));
};
textField.width = _local5;
textField.x = _local1;
textField.y = Math.round(((height - textField.height) / 2));
background.width = width;
background.height = height;
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.dataGridClasses
Section 12
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import fl.controls.*;
import flash.events.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 13
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 14
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 15
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 16
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 17
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 18
//DataGrid (fl.controls.DataGrid)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import fl.controls.dataGridClasses.*;
import flash.utils.*;
import flash.ui.*;
import flash.geom.*;
public class DataGrid extends SelectableList implements IFocusManagerComponent {
protected var _showHeaders:Boolean;// = true
protected var _sortIndex:int;// = -1
protected var _minColumnWidth:Number;
protected var _headerRenderer:Object;
public var sortableColumns:Boolean;// = true
protected var activeCellRenderersMap:Dictionary;
protected var _labelFunction:Function;
protected var headerSortArrow:Sprite;
protected var _sortDescending:Boolean;// = false
protected var losingFocus:Boolean;// = false
protected var maxHeaderHeight:Number;// = 25
protected var minColumnWidthInvalid:Boolean;// = false
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var proposedEditedItemPosition;
public var editable:Boolean;// = false
protected var dragHandlesMap:Dictionary;
protected var header:Sprite;
protected var availableCellRenderersMap:Dictionary;
protected var _columns:Array;
public var resizableColumns:Boolean;// = true
protected var columnStretchStartWidth:Number;
protected var actualRowIndex:int;
protected var _editedItemPosition:Object;
protected var editedItemPositionChanged:Boolean;// = false
protected var actualColIndex:int;
protected var columnStretchCursor:Sprite;
protected var visibleColumns:Array;
protected var headerMask:Sprite;
public var itemEditorInstance:Object;
protected var displayableColumns:Array;
protected var columnStretchIndex:Number;// = -1
protected var columnsInvalid:Boolean;// = true
protected var currentHoveredRow:int;// = -1
protected var isPressed:Boolean;// = false
protected var lastSortIndex:int;// = -1
protected var columnStretchStartX:Number;
protected var _headerHeight:Number;// = 25
protected static const HEADER_STYLES:Object = {disabledSkin:"headerDisabledSkin", downSkin:"headerDownSkin", overSkin:"headerOverSkin", upSkin:"headerUpSkin", textFormat:"headerTextFormat", disabledTextFormat:"headerDisabledTextFormat", textPadding:"headerTextPadding"};
private static var defaultStyles:Object = {headerUpSkin:"HeaderRenderer_upSkin", headerDownSkin:"HeaderRenderer_downSkin", headerOverSkin:"HeaderRenderer_overSkin", headerDisabledSkin:"HeaderRenderer_disabledSkin", headerSortArrowDescSkin:"HeaderSortArrow_descIcon", headerSortArrowAscSkin:"HeaderSortArrow_ascIcon", columnStretchCursorSkin:"ColumnStretch_cursor", columnDividerSkin:null, headerTextFormat:null, headerDisabledTextFormat:null, headerTextPadding:5, headerRenderer:HeaderRenderer, focusRectSkin:null, focusRectPadding:null, skin:"DataGrid_skin"};
public static var createAccessibilityImplementation:Function;
public function DataGrid(){
_rowHeight = 20;
_headerHeight = 25;
_showHeaders = true;
columnsInvalid = true;
minColumnWidthInvalid = false;
columnStretchIndex = -1;
_sortIndex = -1;
lastSortIndex = -1;
_sortDescending = false;
editedItemPositionChanged = false;
isPressed = false;
losingFocus = false;
maxHeaderHeight = 25;
currentHoveredRow = -1;
editable = false;
resizableColumns = true;
sortableColumns = true;
super();
if (_columns == null){
_columns = [];
};
_horizontalScrollPolicy = ScrollPolicy.OFF;
activeCellRenderersMap = new Dictionary(true);
availableCellRenderersMap = new Dictionary(true);
addEventListener(DataGridEvent.ITEM_EDIT_BEGINNING, itemEditorItemEditBeginningHandler, false, -50);
addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, itemEditorItemEditBeginHandler, false, -50);
addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditorItemEditEndHandler, false, -50);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
override protected function drawList():void{
var _local1:uint;
var _local2:uint;
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Object;
var _local7:ICellRenderer;
var _local8:Array;
var _local9:DataGridColumn;
var _local10:Boolean;
var _local11:Dictionary;
var _local12:DataGridColumn;
var _local13:Sprite;
var _local14:UIComponent;
var _local15:Array;
var _local16:uint;
var _local17:uint;
var _local18:Number;
var _local19:DataGridColumn;
var _local20:Object;
var _local21:Array;
var _local22:Dictionary;
var _local23:Object;
var _local24:HeaderRenderer;
var _local25:Sprite;
var _local26:Graphics;
var _local27:Boolean;
var _local28:String;
if (showHeaders){
header.visible = true;
header.x = (contentPadding - _horizontalScrollPosition);
header.y = contentPadding;
listHolder.y = (contentPadding + headerHeight);
_local18 = Math.floor((availableHeight - headerHeight));
_verticalScrollBar.setScrollProperties(_local18, 0, (contentHeight - _local18), _verticalScrollBar.pageScrollSize);
} else {
header.visible = false;
listHolder.y = contentPadding;
};
listHolder.x = contentPadding;
contentScrollRect = listHolder.scrollRect;
contentScrollRect.x = _horizontalScrollPosition;
contentScrollRect.y = (vOffset + (Math.floor(_verticalScrollPosition) % rowHeight));
listHolder.scrollRect = contentScrollRect;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local1 = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
_local2 = Math.min(Math.max((length - 1), 0), ((_local1 + rowCount) + 1));
_local10 = list.hitTestPoint(stage.mouseX, stage.mouseY);
calculateColumnSizes();
_local11 = (renderedItems = new Dictionary(true));
if (length > 0){
_local5 = _local1;
while (_local5 <= _local2) {
_local11[_dataProvider.getItemAt(_local5)] = true;
_local5++;
};
};
_local3 = 0;
_local12 = (visibleColumns[0] as DataGridColumn);
_local5 = 0;
while (_local5 < displayableColumns.length) {
_local19 = (displayableColumns[_local5] as DataGridColumn);
if (_local19 != _local12){
_local3 = (_local3 + _local19.width);
} else {
break;
};
_local5++;
};
while (header.numChildren > 0) {
header.removeChildAt(0);
};
dragHandlesMap = new Dictionary(true);
_local15 = [];
_local16 = visibleColumns.length;
_local17 = 0;
while (_local17 < _local16) {
_local9 = (visibleColumns[_local17] as DataGridColumn);
_local15.push(_local9.colNum);
if (showHeaders){
_local23 = ((_local9.headerRenderer)!=null) ? _local9.headerRenderer : _headerRenderer;
_local24 = (getDisplayObjectInstance(_local23) as HeaderRenderer);
if (_local24 != null){
_local24.addEventListener(MouseEvent.CLICK, handleHeaderRendererClick, false, 0, true);
_local24.x = _local3;
_local24.y = 0;
_local24.setSize(_local9.width, headerHeight);
_local24.column = _local9.colNum;
_local24.label = _local9.headerText;
header.addChildAt(_local24, _local17);
copyStylesToChild(_local24, HEADER_STYLES);
if ((((((sortIndex == -1)) && ((lastSortIndex == -1)))) || (!((_local9.colNum == sortIndex))))){
_local24.setStyle("icon", null);
} else {
_local24.setStyle("icon", (sortDescending) ? getStyleValue("headerSortArrowAscSkin") : getStyleValue("headerSortArrowDescSkin"));
};
if ((((((_local17 < (_local16 - 1))) && (resizableColumns))) && (_local9.resizable))){
_local25 = new Sprite();
_local26 = _local25.graphics;
_local26.beginFill(0, 0);
_local26.drawRect(0, 0, 3, headerHeight);
_local26.endFill();
_local25.x = ((_local3 + _local9.width) - 2);
_local25.y = 0;
_local25.alpha = 0;
_local25.addEventListener(MouseEvent.MOUSE_OVER, handleHeaderResizeOver, false, 0, true);
_local25.addEventListener(MouseEvent.MOUSE_OUT, handleHeaderResizeOut, false, 0, true);
_local25.addEventListener(MouseEvent.MOUSE_DOWN, handleHeaderResizeDown, false, 0, true);
header.addChild(_local25);
dragHandlesMap[_local25] = _local9.colNum;
};
if ((((((_local17 == (_local16 - 1))) && ((_horizontalScrollPosition == 0)))) && ((availableWidth > (_local3 + _local9.width))))){
_local4 = Math.floor((availableWidth - _local3));
_local24.setSize(_local4, headerHeight);
} else {
_local4 = _local9.width;
};
_local24.drawNow();
};
};
_local20 = ((_local9.cellRenderer)!=null) ? _local9.cellRenderer : _cellRenderer;
_local21 = availableCellRenderersMap[_local9];
_local8 = activeCellRenderersMap[_local9];
if (_local8 == null){
_local8 = [];
activeCellRenderersMap[_local9] = _local8;
};
if (_local21 == null){
_local21 = [];
availableCellRenderersMap[_local9] = _local21;
};
_local22 = new Dictionary(true);
while (_local8.length > 0) {
_local7 = _local8.pop();
_local6 = _local7.data;
if ((((_local11[_local6] == null)) || ((invalidItems[_local6] == true)))){
_local21.push(_local7);
} else {
_local22[_local6] = _local7;
invalidItems[_local6] = true;
};
list.removeChild((_local7 as DisplayObject));
};
if (length > 0){
_local5 = _local1;
while (_local5 <= _local2) {
_local27 = false;
_local6 = _dataProvider.getItemAt(_local5);
if (_local22[_local6] != null){
_local27 = true;
_local7 = _local22[_local6];
delete _local22[_local6];
} else {
if (_local21.length > 0){
_local7 = (_local21.pop() as ICellRenderer);
} else {
_local7 = (getDisplayObjectInstance(_local20) as ICellRenderer);
_local13 = (_local7 as Sprite);
if (_local13 != null){
_local13.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local13.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local13.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local13.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local13.doubleClickEnabled = true;
_local13.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local13["setStyle"] != null){
for (_local28 in rendererStyles) {
var _local31 = _local13;
_local31["setStyle"](_local28, rendererStyles[_local28]);
};
};
};
};
};
list.addChild((_local7 as Sprite));
_local8.push(_local7);
_local7.x = _local3;
_local7.y = (rowHeight * (_local5 - _local1));
_local7.setSize(((_local17)==(_local16 - 1)) ? _local4 : _local9.width, rowHeight);
if (!_local27){
_local7.data = _local6;
};
_local7.listData = new ListData(columnItemToLabel(_local9.colNum, _local6), null, this, _local5, _local5, _local17);
if (((_local10) && (isHovered(_local7)))){
_local7.setMouseState("over");
currentHoveredRow = _local5;
} else {
_local7.setMouseState("up");
};
_local7.selected = !((_selectedIndices.indexOf(_local5) == -1));
if ((_local7 is UIComponent)){
_local14 = (_local7 as UIComponent);
_local14.drawNow();
};
_local5++;
};
};
_local3 = (_local3 + _local9.width);
_local17++;
};
_local5 = 0;
while (_local5 < _columns.length) {
if (_local15.indexOf(_local5) == -1){
removeCellRenderersByColumn((_columns[_local5] as DataGridColumn));
};
_local5++;
};
if (editedItemPositionChanged){
editedItemPositionChanged = false;
commitEditedItemPosition(proposedEditedItemPosition);
proposedEditedItemPosition = undefined;
};
invalidItems = new Dictionary(true);
}
protected function itemEditorItemEditBeginningHandler(_arg1:DataGridEvent):void{
if (!_arg1.isDefaultPrevented()){
setEditedItemPosition({columnIndex:_arg1.columnIndex, rowIndex:uint(_arg1.rowIndex)});
} else {
if (!itemEditorInstance){
_editedItemPosition = null;
editable = false;
setFocus();
editable = true;
};
};
}
protected function itemEditorItemEditEndHandler(_arg1:DataGridEvent):void{
var _local2:Boolean;
var _local3:Object;
var _local4:String;
var _local5:Object;
var _local6:String;
var _local7:XML;
var _local8:IFocusManager;
if (!_arg1.isDefaultPrevented()){
_local2 = false;
if (((itemEditorInstance) && (!((_arg1.reason == DataGridEventReason.CANCELLED))))){
_local3 = itemEditorInstance[_columns[_arg1.columnIndex].editorDataField];
_local4 = _columns[_arg1.columnIndex].dataField;
_local5 = _arg1.itemRenderer.data;
_local6 = "";
for each (_local7 in describeType(_local5).variable) {
if (_local4 == _local7.@name.toString()){
_local6 = _local7.@type.toString();
break;
};
};
switch (_local6){
case "String":
if (!(_local3 is String)){
_local3 = _local3.toString();
};
break;
case "uint":
if (!(_local3 is uint)){
_local3 = uint(_local3);
};
break;
case "int":
if (!(_local3 is int)){
_local3 = int(_local3);
};
break;
case "Number":
if (!(_local3 is Number)){
_local3 = Number(_local3);
};
break;
};
if (_local5[_local4] != _local3){
_local2 = true;
_local5[_local4] = _local3;
};
_arg1.itemRenderer.data = _local5;
};
} else {
if (_arg1.reason != DataGridEventReason.OTHER){
if (((itemEditorInstance) && (_editedItemPosition))){
if (selectedIndex != _editedItemPosition.rowIndex){
selectedIndex = _editedItemPosition.rowIndex;
};
_local8 = focusManager;
if ((itemEditorInstance is IFocusManagerComponent)){
_local8.setFocus(InteractiveObject(itemEditorInstance));
};
};
};
};
if ((((_arg1.reason == DataGridEventReason.OTHER)) || (!(_arg1.isDefaultPrevented())))){
destroyItemEditor();
};
}
public function get editedItemPosition():Object{
if (_editedItemPosition){
return ({rowIndex:_editedItemPosition.rowIndex, columnIndex:_editedItemPosition.columnIndex});
};
return (_editedItemPosition);
}
protected function setEditedItemPosition(_arg1:Object):void{
editedItemPositionChanged = true;
proposedEditedItemPosition = _arg1;
if (((_arg1) && (!((_arg1.rowIndex == selectedIndex))))){
selectedIndex = _arg1.rowIndex;
};
invalidate(InvalidationType.DATA);
}
public function set headerHeight(_arg1:Number):void{
maxHeaderHeight = _arg1;
_headerHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
protected function handleHeaderResizeDown(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:Number;
var _local4:DataGridColumn;
_local2 = (_arg1.currentTarget as Sprite);
_local3 = dragHandlesMap[_local2];
_local4 = getColumnAt(_local3);
columnStretchIndex = _local3;
columnStretchStartX = _arg1.stageX;
columnStretchStartWidth = _local4.width;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleHeaderResizeMove, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, handleHeaderResizeUp, false, 0, true);
}
protected function deactivateHandler(_arg1:Event):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
losingFocus = true;
setFocus();
};
}
protected function keyFocusChangeHandler(_arg1:FocusEvent):void{
if ((((((_arg1.keyCode == Keyboard.TAB)) && (!(_arg1.isDefaultPrevented())))) && (findNextItemRenderer(_arg1.shiftKey)))){
_arg1.preventDefault();
};
}
override protected function handleDataChange(_arg1:DataChangeEvent):void{
super.handleDataChange(_arg1);
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
}
public function set editedItemPosition(_arg1:Object):void{
var _local2:Object;
_local2 = {rowIndex:_arg1.rowIndex, columnIndex:_arg1.columnIndex};
setEditedItemPosition(_local2);
}
override public function itemToCellRenderer(_arg1:Object):ICellRenderer{
return (null);
}
public function getCellRendererAt(_arg1:uint, _arg2:uint):ICellRenderer{
var _local3:DataGridColumn;
var _local4:Array;
var _local5:uint;
var _local6:ICellRenderer;
_local3 = (_columns[_arg2] as DataGridColumn);
if (_local3 != null){
_local4 = (activeCellRenderersMap[_local3] as Array);
if (_local4 != null){
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = (_local4[_local5] as ICellRenderer);
if (_local6.listData.row == _arg1){
return (_local6);
};
_local5++;
};
};
};
return (null);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (((!(selectable)) || (itemEditorInstance))){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
scrollToIndex(caretIndex);
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
break;
default:
break;
};
_arg1.stopPropagation();
}
protected function handleHeaderResizeUp(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:DataGridColumn;
var _local4:HeaderRenderer;
var _local5:uint;
var _local6:DataGridEvent;
_local2 = (_arg1.currentTarget as Sprite);
_local3 = (_columns[columnStretchIndex] as DataGridColumn);
_local5 = 0;
while (_local5 < header.numChildren) {
_local4 = (header.getChildAt(_local5) as HeaderRenderer);
if (((_local4) && ((_local4.column == columnStretchIndex)))){
break;
};
_local5++;
};
_local6 = new DataGridEvent(DataGridEvent.COLUMN_STRETCH, false, true, columnStretchIndex, -1, _local4, (_local3) ? _local3.dataField : null);
dispatchEvent(_local6);
columnStretchIndex = -1;
showColumnStretchCursor(false);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleHeaderResizeMove, false);
stage.removeEventListener(MouseEvent.MOUSE_UP, handleHeaderResizeUp, false);
}
protected function handleHeaderResizeOver(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor();
};
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:Boolean;
var _local3:DataGridColumn;
if (_arg1.target != this){
return;
};
if (losingFocus){
losingFocus = false;
return;
};
setIMEMode(true);
super.focusInHandler(_arg1);
if (((editable) && (!(isPressed)))){
_local2 = !((editedItemPosition == null));
if (!_editedItemPosition){
_editedItemPosition = {rowIndex:0, columnIndex:0};
while (_editedItemPosition.columnIndex < _columns.length) {
_local3 = (_columns[_editedItemPosition.columnIndex] as DataGridColumn);
if (((_local3.editable) && (_local3.visible))){
_local2 = true;
break;
};
_editedItemPosition.columnIndex++;
};
};
if (_local2){
setEditedItemPosition(_editedItemPosition);
};
};
if (editable){
addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
addEventListener(MouseEvent.MOUSE_DOWN, mouseFocusChangeHandler);
};
}
public function createItemEditor(_arg1:uint, _arg2:uint):void{
var _local3:DataGridColumn;
var _local4:ICellRenderer;
var _local5:Sprite;
var _local6:int;
if (displayableColumns.length != _columns.length){
_local6 = 0;
while (_local6 < displayableColumns.length) {
if (displayableColumns[_local6].colNum >= _arg1){
_arg1 = displayableColumns[_local6].colNum;
break;
};
_local6++;
};
if (_local6 == displayableColumns.length){
_arg1 = 0;
};
};
_local3 = (_columns[_arg1] as DataGridColumn);
_local4 = getCellRendererAt(_arg2, _arg1);
if (!itemEditorInstance){
itemEditorInstance = getDisplayObjectInstance(_local3.itemEditor);
itemEditorInstance.tabEnabled = false;
list.addChild(DisplayObject(itemEditorInstance));
};
list.setChildIndex(DisplayObject(itemEditorInstance), (list.numChildren - 1));
_local5 = (_local4 as Sprite);
itemEditorInstance.visible = true;
itemEditorInstance.move(_local5.x, _local5.y);
itemEditorInstance.setSize(_local3.width, rowHeight);
itemEditorInstance.drawNow();
DisplayObject(itemEditorInstance).addEventListener(FocusEvent.FOCUS_OUT, itemEditorFocusOutHandler);
_local5.visible = false;
DisplayObject(itemEditorInstance).addEventListener(KeyboardEvent.KEY_DOWN, editorKeyDownHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, editorMouseDownHandler, true, 0, true);
}
private function itemEditorFocusOutHandler(_arg1:FocusEvent):void{
if (((_arg1.relatedObject) && (contains(_arg1.relatedObject)))){
return;
};
if (!_arg1.relatedObject){
return;
};
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
}
override public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
override protected function updateRendererStyles():void{
var _local1:Array;
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:String;
_local1 = [];
for (_local2 in availableCellRenderersMap) {
_local1 = _local1.concat(availableCellRenderersMap[_local2]);
};
for (_local2 in activeCellRenderersMap) {
_local1 = _local1.concat(activeCellRenderersMap[_local2]);
};
_local3 = _local1.length;
_local4 = 0;
while (_local4 < _local3) {
if (_local1[_local4]["setStyle"] == null){
} else {
for (_local5 in updatedRendererStyles) {
_local1[_local4].setStyle(_local5, updatedRendererStyles[_local5]);
};
_local1[_local4].drawNow();
};
_local4++;
};
updatedRendererStyles = {};
}
public function set minColumnWidth(_arg1:Number):void{
_minColumnWidth = _arg1;
columnsInvalid = true;
minColumnWidthInvalid = true;
invalidate(InvalidationType.SIZE);
}
protected function showColumnStretchCursor(_arg1:Boolean=true):void{
if (columnStretchCursor == null){
columnStretchCursor = (getDisplayObjectInstance(getStyleValue("columnStretchCursorSkin")) as Sprite);
columnStretchCursor.mouseEnabled = false;
};
if (_arg1){
Mouse.hide();
stage.addChild(columnStretchCursor);
stage.addEventListener(MouseEvent.MOUSE_MOVE, positionColumnStretchCursor, false, 0, true);
columnStretchCursor.x = stage.mouseX;
columnStretchCursor.y = stage.mouseY;
} else {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, positionColumnStretchCursor, false);
if (stage.contains(columnStretchCursor)){
stage.removeChild(columnStretchCursor);
};
Mouse.show();
};
}
protected function findNextEnterItemRenderer(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:DataGridEvent;
if (proposedEditedItemPosition !== undefined){
return;
};
_local2 = _editedItemPosition.rowIndex;
_local3 = _editedItemPosition.columnIndex;
_local4 = (_editedItemPosition.rowIndex + (_arg1.shiftKey) ? -1 : 1);
if ((((_local4 >= 0)) && ((_local4 < length)))){
_local2 = _local4;
};
_local5 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local3, _local2);
_local5.dataField = _columns[_local3].dataField;
dispatchEvent(_local5);
}
protected function mouseFocusChangeHandler(_arg1:MouseEvent):void{
if (((((itemEditorInstance) && (!(_arg1.isDefaultPrevented())))) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
_arg1.preventDefault();
};
}
public function get imeMode():String{
return (_imeMode);
}
public function editField(_arg1:uint, _arg2:String, _arg3:Object):void{
var _local4:Object;
_local4 = getItemAt(_arg1);
_local4[_arg2] = _arg3;
replaceItemAt(_local4, _arg1);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
var _local2:Number;
_local1 = Number(getStyleValue("contentPadding"));
_local2 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
return ((((height - (_local1 * 2)) - _local2) - (showHeaders) ? headerHeight : 0));
}
protected function mouseUpHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = false;
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function resizeColumn(_arg1:int, _arg2:Number):void{
var _local3:DataGridColumn;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:DataGridColumn;
var _local8:DataGridColumn;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Number;
if (_columns.length == 0){
return;
};
_local3 = (_columns[_arg1] as DataGridColumn);
if (!_local3){
return;
};
if (((!(visibleColumns)) || ((visibleColumns.length == 0)))){
_local3.setWidth(_arg2);
return;
};
if (_arg2 < _local3.minWidth){
_arg2 = _local3.minWidth;
};
if ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((_horizontalScrollPolicy == ScrollPolicy.AUTO)))){
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
} else {
_local4 = getVisibleColumnIndex(_local3);
if (_local4 != -1){
_local5 = 0;
_local6 = visibleColumns.length;
_local9 = (_local4 + 1);
while (_local9 < _local6) {
_local7 = (visibleColumns[_local9] as DataGridColumn);
if (((_local7) && (_local7.resizable))){
_local5 = (_local5 + _local7.width);
};
_local9++;
};
_local11 = ((_local3.width - _arg2) + _local5);
if (_local5){
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
};
_local12 = 0;
_local9 = (_local4 + 1);
while (_local9 < _local6) {
_local7 = (visibleColumns[_local9] as DataGridColumn);
if (_local7.resizable){
_local10 = ((_local7.width * _local11) / _local5);
if (_local10 < _local7.minWidth){
_local10 = _local7.minWidth;
};
_local7.setWidth(_local10);
_local12 = (_local12 + _local7.width);
_local8 = _local7;
};
_local9++;
};
if (_local12 > _local11){
_local10 = ((_local3.width - _local12) + _local11);
if (_local10 < _local3.minWidth){
_local10 = _local3.minWidth;
};
_local3.setWidth(_local10);
} else {
if (_local8){
_local8.setWidth(((_local8.width - _local12) + _local11));
};
};
} else {
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
};
};
columnsInvalid = true;
invalidate(InvalidationType.SIZE);
}
protected function itemEditorItemEditBeginHandler(_arg1:DataGridEvent):void{
var _local2:IFocusManager;
if (stage){
stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
};
if (!_arg1.isDefaultPrevented()){
createItemEditor(_arg1.columnIndex, uint(_arg1.rowIndex));
ICellRenderer(itemEditorInstance).listData = ICellRenderer(editedItemRenderer).listData;
ICellRenderer(itemEditorInstance).data = editedItemRenderer.data;
itemEditorInstance.imeMode = ((columns[_arg1.columnIndex].imeMode)==null) ? _imeMode : columns[_arg1.columnIndex].imeMode;
_local2 = focusManager;
if ((itemEditorInstance is IFocusManagerComponent)){
_local2.setFocus(InteractiveObject(itemEditorInstance));
};
_local2.defaultButtonEnabled = false;
_arg1 = new DataGridEvent(DataGridEvent.ITEM_FOCUS_IN, false, false, _editedItemPosition.columnIndex, _editedItemPosition.rowIndex, itemEditorInstance);
dispatchEvent(_arg1);
};
}
override protected function draw():void{
var _local1:Boolean;
_local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (((!((_cellRenderer == getStyleValue("cellRenderer")))) || (!((_headerRenderer == getStyleValue("headerRenderer")))))){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
_headerRenderer = getStyleValue("headerRenderer");
};
};
if (isInvalid(InvalidationType.SIZE)){
columnsInvalid = true;
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
drawDisabledOverlay();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override public function set horizontalScrollPolicy(_arg1:String):void{
super.horizontalScrollPolicy = _arg1;
columnsInvalid = true;
}
protected function getVisibleColumnIndex(_arg1:DataGridColumn):int{
var _local2:uint;
_local2 = 0;
while (_local2 < visibleColumns.length) {
if (_arg1 == visibleColumns[_local2]){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function itemRendererContains(_arg1:Object, _arg2:DisplayObject):Boolean{
if (((((!(_arg2)) || (!(_arg1)))) || (!((_arg1 is DisplayObjectContainer))))){
return (false);
};
return (DisplayObjectContainer(_arg1).contains(_arg2));
}
override protected function configUI():void{
var _local1:Graphics;
useFixedHorizontalScrolling = false;
super.configUI();
headerMask = new Sprite();
_local1 = headerMask.graphics;
_local1.beginFill(0, 0.3);
_local1.drawRect(0, 0, 100, 100);
_local1.endFill();
headerMask.visible = false;
addChild(headerMask);
header = new Sprite();
addChild(header);
header.mask = headerMask;
_horizontalScrollPolicy = ScrollPolicy.OFF;
_verticalScrollPolicy = ScrollPolicy.AUTO;
}
public function columnItemToLabel(_arg1:uint, _arg2:Object):String{
var _local3:DataGridColumn;
_local3 = (_columns[_arg1] as DataGridColumn);
if (_local3 != null){
return (_local3.itemToLabel(_arg2));
};
return (" ");
}
protected function endEdit(_arg1:String):Boolean{
var _local2:DataGridEvent;
if (!editedItemRenderer){
return (true);
};
_local2 = new DataGridEvent(DataGridEvent.ITEM_EDIT_END, false, true, editedItemPosition.columnIndex, editedItemPosition.rowIndex, editedItemRenderer, _columns[editedItemPosition.columnIndex].dataField, _arg1);
dispatchEvent(_local2);
return (!(_local2.isDefaultPrevented()));
}
override protected function drawLayout():void{
vOffset = (showHeaders) ? headerHeight : 0;
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
if (showHeaders){
headerHeight = maxHeaderHeight;
if (Math.floor((availableHeight - headerHeight)) <= 0){
_headerHeight = availableHeight;
};
list.y = headerHeight;
contentScrollRect = listHolder.scrollRect;
contentScrollRect.y = (contentPadding + headerHeight);
contentScrollRect.height = (availableHeight - headerHeight);
listHolder.y = (contentPadding + headerHeight);
headerMask.x = contentPadding;
headerMask.y = contentPadding;
headerMask.width = availableWidth;
headerMask.height = headerHeight;
} else {
contentScrollRect.y = contentPadding;
listHolder.y = 0;
};
listHolder.scrollRect = contentScrollRect;
}
protected function commitEditedItemPosition(_arg1:Object):void{
var _local2:ICellRenderer;
var _local3:DataGridEvent;
var _local4:String;
var _local5:int;
if (((!(enabled)) || (!(editable)))){
return;
};
if (((((((((itemEditorInstance) && (_arg1))) && ((itemEditorInstance is IFocusManagerComponent)))) && ((_editedItemPosition.rowIndex == _arg1.rowIndex)))) && ((_editedItemPosition.columnIndex == _arg1.columnIndex)))){
IFocusManagerComponent(itemEditorInstance).setFocus();
return;
};
if (itemEditorInstance){
if (!_arg1){
_local4 = DataGridEventReason.OTHER;
} else {
if (((!(editedItemPosition)) || ((_arg1.rowIndex == editedItemPosition.rowIndex)))){
_local4 = DataGridEventReason.NEW_COLUMN;
} else {
_local4 = DataGridEventReason.NEW_ROW;
};
};
if (((!(endEdit(_local4))) && (!((_local4 == DataGridEventReason.OTHER))))){
return;
};
};
_editedItemPosition = _arg1;
if (!_arg1){
return;
};
actualRowIndex = _arg1.rowIndex;
actualColIndex = _arg1.columnIndex;
if (displayableColumns.length != _columns.length){
_local5 = 0;
while (_local5 < displayableColumns.length) {
if (displayableColumns[_local5].colNum >= actualColIndex){
actualColIndex = displayableColumns[_local5].colNum;
break;
};
_local5++;
};
if (_local5 == displayableColumns.length){
actualColIndex = 0;
};
};
scrollToPosition(actualRowIndex, actualColIndex);
_local2 = getCellRendererAt(actualRowIndex, actualColIndex);
_local3 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGIN, false, true, actualColIndex, actualRowIndex, _local2);
dispatchEvent(_local3);
if (editedItemPositionChanged){
editedItemPositionChanged = false;
commitEditedItemPosition(proposedEditedItemPosition);
proposedEditedItemPosition = undefined;
};
if (!itemEditorInstance){
commitEditedItemPosition(null);
};
}
protected function handleHeaderRendererClick(_arg1:MouseEvent):void{
var _local2:HeaderRenderer;
var _local3:uint;
var _local4:DataGridColumn;
var _local5:uint;
var _local6:DataGridEvent;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as HeaderRenderer);
_local3 = _local2.column;
_local4 = (_columns[_local3] as DataGridColumn);
if (((sortableColumns) && (_local4.sortable))){
_local5 = _sortIndex;
_sortIndex = _local3;
_local6 = new DataGridEvent(DataGridEvent.HEADER_RELEASE, false, true, _local3, -1, _local2, (_local4) ? _local4.dataField : null);
if (((!(dispatchEvent(_local6))) || (!(_selectable)))){
_sortIndex = lastSortIndex;
return;
};
lastSortIndex = _local5;
sortByColumn(_local3);
invalidate(InvalidationType.DATA);
};
}
public function get showHeaders():Boolean{
return (_showHeaders);
}
public function get sortIndex():int{
return (_sortIndex);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function getColumnIndex(_arg1:String):int{
var _local2:uint;
var _local3:DataGridColumn;
_local2 = 0;
while (_local2 < _columns.length) {
_local3 = (_columns[_local2] as DataGridColumn);
if (_local3.dataField == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function createColumnsFromDataProvider():void{
var _local1:Object;
var _local2:String;
_columns = [];
if (length > 0){
_local1 = _dataProvider.getItemAt(0);
for (_local2 in _local1) {
addColumn(_local2);
};
};
}
protected function editorMouseDownHandler(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))){
if ((((_arg1.target is ICellRenderer)) && (contains(DisplayObject(_arg1.target))))){
_local2 = (_arg1.target as ICellRenderer);
_local3 = _local2.listData.row;
if (_editedItemPosition.rowIndex == _local3){
endEdit(DataGridEventReason.NEW_COLUMN);
} else {
endEdit(DataGridEventReason.NEW_ROW);
};
} else {
endEdit(DataGridEventReason.OTHER);
};
};
}
public function addColumnAt(_arg1, _arg2:uint):DataGridColumn{
var _local3:DataGridColumn;
var _local4:*;
var _local5:uint;
if (_arg2 < _columns.length){
_columns.splice(_arg2, 0, "");
_local5 = (_arg2 + 1);
while (_local5 < _columns.length) {
_local3 = (_columns[_local5] as DataGridColumn);
_local3.colNum = _local5;
_local5++;
};
};
_local4 = _arg1;
if (!(_local4 is DataGridColumn)){
if ((_local4 is String)){
_local4 = new DataGridColumn(_local4);
} else {
_local4 = new DataGridColumn();
};
};
_local3 = (_local4 as DataGridColumn);
_local3.owner = this;
_local3.colNum = _arg2;
_columns[_arg2] = _local3;
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
return (_local3);
}
public function destroyItemEditor():void{
var _local1:DataGridEvent;
if (itemEditorInstance){
DisplayObject(itemEditorInstance).removeEventListener(KeyboardEvent.KEY_DOWN, editorKeyDownHandler);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, editorMouseDownHandler, true);
_local1 = new DataGridEvent(DataGridEvent.ITEM_FOCUS_OUT, false, false, _editedItemPosition.columnIndex, _editedItemPosition.rowIndex, itemEditorInstance);
dispatchEvent(_local1);
if (((itemEditorInstance) && ((itemEditorInstance is UIComponent)))){
UIComponent(itemEditorInstance).drawFocus(false);
};
list.removeChild(DisplayObject(itemEditorInstance));
DisplayObject(editedItemRenderer).visible = true;
itemEditorInstance = null;
};
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
if (_arg3){
caretIndex = _arg1;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
public function get headerHeight():Number{
return (_headerHeight);
}
public function getColumnCount():uint{
return (_columns.length);
}
protected function sortByColumn(_arg1:int):void{
var _local2:DataGridColumn;
var _local3:Boolean;
var _local4:uint;
_local2 = (columns[_arg1] as DataGridColumn);
if (((((!(enabled)) || (!(_local2)))) || (!(_local2.sortable)))){
return;
};
_local3 = _local2.sortDescending;
_local4 = _local2.sortOptions;
if (_local3){
_local4 = (_local4 | Array.DESCENDING);
} else {
_local4 = (_local4 & ~(Array.DESCENDING));
};
if (_local2.sortCompareFunction != null){
sortItems(_local2.sortCompareFunction, _local4);
} else {
sortItemsOn(_local2.dataField, _local4);
};
_sortDescending = (_local2.sortDescending = !(_local3));
if ((((lastSortIndex >= 0)) && (!((lastSortIndex == sortIndex))))){
_local2 = (columns[lastSortIndex] as DataGridColumn);
if (_local2 != null){
_local2.sortDescending = false;
};
};
}
public function get minColumnWidth():Number{
return (_minColumnWidth);
}
protected function isHovered(_arg1:ICellRenderer):Boolean{
var _local2:uint;
var _local3:Number;
var _local4:Point;
_local2 = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
_local3 = ((_arg1.listData.row - _local2) * rowHeight);
_local4 = list.globalToLocal(new Point(0, stage.mouseY));
return ((((_local4.y > _local3)) && ((_local4.y < (_local3 + rowHeight)))));
}
protected function mouseDownHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = true;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
header.mouseChildren = _enabled;
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
protected function handleHeaderResizeOut(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor(false);
};
}
public function removeAllColumns():void{
if (_columns.length > 0){
removeCellRenderers();
_columns = [];
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && (hScrollBar))))) ? 15 : 0;
height = ((((rowHeight * _arg1) + (2 * _local2)) + _local3) + (showHeaders) ? headerHeight : 0);
}
protected function removeCellRenderers():void{
var _local1:uint;
_local1 = 0;
while (_local1 < _columns.length) {
removeCellRenderersByColumn((_columns[_local1] as DataGridColumn));
_local1++;
};
}
public function removeColumnAt(_arg1:uint):DataGridColumn{
var _local2:DataGridColumn;
var _local3:uint;
_local2 = (_columns[_arg1] as DataGridColumn);
if (_local2 != null){
removeCellRenderersByColumn(_local2);
_columns.splice(_arg1, 1);
_local3 = _arg1;
while (_local3 < _columns.length) {
_local2 = (_columns[_local3] as DataGridColumn);
if (_local2){
_local2.colNum = _local3;
};
_local3++;
};
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
return (_local2);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (_arg1 == _horizontalScrollPosition){
return;
};
contentScrollRect = listHolder.scrollRect;
contentScrollRect.x = _arg1;
listHolder.scrollRect = contentScrollRect;
list.x = 0;
header.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
invalidate(InvalidationType.SCROLL);
columnsInvalid = true;
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:DataGridColumn;
var _local4:DataGridEvent;
super.handleCellRendererClick(_arg1);
_local2 = (_arg1.currentTarget as ICellRenderer);
if (((((_local2) && (_local2.data))) && (!((_local2 == itemEditorInstance))))){
_local3 = (_columns[_local2.listData.column] as DataGridColumn);
if (((((editable) && (_local3))) && (_local3.editable))){
_local4 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local2.listData.column, _local2.listData.row, _local2, _local3.dataField);
dispatchEvent(_local4);
};
};
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
setIMEMode(false);
if (_arg1.target == this){
super.focusOutHandler(_arg1);
};
if ((((_arg1.relatedObject == this)) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
return;
};
if ((((_arg1.relatedObject == null)) && (itemRendererContains(editedItemRenderer, DisplayObject(_arg1.target))))){
return;
};
if ((((_arg1.relatedObject == null)) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
return;
};
if (((itemEditorInstance) && (((!(_arg1.relatedObject)) || (!(itemRendererContains(itemEditorInstance, _arg1.relatedObject))))))){
endEdit(DataGridEventReason.OTHER);
removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
removeEventListener(MouseEvent.MOUSE_DOWN, mouseFocusChangeHandler);
};
}
protected function positionColumnStretchCursor(_arg1:MouseEvent):void{
columnStretchCursor.x = _arg1.stageX;
columnStretchCursor.y = _arg1.stageY;
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
public function get sortDescending():Boolean{
return (_sortDescending);
}
protected function editorKeyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ESCAPE){
endEdit(DataGridEventReason.CANCELLED);
} else {
if (((_arg1.ctrlKey) && ((_arg1.charCode == 46)))){
endEdit(DataGridEventReason.CANCELLED);
} else {
if ((((_arg1.charCode == Keyboard.ENTER)) && (!((_arg1.keyCode == 229))))){
if (endEdit(DataGridEventReason.NEW_ROW)){
findNextEnterItemRenderer(_arg1);
};
};
};
};
}
override protected function calculateContentWidth():void{
var _local1:int;
var _local2:int;
var _local3:DataGridColumn;
if (_columns.length == 0){
contentWidth = 0;
return;
};
if (minColumnWidthInvalid){
_local1 = _columns.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = (_columns[_local2] as DataGridColumn);
_local3.minWidth = minColumnWidth;
_local2++;
};
minColumnWidthInvalid = false;
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
contentWidth = availableWidth;
} else {
contentWidth = 0;
_local1 = _columns.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = (_columns[_local2] as DataGridColumn);
if (_local3.visible){
contentWidth = (contentWidth + _local3.width);
};
_local2++;
};
if (((!(isNaN(_horizontalScrollPosition))) && (((_horizontalScrollPosition + availableWidth) > contentWidth)))){
setHorizontalScrollPosition((contentWidth - availableWidth));
};
};
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
public function addColumn(_arg1):DataGridColumn{
return (addColumnAt(_arg1, _columns.length));
}
protected function removeCellRenderersByColumn(_arg1:DataGridColumn):void{
var _local2:Array;
if (_arg1 == null){
return;
};
_local2 = activeCellRenderersMap[_arg1];
if (_local2 != null){
while (_local2.length > 0) {
list.removeChild((_local2.pop() as DisplayObject));
};
};
}
override protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:int;
var _local4:String;
var _local5:uint;
var _local6:DataGridColumn;
var _local7:ICellRenderer;
_local2 = (_arg1.target as ICellRenderer);
if (_local2){
_local3 = _local2.listData.row;
if (_arg1.type == MouseEvent.ROLL_OVER){
_local4 = "over";
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
_local4 = "up";
};
};
if (_local4){
_local5 = 0;
while (_local5 < visibleColumns.length) {
_local6 = (visibleColumns[_local5] as DataGridColumn);
_local7 = getCellRendererAt(_local3, _local6.colNum);
if (_local7){
_local7.setMouseState(_local4);
};
if (_local3 != currentHoveredRow){
_local7 = getCellRendererAt(currentHoveredRow, _local6.colNum);
if (_local7){
_local7.setMouseState("up");
};
};
_local5++;
};
};
};
super.handleCellRendererMouseEvent(_arg1);
}
protected function handleHeaderResizeMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_arg1.stageX - columnStretchStartX);
_local3 = (columnStretchStartWidth + _local2);
resizeColumn(columnStretchIndex, _local3);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
protected function scrollToPosition(_arg1:int, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Number;
var _local7:DataGridColumn;
var _local8:DataGridColumn;
_local3 = verticalScrollPosition;
_local4 = horizontalScrollPosition;
scrollToIndex(_arg1);
_local6 = 0;
_local7 = (_columns[_arg2] as DataGridColumn);
_local5 = 0;
while (_local5 < displayableColumns.length) {
_local8 = (displayableColumns[_local5] as DataGridColumn);
if (_local8 != _local7){
_local6 = (_local6 + _local8.width);
} else {
break;
};
_local5++;
};
if (horizontalScrollPosition > _local6){
horizontalScrollPosition = _local6;
} else {
if ((horizontalScrollPosition + availableWidth) < (_local6 + _local7.width)){
horizontalScrollPosition = -((availableWidth - (_local6 + _local7.width)));
};
};
if (((!((_local3 == verticalScrollPosition))) || (!((_local4 == horizontalScrollPosition))))){
drawNow();
};
}
protected function findNextItemRenderer(_arg1:Boolean):Boolean{
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:DataGridEvent;
if (!_editedItemPosition){
return (false);
};
if (proposedEditedItemPosition !== undefined){
return (false);
};
_local2 = _editedItemPosition.rowIndex;
_local3 = _editedItemPosition.columnIndex;
_local4 = false;
_local5 = (_arg1) ? -1 : 1;
_local6 = (length - 1);
while (!(_local4)) {
_local3 = (_local3 + _local5);
if ((((_local3 < 0)) || ((_local3 >= _columns.length)))){
_local3 = ((_local3)<0) ? (_columns.length - 1) : 0;
_local2 = (_local2 + _local5);
if ((((_local2 < 0)) || ((_local2 > _local6)))){
setEditedItemPosition(null);
losingFocus = true;
setFocus();
return (false);
};
};
if (((_columns[_local3].editable) && (_columns[_local3].visible))){
_local4 = true;
if (_local2 == _editedItemPosition.rowIndex){
_local7 = DataGridEventReason.NEW_COLUMN;
} else {
_local7 = DataGridEventReason.NEW_ROW;
};
if (((!(itemEditorInstance)) || (endEdit(_local7)))){
_local8 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local3, _local2);
_local8.dataField = _columns[_local3].dataField;
dispatchEvent(_local8);
};
};
};
return (_local4);
}
override public function set dataProvider(_arg1:DataProvider):void{
super.dataProvider = _arg1;
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
removeCellRenderers();
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
columnsInvalid = true;
}
override public function scrollToIndex(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:Number;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 >= _local2){
_local4 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && (hScrollBar))))) ? 15 : 0;
verticalScrollPosition = (((((_arg1 + 1) * rowHeight) - availableHeight) + _local4) + (showHeaders) ? headerHeight : 0);
};
};
}
protected function calculateColumnSizes():void{
var _local1:Number;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:DataGridColumn;
var _local6:DataGridColumn;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local4 = 0;
if (_columns.length == 0){
visibleColumns = [];
displayableColumns = [];
return;
};
if (columnsInvalid){
columnsInvalid = false;
visibleColumns = [];
if (minColumnWidthInvalid){
_local2 = _columns.length;
_local3 = 0;
while (_local3 < _local2) {
_columns[_local3].minWidth = minColumnWidth;
_local3++;
};
minColumnWidthInvalid = false;
};
displayableColumns = null;
_local2 = _columns.length;
_local3 = 0;
while (_local3 < _local2) {
if (((displayableColumns) && (_columns[_local3].visible))){
displayableColumns.push(_columns[_local3]);
} else {
if (((!(displayableColumns)) && (!(_columns[_local3].visible)))){
displayableColumns = new Array(_local3);
_local8 = 0;
while (_local8 < _local3) {
displayableColumns[_local8] = _columns[_local8];
_local8++;
};
};
};
_local3++;
};
if (!displayableColumns){
displayableColumns = _columns;
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
_local2 = displayableColumns.length;
_local3 = 0;
while (_local3 < _local2) {
visibleColumns.push(displayableColumns[_local3]);
_local3++;
};
} else {
_local2 = displayableColumns.length;
_local9 = 0;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (displayableColumns[_local3] as DataGridColumn);
if (((((_local9 + _local5.width) > _horizontalScrollPosition)) && ((_local9 < (_horizontalScrollPosition + availableWidth))))){
visibleColumns.push(_local5);
};
_local9 = (_local9 + _local5.width);
_local3++;
};
};
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
_local10 = 0;
_local11 = 0;
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (visibleColumns[_local3] as DataGridColumn);
if (_local5.resizable){
if (!isNaN(_local5.explicitWidth)){
_local11 = (_local11 + _local5.width);
} else {
_local10++;
_local11 = (_local11 + _local5.minWidth);
};
} else {
_local11 = (_local11 + _local5.width);
};
_local4 = (_local4 + _local5.width);
_local3++;
};
_local13 = availableWidth;
if ((((availableWidth > _local11)) && (_local10))){
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (visibleColumns[_local3] as DataGridColumn);
if (((_local5.resizable) && (isNaN(_local5.explicitWidth)))){
_local6 = _local5;
if (_local4 > availableWidth){
_local12 = ((_local6.width - _local6.minWidth) / (_local4 - _local11));
} else {
_local12 = (_local6.width / _local4);
};
_local7 = (_local6.width - ((_local4 - availableWidth) * _local12));
_local14 = _local5.minWidth;
_local5.setWidth(Math.max(_local7, _local14));
};
_local13 = (_local13 - _local5.width);
_local3++;
};
if (((_local13) && (_local6))){
_local6.setWidth((_local6.width + _local13));
};
} else {
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local6 = (visibleColumns[_local3] as DataGridColumn);
_local12 = (_local6.width / _local4);
_local7 = (availableWidth * _local12);
_local6.setWidth(_local7);
_local6.explicitWidth = NaN;
_local13 = (_local13 - _local7);
_local3++;
};
if (((_local13) && (_local6))){
_local6.setWidth((_local6.width + _local13));
};
};
};
}
public function set showHeaders(_arg1:Boolean):void{
_showHeaders = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function initializeAccessibility():void{
if (DataGrid.createAccessibilityImplementation != null){
DataGrid.createAccessibilityImplementation(this);
};
}
public function getColumnAt(_arg1:uint):DataGridColumn{
return ((_columns[_arg1] as DataGridColumn));
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set columns(_arg1:Array):void{
var _local2:uint;
removeCellRenderers();
_columns = [];
_local2 = 0;
while (_local2 < _arg1.length) {
addColumn(_arg1[_local2]);
_local2++;
};
}
public function get editedItemRenderer():ICellRenderer{
if (!itemEditorInstance){
return (null);
};
return (getCellRendererAt(actualRowIndex, actualColIndex));
}
public function get columns():Array{
return (_columns.slice(0));
}
public function spaceColumnsEqually():void{
var _local1:Number;
var _local2:int;
var _local3:DataGridColumn;
drawNow();
if (displayableColumns.length > 0){
_local1 = (availableWidth / displayableColumns.length);
_local2 = 0;
while (_local2 < displayableColumns.length) {
_local3 = (displayableColumns[_local2] as DataGridColumn);
_local3.width = _local1;
_local2++;
};
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition(), ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 19
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 20
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 21
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 22
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 23
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.utils.*;
import flash.ui.*;
import fl.containers.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 24
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 25
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 26
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 27
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 28
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
//unresolved jump
};
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
throw (new TypeError((("Error: Type Coercion failed: cannot convert " + _arg1) + " to Array or DataProvider.")));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (data.length);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 29
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 30
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 31
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 32
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 33
//DataGridEvent (fl.events.DataGridEvent)
package fl.events {
import flash.events.*;
public class DataGridEvent extends ListEvent {
protected var _itemRenderer:Object;
protected var _reason:String;
protected var _dataField:String;
public static const ITEM_EDIT_BEGIN:String = "itemEditBegin";
public static const ITEM_EDIT_END:String = "itemEditEnd";
public static const ITEM_EDIT_BEGINNING:String = "itemEditBeginning";
public static const HEADER_RELEASE:String = "headerRelease";
public static const ITEM_FOCUS_IN:String = "itemFocusIn";
public static const ITEM_FOCUS_OUT:String = "itemFocusOut";
public static const COLUMN_STRETCH:String = "columnStretch";
public function DataGridEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:Object=null, _arg7:String=null, _arg8:String=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_itemRenderer = _arg6;
_dataField = _arg7;
_reason = _arg8;
}
public function get reason():String{
return (_reason);
}
public function set dataField(_arg1:String):void{
_dataField = _arg1;
}
override public function toString():String{
return (formatToString("DataGridEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "itemRenderer", "dataField", "reason"));
}
public function get dataField():String{
return (_dataField);
}
override public function clone():Event{
return (new DataGridEvent(type, bubbles, cancelable, columnIndex, int(rowIndex), _itemRenderer, _dataField, _reason));
}
public function get itemRenderer():Object{
return (_itemRenderer);
}
}
}//package fl.events
Section 34
//DataGridEventReason (fl.events.DataGridEventReason)
package fl.events {
public final class DataGridEventReason {
public static const OTHER:String = "other";
public static const CANCELLED:String = "cancelled";
public static const NEW_COLUMN:String = "newColumn";
public static const NEW_ROW:String = "newRow";
}
}//package fl.events
Section 35
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 36
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 37
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 38
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 39
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 40
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 41
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 42
//BGM (BGM)
package {
import flash.media.*;
public dynamic class BGM extends Sound {
}
}//package
Section 43
//BombAnim (BombAnim)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
import flash.geom.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
public dynamic class BombAnim extends MovieClip {
public function BombAnim(){
addFrameScript(17, frame18);
}
function frame18(){
CGame.GetInstance().FinishBomb();
}
}
}//package
Section 44
//Bullets (Bullets)
package {
import flash.display.*;
public dynamic class Bullets extends MovieClip {
public var bullet0:MovieClip;
public var bullet1:MovieClip;
}
}//package
Section 45
//CBannedWin (CBannedWin)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
import flash.geom.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
public dynamic class CBannedWin extends MovieClip {
public var mBtn:SimpleButton;
public function CBannedWin(){
addFrameScript(0, frame1);
}
function frame1(){
mBtn.addEventListener(MouseEvent.MOUSE_DOWN, GotoSapi);
}
public function GotoSapi(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.lazybanana.com");
navigateToURL(_local2);
}
}
}//package
Section 46
//CBullet (CBullet)
package {
import flash.display.*;
import flash.events.*;
import com.footloosemoose.particlegenerator.*;
public class CBullet extends MovieClip {
private var mSin:Number;
private var mType:int;
private var mOwner:CHero;
private var mIcon:MovieClip;
private var mCos:Number;
private var mSpeed:Number;
public function CBullet(_arg1:CHero, _arg2:int=1){
var _local3:Bullets;
super();
mOwner = _arg1;
mSpeed = 10;
mType = _arg2;
_local3 = new Bullets();
mIcon = _local3.getChildByName(("bullet" + _arg2));
addChild(mIcon);
mIcon.x = 0;
mIcon.y = 0;
}
public function InitPos(_arg1:Number){
mSin = Math.sin(_arg1);
mCos = Math.cos(_arg1);
rotation = Global.RadToDeg(_arg1);
}
public function AddDispatcher():void{
Main.GetInstance().addEventListener("update", Update, false, 0, true);
}
public function RemoveDispatcher(){
Main.GetInstance().removeEventListener("update", Update);
}
private function Update(_arg1:Event){
var _local2:int;
x = (x + (mSpeed * mCos));
y = (y + (mSpeed * mSin));
if ((x - (this.width / 2)) < 0){
ParticleManager.getInstance().createParticle(3, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
mOwner.KillBullet(this);
return;
};
if ((x + (this.width / 2)) > Global.WORLD_WIDTH){
ParticleManager.getInstance().createParticle(3, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
mOwner.KillBullet(this);
return;
};
if ((y - (this.height / 2)) < 0){
ParticleManager.getInstance().createParticle(3, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
mOwner.KillBullet(this);
return;
};
if ((y + (this.height / 2)) > Global.WORLD_HEIGHT){
ParticleManager.getInstance().createParticle(3, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
mOwner.KillBullet(this);
return;
};
_local2 = 0;
while (_local2 < CGame.GetInstance().mEnemies.length) {
if (CGame.GetInstance().mEnemies[_local2].mInvisibleCounter <= 0){
if (this.hitTestObject(CGame.GetInstance().mEnemies[_local2])){
mOwner.KillBullet(this);
CGame.GetInstance().mEnemies[_local2].Hit(this);
return;
};
};
_local2++;
};
if (this.hitTestObject(CGame.GetInstance().mGravitation)){
if (CGame.GetInstance().mGravitation.active){
CGame.GetInstance().DamageGravitation();
mOwner.KillBullet(this);
return;
};
if (CGame.GetInstance().mGravitation.visible){
mOwner.KillBullet(this);
CGame.GetInstance().StartGravitation();
};
};
}
}
}//package
Section 47
//CCreditWin (CCreditWin)
package {
import flash.display.*;
import flash.events.*;
public class CCreditWin extends MovieClip {
public var mStarBg2:MovieClip;
public var mBackBtn:SimpleButton;
public function CCreditWin(){
InitGrid();
}
private function Back(_arg1:MouseEvent=null):void{
Main.GetInstance().KillCredit();
Main.GetInstance().Init();
}
private function ShowLazySite(_arg1:MouseEvent):void{
Main.openWindow();
}
public function Init(){
var _local1:Sprite;
mBackBtn.addEventListener(MouseEvent.MOUSE_UP, Back, false, 0, true);
if (Main.GetInstance().game.UseLogo()){
_local1 = Main.GetInstance().game.GetLogo(250, 150);
_local1.x = 189;
_local1.y = 244;
this.addChild(_local1);
};
}
private function InitGrid():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Shape;
_local1 = 50;
_local2 = ((Global.STAGE_HEIGHT + 100) / _local1);
_local3 = ((Global.STAGE_WIDTH + 100) / _local1);
_local4 = getChildIndex(mStarBg2);
_local5 = 1;
while (_local5 <= _local2) {
_local6 = 1;
while (_local6 <= _local3) {
_local7 = new Shape();
_local7.graphics.lineStyle(4, 5592473, 0.5, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
_local7.graphics.moveTo(((_local6 - 1) * 50), (_local5 * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local7.graphics.moveTo((_local6 * 50), ((_local5 - 1) * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local6++;
};
_local5++;
};
}
}
}//package
Section 48
//CCrossHair (CCrossHair)
package {
import flash.display.*;
public dynamic class CCrossHair extends MovieClip {
}
}//package
Section 49
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 50
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 51
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 52
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 53
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 54
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 55
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 56
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 57
//CEnemy (CEnemy)
package {
import flash.display.*;
import flash.events.*;
import com.footloosemoose.particlegenerator.*;
import de.polygonal.math.*;
public class CEnemy extends MovieClip {
public var mSnakeBodyCount:int;
public var mInvisibleCounter:int;
public var mInitCounter:int;
private var mAvoidingAngle:Number;
public var mMaster:CEnemy;
public var mSnakeBody:Array;
public var mTail:CEnemy;
public var mType:int;
public var mDirArr:Array;
public var mHp:int;
private var mSnakeBodyCounter:int;
private var mAvoidingBullet:Boolean;
public var mId:int;
public var mHoldCounter:int;
private var mIcon:MovieClip;
private var mTempX:Number;
private var mTempY:Number;
public var mX:Number;
public var mSnakeBodyMaxCount:int;
private var mSpiralAngle:Number;
public var mY:Number;
public var mCounter:int;
private var mSpeed:int;
public var mDir:int;
public var mHead:CEnemy;
static var ID:int = 0;
public function CEnemy(_arg1:int, _arg2:int, _arg3:int){
var _local4:Enemies;
super();
mId = ID;
ID++;
mType = _arg1;
_local4 = new Enemies();
mIcon = _local4.getChildByName(("enemy" + _arg1));
addChild(mIcon);
if (_arg2 == -1){
_arg2 = PM_PRNG.nextIntRange(0, 4);
_arg3 = PM_PRNG.nextIntRange(0, 4);
};
this.x = (((_arg2 * (Global.WORLD_WIDTH - 80)) / 4) + 50);
this.y = (((_arg3 * (Global.WORLD_HEIGHT - 80)) / 4) + 50);
mIcon.x = 0;
mIcon.y = 0;
mInvisibleCounter = 80;
mX = x;
mY = y;
mHead = null;
}
private function GetNewKotakPos(){
var _local1:Boolean;
_local1 = false;
while (!(_local1)) {
mDir = PM_PRNG.nextIntRange(0, 3);
if (mType != 5){
_local1 = true;
break;
};
if (!mTail){
_local1 = true;
} else {
if (!(((((((((mDir == 0)) && ((mTail.mDir == 1)))) || ((((mDir == 1)) && ((mTail.mDir == 0)))))) || ((((mDir == 2)) && ((mTail.mDir == 3)))))) || ((((mDir == 3)) && ((mTail.mDir == 2)))))){
_local1 = true;
};
};
};
mCounter = PM_PRNG.nextIntRange(60, 120);
if (mType == 5){
mInitCounter = mCounter;
mDirArr.push({dir:mDir, counter:mInitCounter});
};
}
public function AddDispatcher():void{
Main.GetInstance().addEventListener("update", Update, false, 0, true);
}
private function MoveSeek(){
var _local1:Number;
_local1 = Global.AngleOfTwoLines(CGame.GetInstance().mHero.x, CGame.GetInstance().mHero.y, x, y);
mX = (mX + (mSpeed * Math.cos(_local1)));
mY = (mY + (mSpeed * Math.sin(_local1)));
this.x = mX;
this.y = mY;
}
private function IsAvoidingEnough():void{
var _local1:CHero;
var _local2:int;
var _local3:Number;
_local1 = CGame.GetInstance().mHero;
if (_local1.mBullet.length == 0){
mX = x;
mY = y;
mAvoidingBullet = false;
return;
};
_local2 = 0;
while (_local2 < _local1.mBullet.length) {
_local3 = Global.Distance(x, y, _local1.mBullet[_local2].x, _local1.mBullet[_local2].y);
if (_local3 >= 100){
mX = x;
mY = y;
mAvoidingBullet = false;
return;
};
_local2++;
};
}
public function MoveKotak2(){
if (mHoldCounter > 1){
mHoldCounter--;
return;
};
if (mHoldCounter == 1){
mSpeed = 2;
mHoldCounter--;
return;
};
mCounter--;
if (mCounter <= 0){
PopSnakeDirArr();
return;
};
if (mDir == 0){
x = (x + mSpeed);
if ((x + (this.width / 2)) > Global.WORLD_WIDTH){
x = (x - mSpeed);
PopSnakeDirArr();
};
} else {
if (mDir == 1){
x = (x - mSpeed);
if ((x - (this.width / 2)) < 0){
x = (x + mSpeed);
PopSnakeDirArr();
};
} else {
if (mDir == 2){
y = (y + mSpeed);
if ((y + (this.height / 2)) > Global.WORLD_HEIGHT){
y = (y - mSpeed);
PopSnakeDirArr();
};
} else {
if (mDir == 3){
y = (y - mSpeed);
if ((y - (this.height / 2)) < 0){
y = (y + mSpeed);
PopSnakeDirArr();
};
};
};
};
};
}
private function PopSnakeDirArr(){
var _local1:Object;
Debug("PopSnakeDirArr BEGIN");
if (mHead.mDirArr.length > 0){
_local1 = mHead.mDirArr[0];
mDir = _local1.dir;
mInitCounter = _local1.counter;
mCounter = _local1.counter;
mDirArr.push(_local1);
mHead.mDirArr.splice(0, 1);
};
Debug("PopSnakeDirArr END");
}
public function StartSpawningSnakeBody(){
var _local1:int;
_local1 = 0;
while (_local1 < mSnakeBodyMaxCount) {
SpawnSnakeBody();
mSnakeBodyCount--;
_local1++;
};
}
public function Init(){
switch (mType){
case 0:
mDir = PM_PRNG.nextIntRange(0, 3);
mSpeed = 5;
mCounter = PM_PRNG.nextIntRange(60, 120);
break;
case 1:
mSpeed = 3;
break;
case 2:
mSpeed = 5;
mAvoidingBullet = false;
break;
case 3:
mSpeed = 5;
break;
case 4:
mSpeed = 3;
mInvisibleCounter = -1;
mSpiralAngle = 0;
break;
case 5:
mSnakeBodyCount = 0;
mSnakeBodyMaxCount = 0;
mSnakeBodyCounter = 20;
mSnakeBody = new Array();
mDirArr = new Array();
mHp = 10;
if (mHead){
mInvisibleCounter = -1;
mSpeed = 0;
} else {
mSpeed = 2;
GetNewKotakPos();
mSnakeBody.push(this);
mMaster = this;
};
break;
case 6:
mSpeed = 1;
mHp = 300;
mInvisibleCounter = 200;
break;
case 7:
mSpeed = 5;
mInvisibleCounter = 200;
break;
case 8:
mSpeed = 6;
mInvisibleCounter = -1;
break;
};
}
public function MoveKotak(){
mCounter--;
if (mCounter <= 0){
GetNewKotakPos();
return;
};
if (mDir == 0){
x = (x + mSpeed);
if ((x + (this.width / 2)) > Global.WORLD_WIDTH){
x = (x - mSpeed);
GetNewKotakPos();
};
} else {
if (mDir == 1){
x = (x - mSpeed);
if ((x - (this.width / 2)) < 0){
x = (x + mSpeed);
GetNewKotakPos();
};
} else {
if (mDir == 2){
y = (y + mSpeed);
if ((y + (this.height / 2)) > Global.WORLD_HEIGHT){
y = (y - mSpeed);
GetNewKotakPos();
};
} else {
if (mDir == 3){
y = (y - mSpeed);
if ((y - (this.height / 2)) < 0){
y = (y + mSpeed);
GetNewKotakPos();
};
};
};
};
};
}
public function DestroySnakeBody(){
var _local1:CEnemy;
_local1 = mSnakeBody.pop();
CGame.GetInstance().KillEnemy(_local1);
}
public function RemoveDispatcher(){
Main.GetInstance().removeEventListener("update", Update);
}
public function MoveDiagonal(){
mCounter--;
if (mCounter <= 0){
GetNewKotakPos();
return;
};
if (mDir == 0){
x = (x + mSpeed);
y = (y + mSpeed);
} else {
if (mDir == 1){
x = (x - mSpeed);
y = (y + mSpeed);
} else {
if (mDir == 2){
x = (x + mSpeed);
y = (y - mSpeed);
} else {
if (mDir == 3){
x = (x - mSpeed);
y = (y - mSpeed);
};
};
};
};
if ((x + (this.width / 2)) > Global.WORLD_WIDTH){
x = (x - mSpeed);
GetNewKotakPos();
} else {
if ((x - (this.width / 2)) < 0){
x = (x + mSpeed);
GetNewKotakPos();
};
};
if ((y + (this.height / 2)) > Global.WORLD_HEIGHT){
y = (y - mSpeed);
GetNewKotakPos();
} else {
if ((y - (this.height / 2)) < 0){
y = (y + mSpeed);
GetNewKotakPos();
};
};
}
private function Debug(_arg1:String){
}
private function MoveSpiral():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Global.AngleOfTwoLines(CGame.GetInstance().mHero.x, CGame.GetInstance().mHero.y, x, y);
_local2 = Math.cos(_local1);
_local3 = Math.sin(_local1);
x = (x + (5 * Math.cos(Global.DegToRad(mSpiralAngle))));
y = (y + (5 * Math.sin(Global.DegToRad(mSpiralAngle))));
x = (x + (mSpeed * _local2));
y = (y + (mSpeed * _local3));
mSpiralAngle = (mSpiralAngle + 5);
if (mSpiralAngle > 360){
mSpiralAngle = 0;
};
}
private function CheckForWalls(){
if (((((x + (this.width / 2)) > Global.WORLD_WIDTH)) || (((x - (this.width / 2)) < 0)))){
x = mTempX;
};
if (((((y + (this.height / 2)) > Global.WORLD_HEIGHT)) || (((y - (this.height / 2)) < 0)))){
y = mTempY;
};
}
public function Hit(_arg1:CBullet){
CGame.GetInstance().PlayExplodeSfx();
if ((((((((((((mType == 0)) || ((mType == 1)))) || ((mType == 2)))) || ((mType == 4)))) || ((mType == 7)))) || ((mType == 8)))){
CGame.GetInstance().KillEnemy(this);
ParticleManager.getInstance().createParticle(8, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
} else {
if (mType == 3){
CGame.GetInstance().KillEnemy(this);
ParticleManager.getInstance().createParticle(4, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
CGame.GetInstance().SpawnEnemy(4, x, y, 1);
CGame.GetInstance().SpawnEnemy(4, ((x + PM_PRNG.nextIntRange(0, 100)) - 50), ((y + PM_PRNG.nextIntRange(0, 100)) - 50), 1);
CGame.GetInstance().SpawnEnemy(4, ((x + PM_PRNG.nextIntRange(0, 100)) - 50), ((y + PM_PRNG.nextIntRange(0, 100)) - 50), 1);
} else {
if (mType == 5){
PlayParticles(5, this.x, this.y);
mHp--;
if (mHp < 0){
mMaster.DestroySnakeBody();
};
} else {
if (mType == 6){
mHp--;
PlayParticles(4, _arg1.x, _arg1.y);
if (mHp < 0){
CGame.GetInstance().KillEnemy(this);
CGame.GetInstance().IncreaseScore(100);
CGame.GetInstance().IncreaseComboCounter(400);
};
};
};
};
};
if (mType == 0){
CGame.GetInstance().IncreaseScore(10);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 1){
CGame.GetInstance().IncreaseScore(10);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 2){
CGame.GetInstance().IncreaseScore(25);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 3){
CGame.GetInstance().IncreaseScore(15);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 4){
CGame.GetInstance().IncreaseScore(5);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 5){
if (mHp < 0){
CGame.GetInstance().IncreaseScore(5);
CGame.GetInstance().IncreaseComboCounter(40);
};
} else {
if (mType == 7){
CGame.GetInstance().IncreaseScore(20);
CGame.GetInstance().IncreaseComboCounter(40);
} else {
if (mType == 8){
CGame.GetInstance().IncreaseScore(5);
CGame.GetInstance().IncreaseComboCounter(10);
};
};
};
};
};
};
};
};
}
public function Kill(){
mIcon.parent.removeChild(mIcon);
RemoveDispatcher();
}
private function CheckGravitation():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
if (CGame.GetInstance().mGravitation.active){
_local1 = Global.AngleOfTwoLines(CGame.GetInstance().mGravitation.x, CGame.GetInstance().mGravitation.y, x, y);
_local2 = (CGame.GetInstance().mGravitation.power * Math.cos(_local1));
_local3 = (CGame.GetInstance().mGravitation.power * Math.sin(_local1));
this.x = (this.x + _local2);
this.y = (this.y + _local3);
mX = x;
mY = y;
};
}
private function AvoidNearestBullet():void{
var _local1:CHero;
var _local2:int;
var _local3:Number;
_local1 = CGame.GetInstance().mHero;
_local2 = 0;
while (_local2 < _local1.mBullet.length) {
_local3 = Global.Distance(x, y, _local1.mBullet[_local2].x, _local1.mBullet[_local2].y);
if (_local3 < 100){
mAvoidingAngle = Global.DegToRad((_local1.mBullet[_local2].rotation + 90));
mAvoidingBullet = true;
return;
};
_local2++;
};
}
public function PlayParticles(_arg1:int, _arg2:Number, _arg3:Number){
ParticleManager.getInstance().createParticle(_arg1, {xpos:_arg2, ypos:_arg3, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
}
private function Update(_arg1:Event){
if ((((CGame.GetInstance().mHero.mRespawnCounter > 0)) || ((CGame.GetInstance().mHero.mInvisibleCounter > 0)))){
return;
};
if (mInvisibleCounter > 0){
if (mType != 6){
if ((mInvisibleCounter % 4) == 0){
if (scaleX == 1){
scaleX = 0.5;
scaleY = 0.5;
} else {
scaleX = 1;
scaleY = 1;
};
};
} else {
if ((mInvisibleCounter % 16) == 0){
if (scaleX == 1){
scaleX = 0.5;
scaleY = 0.5;
} else {
scaleX = 1;
scaleY = 1;
};
};
};
mInvisibleCounter--;
} else {
if (mInvisibleCounter == 0){
mInvisibleCounter--;
scaleX = 1;
scaleY = 1;
} else {
mTempX = x;
mTempY = y;
if (mType == 0){
MoveKotak();
} else {
if (mType == 5){
if (mHead == null){
MoveKotak();
} else {
MoveKotak2();
};
} else {
if ((mType == 1)){
MoveSeek();
} else {
if ((((mType == 3)) || ((mType == 8)))){
MoveSeek();
CheckForWalls();
} else {
if (mType == 4){
MoveSpiral();
CheckForWalls();
} else {
if (mType == 2){
rotation = (rotation + 2);
if (!mAvoidingBullet){
AvoidNearestBullet();
if (!mAvoidingBullet){
MoveSeek();
};
} else {
x = (x + ((mSpeed + 30) * Math.cos(mAvoidingAngle)));
y = (y + ((mSpeed + 30) * Math.sin(mAvoidingAngle)));
IsAvoidingEnough();
};
CheckForWalls();
} else {
if (mType == 6){
MoveSeek();
rotation = (rotation + 0.5);
} else {
if (mType == 7){
MoveSeek();
rotation = (rotation + 2);
};
};
};
};
};
};
};
};
if (mType != 6){
CheckGravitation();
};
};
};
}
private function SpawnSnakeBody():void{
var _local1:int;
var _local2:CEnemy;
_local1 = (mSnakeBodyMaxCount - mSnakeBodyCount);
_local2 = new CEnemy(5, 0, 0);
_local2.mHead = mSnakeBody[_local1];
mSnakeBody[_local1].mTail = _local2;
_local2.mMaster = this;
_local2.Init();
CGame.GetInstance().addChild(_local2);
_local2.x = this.x;
_local2.y = this.y;
_local2.PopSnakeDirArr();
_local2.mHoldCounter = ((mSnakeBody.length * this.width) / mSpeed);
_local2.AddDispatcher();
CGame.GetInstance().mEnemies.push(_local2);
mSnakeBody.push(_local2);
}
}
}//package
Section 58
//CGame (CGame)
package {
import flash.display.*;
import flash.events.*;
import com.footloosemoose.particlegenerator.*;
import com.electrotank.util.*;
import de.polygonal.math.*;
import com.senocular.utils.*;
import flash.media.*;
import flash.ui.*;
public class CGame extends MovieClip {
public var mHero:CHero;
public var mGroup:Array;
public var mScore:String;// = "mScore"
public var mCrossHair:CCrossHair;
private var mSfxFlag:Boolean;
private var mKeyObject:KeyObject;
private var mGravCount:int;
private var mBomb:String;// = "mBomb"
private var mSfx:Sound;
public var mEnemies:Array;
private var mLife:String;// = "mLife"
private var mSfxChannel:SoundChannel;
private var mLevel:int;
private var mCombo:String;// = "mCombo"
private var mBombAnim:BombAnim;
public var mStarsBg:MovieClip;
private var mBonusBomb:int;
private var mGravitationLifeCounter:int;
private var mComboArr:Array;
private var mMouseDownFlag:Boolean;
private var mComboCounter:String;// = "mComboCounter"
public var mGravitation:CGravitation;
private var mGravitationCounter:int;
private var mScoreBar:CScoreBar;
private var mBonusLife:int;
private static var CGameGlobal:CGame;
public function CGame(){
mScore = "mScore";
mCombo = "mCombo";
mComboCounter = "mComboCounter";
mBomb = "mBomb";
mLife = "mLife";
super();
mGravitation = new CGravitation();
mGravitation.x = 500;
mGravitation.y = 50;
addChild(mGravitation);
mGravitation.power = 3;
CGameGlobal = this;
mKeyObject = new KeyObject(Main.GetInstance().stage);
mMouseDownFlag = false;
Main.GetInstance().stage.addEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove, false, 0, true);
Main.GetInstance().stage.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown, false, 0, true);
Main.GetInstance().stage.addEventListener(MouseEvent.MOUSE_UP, OnMouseUp, false, 0, true);
}
public function AddDispatcher():void{
Main.GetInstance().addEventListener("update", Update, false, 0, true);
}
public function IncreaseComboCounter(_arg1:int):void{
if ((((_arg1 > 0)) && ((MemoryCrypto.getValue(mCombo) == 5)))){
return;
};
if ((((((_arg1 < 0)) && ((MemoryCrypto.getValue(mCombo) == 0)))) && ((MemoryCrypto.getValue(mComboCounter) <= 0)))){
return;
};
MemoryCrypto.incrementValue(mComboCounter, _arg1);
if (MemoryCrypto.getValue(mCombo) > 0){
if (MemoryCrypto.getValue(mComboCounter) >= mComboArr[MemoryCrypto.getValue(mCombo)]){
if (MemoryCrypto.getValue(mCombo) < 5){
MemoryCrypto.incrementValue(mCombo, 1);
};
} else {
if (MemoryCrypto.getValue(mComboCounter) < mComboArr[(MemoryCrypto.getValue(mCombo) - 1)]){
MemoryCrypto.decrementValue(mCombo, 1);
};
};
} else {
if (MemoryCrypto.getValue(mComboCounter) >= mComboArr[MemoryCrypto.getValue(mCombo)]){
MemoryCrypto.incrementValue(mCombo, 1);
};
};
mScoreBar.mCombo.text = (Math.floor(MemoryCrypto.getValue(mCombo)) + 1);
}
private function LoadLevel(_arg1:int):void{
var _local2:Array;
var _local3:int;
var _local4:CGroup;
mGroup = new Array();
_local2 = Data.DEnemy[mLevel];
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = new CGroup(_local3, _local2);
_local4.AddDispatcher();
mGroup.push(_local4);
_local3++;
};
}
public function IncreaseBomb(_arg1:int):void{
MemoryCrypto.incrementValue(mBomb, _arg1);
mScoreBar.mBomb.text = MemoryCrypto.getValue(mBomb);
}
public function PlayExplodeSfx(){
var _local1:SoundTransform;
if (!Main.GetInstance().mSfxPlayOption){
return;
};
if (mSfxFlag){
mSfxChannel.stop();
mSfxChannel.removeEventListener(Event.SOUND_COMPLETE, OnSFXComplete);
};
mSfxFlag = true;
mSfx = new SFX2();
_local1 = new SoundTransform(0.5, 0);
mSfxChannel = mSfx.play(0, 0, _local1);
mSfxChannel.addEventListener(Event.SOUND_COMPLETE, OnSFXComplete, false, 0, true);
}
public function Debug(){
var _local1:int;
trace(((("mComboCounter : " + MemoryCrypto.getValue(mComboCounter)) + " - mCombo : ") + MemoryCrypto.getValue(mCombo)));
_local1 = 0;
while (_local1 < mComboArr.length) {
trace(((("i : " + _local1) + " - comboArr : ") + mComboArr[_local1]));
_local1++;
};
if (MemoryCrypto.getValue(mComboCounter) >= mComboArr[MemoryCrypto.getValue(mCombo)]){
trace("TRUEEEEE");
};
}
public function MoveCamera(_arg1:Number, _arg2:Number){
var _local3:int;
_arg1 = (_arg1 * 0.7);
_arg2 = (_arg2 * 0.7);
this.y = (this.y + _arg2);
this.x = (this.x + _arg1);
if (mBombAnim){
mBombAnim.x = (mBombAnim.x - _arg1);
mBombAnim.y = (mBombAnim.y - _arg2);
};
mCrossHair.x = (mCrossHair.x - _arg1);
mCrossHair.y = (mCrossHair.y - _arg2);
mScoreBar.x = (mScoreBar.x - _arg1);
mScoreBar.y = (mScoreBar.y - _arg2);
_local3 = 0;
while (_local3 < mEnemies.length) {
if ((((mEnemies[_local3].mType == 7)) && ((mEnemies[_local3].mInvisibleCounter > 0)))){
mEnemies[_local3].x = (mEnemies[_local3].x - _arg1);
mEnemies[_local3].y = (mEnemies[_local3].y - _arg2);
mEnemies[_local3].mX = (mEnemies[_local3].mX - _arg1);
mEnemies[_local3].mY = (mEnemies[_local3].mY - _arg2);
};
_local3++;
};
mStarsBg.y = (mStarsBg.y + (_arg2 * 0.5));
mStarsBg.x = (mStarsBg.x + (_arg1 * 0.5));
}
public function IncreaseLife(_arg1:int):void{
MemoryCrypto.incrementValue(mLife, _arg1);
mScoreBar.mLife.text = MemoryCrypto.getValue(mLife);
if (MemoryCrypto.getValue(mLife) < 0){
mHero.Kill();
mHero.RemoveDispatcher();
mHero.parent.removeChild(mHero);
Mouse.show();
Main.GetInstance().ShowGameOverWin();
mKeyObject.deconstruct();
mKeyObject = null;
};
}
public function RemoveDispatcher(){
Main.GetInstance().removeEventListener("update", Update);
}
private function InitGrid():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Shape;
_local1 = 50;
_local2 = (Global.WORLD_HEIGHT / _local1);
_local3 = (Global.WORLD_WIDTH / _local1);
_local4 = 1;
while (_local4 <= _local2) {
_local5 = 1;
while (_local5 <= _local3) {
_local6 = new Shape();
_local6.graphics.lineStyle(4, 5592473, 0.5, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
_local6.graphics.moveTo(((_local5 - 1) * 50), (_local4 * 50));
_local6.graphics.lineTo((_local5 * 50), (_local4 * 50));
this.addChild(_local6);
_local6.graphics.moveTo((_local5 * 50), ((_local4 - 1) * 50));
_local6.graphics.lineTo((_local5 * 50), (_local4 * 50));
this.addChild(_local6);
_local5++;
};
_local4++;
};
}
public function ResetAfterHeroDead(){
MemoryCrypto.setValue(mBomb, 3);
mScoreBar.mBomb.text = "3";
if (MemoryCrypto.getValue(mCombo) > 0){
MemoryCrypto.decrementValue(mCombo, 1);
};
mScoreBar.mCombo.text = MemoryCrypto.getValue(mCombo);
MemoryCrypto.setValue(mComboCounter, (mComboArr[MemoryCrypto.getValue(mCombo)] + 100));
if (mGravitation.active){
StopGravitation();
};
}
public function StartGravitation(){
if (!mGravitation.active){
mGravCount++;
if (mGravCount <= 6){
mGravitation.hp = 30;
} else {
mGravitation.hp = 50;
};
mGravitation.active = true;
};
}
public function Bomb(){
var _local1:int;
if ((((((MemoryCrypto.getValue(mBomb) > 0)) && (!(mBombAnim)))) && ((mHero.mRespawnCounter <= 0)))){
IncreaseBomb(-1);
_local1 = 0;
while (_local1 < mEnemies.length) {
mEnemies[_local1].PlayParticles(4, mEnemies[_local1].x, mEnemies[_local1].y);
mEnemies[_local1].Kill();
_local1++;
};
IncreaseScore((mEnemies.length * 5));
mEnemies.splice(0, mEnemies.length);
mBombAnim = new BombAnim();
this.addChild(mBombAnim);
mBombAnim.x = -(this.x);
mBombAnim.y = -(this.y);
if (mGravitation.active){
StopGravitation();
};
};
}
public function KillEnemy(_arg1:CEnemy){
var _local2:int;
_local2 = mEnemies.indexOf(_arg1);
_arg1.Kill();
mEnemies.splice(_local2, 1);
_arg1 = null;
}
private function OnMouseMove(_arg1:MouseEvent):void{
mCrossHair.x = (-(this.x) + _arg1.stageX);
mCrossHair.y = (-(this.y) + _arg1.stageY);
}
public function PlayExplodeSfx2(){
var _local1:SoundTransform;
if (!Main.GetInstance().mSfxPlayOption){
return;
};
if (mSfxFlag){
mSfxChannel.stop();
mSfxChannel.removeEventListener(Event.SOUND_COMPLETE, OnSFXComplete);
};
mSfxFlag = true;
mSfx = new SFX3();
_local1 = new SoundTransform(0.5, 0);
mSfxChannel = mSfx.play(0, 0, _local1);
mSfxChannel.addEventListener(Event.SOUND_COMPLETE, OnSFXComplete, false, 0, true);
}
public function StopGravitation(){
mGravitation.active = false;
mGravitation.visible = false;
mGravitationCounter = PM_PRNG.nextIntRange(400, 1200);
mGravitationLifeCounter = 320;
if (mGravCount <= 6){
mGravitation.power = 3;
} else {
mGravitation.power = 4;
};
}
private function Update(_arg1:Event){
var _local2:int;
if (MemoryCrypto.getValue(mCombo) <= 1){
IncreaseComboCounter(-1);
} else {
if (MemoryCrypto.getValue(mCombo) <= 2){
IncreaseComboCounter(-2);
} else {
if (MemoryCrypto.getValue(mCombo) <= 4){
IncreaseComboCounter(-3);
} else {
IncreaseComboCounter(-4);
};
};
};
setChildIndex(mScoreBar, (numChildren - 1));
if (mGravitationCounter > 0){
mGravitationCounter--;
} else {
if (mGravitationCounter == 0){
mGravitationCounter--;
mGravitation.visible = true;
mGravitation.x = PM_PRNG.nextIntRange(50, (Global.STAGE_WIDTH - 50));
mGravitation.y = PM_PRNG.nextIntRange(50, (Global.STAGE_HEIGHT - 50));
};
};
if (mGravitation.active){
mGravitationLifeCounter--;
if (mGravitationLifeCounter < 0){
StopGravitation();
_local2 = 0;
while (_local2 < 20) {
SpawnEnemy(8, ((mGravitation.x + PM_PRNG.nextIntRange(0, 100)) - 50), ((mGravitation.y + PM_PRNG.nextIntRange(0, 100)) - 50));
_local2++;
};
ParticleManager.getInstance().createParticle(30, {xpos:mGravitation.x, ypos:mGravitation.y, allx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
};
ParticleManager.getInstance().createParticle(2, {xpos:mGravitation.x, ypos:mGravitation.y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:1});
};
if (mMouseDownFlag){
if (MemoryCrypto.getValue(mCombo) == 0){
mHero.Fire(1, 0);
} else {
if (MemoryCrypto.getValue(mCombo) == 1){
mHero.Fire(1, 1);
} else {
if (MemoryCrypto.getValue(mCombo) == 2){
mHero.Fire(3, 1);
} else {
if (MemoryCrypto.getValue(mCombo) == 3){
mHero.Fire(4, 1);
} else {
if (MemoryCrypto.getValue(mCombo) == 4){
mHero.Fire(5, 1);
} else {
if (MemoryCrypto.getValue(mCombo) == 5){
mHero.Fire(6, 1);
};
};
};
};
};
};
};
if (mKeyObject){
if (mKeyObject.isDown(83)){
mHero.MoveBackward();
mHero.rotation = 180;
};
if (mKeyObject.isDown(87)){
mHero.MoveForward();
mHero.rotation = 0;
};
if (mKeyObject.isDown(68)){
if (mKeyObject.isDown(87)){
mHero.rotation = 45;
mHero.MoveRight(0.5);
} else {
if (mKeyObject.isDown(83)){
mHero.rotation = 135;
mHero.MoveRight(0.5);
} else {
mHero.rotation = 90;
mHero.MoveRight(1);
};
};
};
if (mKeyObject.isDown(65)){
if (mKeyObject.isDown(87)){
mHero.rotation = -45;
mHero.MoveLeft(0.5);
} else {
if (mKeyObject.isDown(83)){
mHero.rotation = -135;
mHero.MoveLeft(0.5);
} else {
mHero.rotation = -90;
mHero.MoveLeft(1);
};
};
};
};
}
public function SpawnEnemy(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number=1):CEnemy{
var _local5:CEnemy;
_local5 = new CEnemy(_arg1, 0, 0);
_local5.Init();
addChild(_local5);
_local5.mX = _arg2;
_local5.mY = _arg3;
_local5.x = _arg2;
_local5.y = _arg3;
_local5.scaleX = _arg4;
_local5.scaleY = _arg4;
_local5.AddDispatcher();
mEnemies.push(_local5);
return (_local5);
}
public function QuitGame(){
mHero.Kill();
mHero.RemoveDispatcher();
mHero.parent.removeChild(mHero);
Mouse.show();
Main.GetInstance().KillGameWin();
Main.GetInstance().Init();
}
private function OnMouseUp(_arg1:MouseEvent):void{
mMouseDownFlag = false;
}
public function DamageGravitation(){
mGravitation.hp--;
mGravitation.play();
if (mGravitation.hp < 0){
StopGravitation();
};
}
public function Init(){
mGravCount = 0;
mSfxFlag = false;
Main.GetInstance().stage.focus = this;
mBonusLife = 0;
mBonusBomb = 0;
StopGravitation();
mGravitationCounter = 2000;
mGravitationLifeCounter = 320;
MemoryCrypto.setValue(mLife, 2);
mComboArr = new Array();
mComboArr.push(400);
mComboArr.push(2200);
mComboArr.push(5500);
mComboArr.push(9000);
mComboArr.push(13000);
MemoryCrypto.setValue(mScore, 0);
MemoryCrypto.setValue(mCombo, 0);
MemoryCrypto.setValue(mComboCounter, 0);
MemoryCrypto.setValue(mBomb, 2);
mScoreBar = new CScoreBar();
addChild(mScoreBar);
mScoreBar.x = 0;
mScoreBar.y = 0;
IncreaseScore(0);
IncreaseComboCounter(0);
IncreaseBomb(0);
IncreaseLife(0);
ParticleManager.getInstance().init(this);
Mouse.hide();
InitGrid();
mStarsBg.mouseEnabled = false;
mCrossHair = new CCrossHair();
addChild(mCrossHair);
mCrossHair.mouseEnabled = false;
mCrossHair.x = 350;
mCrossHair.y = 250;
mHero = new CHero();
addChild(mHero);
mHero.x = 300;
mHero.y = 200;
mHero.AddDispatcher();
mEnemies = new Array();
mLevel = 0;
LoadLevel(mLevel);
setChildIndex(mScoreBar, (numChildren - 1));
}
public function IncreaseScore(_arg1:int){
var _local2:int;
_local2 = (_arg1 + (_arg1 * MemoryCrypto.getValue(mCombo)));
MemoryCrypto.incrementValue(mScore, _local2);
mScoreBar.mScore.text = MemoryCrypto.getValue(mScore);
if (MemoryCrypto.getValue(mScore) > ((mBonusLife + 1) * 20000)){
mBonusLife++;
IncreaseLife(1);
};
if (MemoryCrypto.getValue(mScore) > ((mBonusBomb + 1) * 10000)){
mBonusBomb++;
IncreaseBomb(1);
};
}
private function OnSFXComplete(_arg1:Event):void{
mSfxFlag = false;
mSfxChannel.removeEventListener(Event.SOUND_COMPLETE, OnSFXComplete);
mSfx = null;
}
public function Kill(){
var _local1:int;
this.RemoveDispatcher();
if (mScoreBar){
mScoreBar.parent.removeChild(mScoreBar);
mScoreBar = null;
};
Main.GetInstance().stage.removeEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove);
Mouse.show();
_local1 = 0;
while (_local1 < mEnemies.length) {
mEnemies[_local1].Kill();
mEnemies[_local1] = null;
_local1++;
};
mEnemies = null;
if (mHero){
if (mHero.parent){
mHero.parent.removeChild(mHero);
};
mHero.Kill();
mHero.RemoveDispatcher();
mHero = null;
};
mCrossHair.parent.removeChild(mCrossHair);
mCrossHair = null;
_local1 = 0;
while (_local1 < numChildren) {
this.removeChildAt(_local1);
_local1++;
};
if (mGroup){
_local1 = 0;
while (_local1 < mGroup.length) {
KillGroup(mGroup[_local1]);
_local1++;
};
mGroup = null;
};
}
public function KillGroup(_arg1:CGroup){
var _local2:int;
_local2 = mGroup.indexOf(_arg1);
mGroup[_local2].RemoveDispatcher();
}
private function OnMouseDown(_arg1:MouseEvent):void{
mMouseDownFlag = true;
}
public function FinishBomb(){
mBombAnim.stop();
mBombAnim.parent.removeChild(mBombAnim);
mBombAnim = null;
}
static function GetInstance():CGame{
return (CGameGlobal);
}
}
}//package
Section 59
//CGameOverWin (CGameOverWin)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
import flash.geom.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
public dynamic class CGameOverWin extends MovieClip {
public var mSorry:TextField;
public var mGroupName2:TextField;
public var mBack3Btn:SimpleButton;
public var mSubmitBtn:SimpleButton;
public var mBack4Btn:SimpleButton;
public var s:String;
public var mQuitBtn:SimpleButton;
public var mSubmitGroup:SimpleButton;
public var mBack7Btn:SimpleButton;
public var mGroupName:TextField;
public var mBack2Btn:SimpleButton;
public var mGlobalBtn:SimpleButton;
public var mCreateBtn2:SimpleButton;
public var mTitleText:TextField;
public var mCreateBtn7:SimpleButton;
public var mBackBtn:SimpleButton;
public var mScoreText:TextField;
public var mError1:TextField;
public function CGameOverWin(){
addFrameScript(0, frame1, 8, frame9, 17, frame18, 36, frame37, 45, frame46, 58, frame59);
}
public function SubmitLocal(_arg1:MouseEvent=null):void{
Main.GetInstance().ShowSubmitScoreWin(("graveblaster_" + Main.GetInstance().mGroupName), 1);
}
public function SubmitGroup(_arg1:MouseEvent):void{
gotoAndStop("Submit");
}
function frame18(){
stop();
s = Main.GetInstance().mGroupName;
mCreateBtn7.enabled = true;
mCreateBtn7.addEventListener(MouseEvent.MOUSE_UP, CreateGroup7, false, 0, true);
mBack7Btn.addEventListener(MouseEvent.MOUSE_UP, BackToMenu2, false, 0, true);
mError1.text = (("Sorry but the group table " + s) + " does not exist, please create it first.");
}
function frame1(){
stop();
trace(("GlobalFlag : " + Main.GetInstance().mGlobalFlag));
if (((Main.GetInstance().game.UseHighScores()) && (!(Main.GetInstance().mGlobalFlag)))){
mGlobalBtn.visible = true;
mGlobalBtn.enabled = true;
mGlobalBtn.addEventListener(MouseEvent.MOUSE_UP, SubmitGlobal, false, 0, true);
} else {
mGlobalBtn.visible = false;
mGlobalBtn.enabled = false;
};
mQuitBtn.addEventListener(MouseEvent.MOUSE_UP, Quit, false, 0, true);
}
public function Quit(_arg1:MouseEvent):void{
Main.GetInstance().ShowHSWinAfterGameOver();
}
function frame9(){
stop();
mSubmitBtn.enabled = true;
mGroupName.restrict = "^ \t";
mBackBtn.addEventListener(MouseEvent.MOUSE_UP, BackToMenu, false, 0, true);
mSubmitBtn.addEventListener(MouseEvent.MOUSE_UP, CheckGroupExist, false, 0, true);
stage.focus = mGroupName;
}
public function SubmitGlobal(_arg1:MouseEvent):void{
Main.GetInstance().mGlobalFlag = true;
Main.GetInstance().ShowSubmitScoreWin("shapesstriker_nilaiTinggi");
}
function frame37(){
stop();
mGroupName2.restrict = "^ \t";
mCreateBtn2.enabled = true;
stage.focus = mGroupName2;
mCreateBtn2.addEventListener(MouseEvent.MOUSE_UP, CreateGroup2, false, 0, true);
mBack2Btn.addEventListener(MouseEvent.MOUSE_UP, BackToMenu, false, 0, true);
}
public function SubmitLocal2(_arg1:MouseEvent):void{
mSubmitGroup.enabled = false;
SubmitLocal();
}
function frame46(){
stop();
mBack3Btn.addEventListener(MouseEvent.MOUSE_UP, BackToCreate, false, 0, true);
}
public function BackToMenu(_arg1:MouseEvent):void{
gotoAndStop("Menu");
}
public function CreateGroup(_arg1:MouseEvent):void{
gotoAndStop("Create");
}
function frame59(){
stop();
trace(("SetCreateGroupFlag to TRUE - Before : " + Main.GetInstance().mCreateGroupFlag));
Main.GetInstance().mCreateGroupFlag = true;
trace(("SetCreateGroupFlag to TRUE - After : " + Main.GetInstance().mCreateGroupFlag));
mGroupName.text = Main.GetInstance().mGroupName;
mBack4Btn.addEventListener(MouseEvent.MOUSE_UP, BackToMenu, false, 0, true);
mSubmitGroup.addEventListener(MouseEvent.MOUSE_UP, SubmitLocal2, false, 0, true);
mSubmitGroup.enabled = true;
}
public function BackToCreate(_arg1:MouseEvent){
gotoAndStop("Create");
}
public function CreateGroup7(_arg1:MouseEvent):void{
mCreateBtn7.enabled = false;
Main.GetInstance().CreateGroup(s);
}
public function CreateGroup2(_arg1:MouseEvent):void{
mCreateBtn2.enabled = false;
mGroupName2.text = mGroupName2.text.toUpperCase();
Main.GetInstance().CreateGroup(mGroupName2.text);
}
public function CheckGroupExist(_arg1:MouseEvent){
mSubmitBtn.enabled = false;
mGroupName.text = mGroupName.text.toUpperCase();
Main.GetInstance().CheckGroupExist(mGroupName.text);
}
public function BackToMenu2(_arg1:MouseEvent):void{
Main.GetInstance().mGroupName = "graveblaster_nilaiTinggi";
gotoAndStop("Menu");
}
}
}//package
Section 60
//CGravitation (CGravitation)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
import flash.ui.*;
import flash.geom.*;
import flash.system.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
public dynamic class CGravitation extends MovieClip {
public function CGravitation(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 61
//CGroup (CGroup)
package {
import flash.events.*;
public class CGroup {
private var mPar4:Number;
private var mPar2:Number;
private var mPar3:Number;
private var mGroupCounter:int;
public var mFinishedFlag:Boolean;
private var mIdx;
public var mTotalValue:int;
private var mType:int;
private var mCount:int;
private var mDelay:int;
private var mWaitPrevGroup:int;
private var mHoleX:int;
private var mWaitPrevDelay:int;
private var mUnitCounter:int;
private var mHoleY:int;
private var mData:Array;
private var mPar1:Number;
public var mStatus:int;
public static var STATUS_STOPPED = 3;
public static var STATUS_WAIT_PREV_GROUP_FINISHED = 0;
public static var STATUS_PREV_GROUP_DELAY = 1;
public static var STATUS_WAIT_PREV_GROUP_RUNNING = 4;
public static var STATUS_RUNNING = 2;
private static var WAIT_PREV_GROUP_DESTROYED = 1;
private static var DONT_WAIT_PREV_GROUP_DESTROYED = 0;
public function CGroup(_arg1:int, _arg2:Array){
mIdx = _arg1;
mData = _arg2;
mFinishedFlag = false;
LoadData();
}
public function Pause(_arg1:Event){
}
public function AddDispatcher():void{
Main.GetInstance().addEventListener("update", Update, false, 0, true);
}
public function UnPause(_arg1:Event){
}
public function Kill():void{
CGame.GetInstance().KillGroup(this);
}
private function LoadData(){
var _local1:int;
_local1 = (mIdx - 1);
mCount = mData[(_local1 + 1)].count;
mType = mData[(_local1 + 1)].type;
mDelay = mData[(_local1 + 1)].delay;
mHoleX = mData[(_local1 + 1)].holex;
mHoleY = mData[(_local1 + 1)].holey;
mPar1 = mData[(_local1 + 1)].par1;
mPar2 = mData[(_local1 + 1)].par2;
mPar3 = mData[(_local1 + 1)].par3;
mPar4 = mData[(_local1 + 1)].par4;
if (mData[(_local1 + 1)].coin){
mBonusCoin = mData[(_local1 + 1)].coin;
} else {
mBonusCoin = 0;
};
if (mData[(_local1 + 1)].speed){
mSpeedFactor = (mSpeedFactor + mData[(_local1 + 1)].speed);
};
if (mData[(_local1 + 1)].hp){
mHpFactor = (mHpFactor + mData[(_local1 + 1)].hp);
};
if (mData[(_local1 + 1)].dmg){
mDmgFactor = (mDmgFactor + mData[(_local1 + 1)].dmg);
};
if (mIdx > 0){
mWaitPrevDelay = mData[(_local1 + 1)].waitprev;
mWaitPrevGroup = 0;
if (mWaitPrevGroup == WAIT_PREV_GROUP_DESTROYED){
mStatus = STATUS_WAIT_PREV_GROUP_FINISHED;
mGroupCounter = mWaitPrevDelay;
} else {
mStatus = STATUS_WAIT_PREV_GROUP_RUNNING;
};
} else {
mStatus = STATUS_PREV_GROUP_DELAY;
mGroupCounter = mWaitPrevDelay;
};
}
public function RemoveDispatcher(){
Main.GetInstance().removeEventListener("update", Update);
}
private function SpawnEnemy():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:CEnemy;
if (mCount != 777){
mCount--;
};
if (mType == 7){
_local1 = (Global.STAGE_WIDTH / mPar1);
_local2 = -(CGame.GetInstance().x);
_local3 = -(CGame.GetInstance().y);
_local4 = (_local3 + 20);
_local5 = (_local2 + 30);
_local6 = 0;
while (_local6 < mPar1) {
_local10 = new CEnemy(mType, mHoleX, mHoleY);
_local10.AddDispatcher();
_local10.Init();
_local10.mX = ((_local6 * _local1) + _local5);
_local10.mY = (0 + _local4);
_local10.x = _local10.mX;
_local10.y = _local10.mY;
CGame.GetInstance().addChild(_local10);
CGame.GetInstance().mEnemies.push(_local10);
_local6++;
};
_local7 = (Global.STAGE_WIDTH / mPar2);
_local4 = ((Global.STAGE_HEIGHT + _local3) - 20);
_local5 = (_local2 + 30);
_local6 = 0;
while (_local6 < mPar2) {
_local10 = new CEnemy(mType, mHoleX, mHoleY);
_local10.AddDispatcher();
_local10.Init();
_local10.mX = ((_local6 * _local7) + _local5);
_local10.mY = _local4;
_local10.x = _local10.mX;
_local10.y = _local10.mY;
CGame.GetInstance().addChild(_local10);
CGame.GetInstance().mEnemies.push(_local10);
_local6++;
};
_local8 = (Global.STAGE_HEIGHT / mPar3);
_local5 = ((Global.STAGE_WIDTH + _local2) - 50);
_local4 = (_local3 + 50);
_local6 = 0;
while (_local6 < mPar3) {
_local10 = new CEnemy(mType, mHoleX, mHoleY);
_local10.AddDispatcher();
_local10.Init();
_local10.mX = _local5;
_local10.mY = ((_local6 * _local8) + _local4);
_local10.x = _local10.mX;
_local10.y = _local10.mY;
CGame.GetInstance().addChild(_local10);
CGame.GetInstance().mEnemies.push(_local10);
_local6++;
};
_local9 = (Global.STAGE_HEIGHT / mPar4);
_local5 = (_local2 + 50);
_local4 = (_local3 + 50);
_local6 = 0;
while (_local6 < mPar4) {
_local10 = new CEnemy(mType, mHoleX, mHoleY);
_local10.AddDispatcher();
_local10.Init();
_local10.mX = _local5;
_local10.mY = ((_local6 * _local9) + _local4);
_local10.x = _local10.mX;
_local10.y = _local10.mY;
CGame.GetInstance().addChild(_local10);
CGame.GetInstance().mEnemies.push(_local10);
_local6++;
};
} else {
_local10 = new CEnemy(mType, mHoleX, mHoleY);
_local10.AddDispatcher();
_local10.Init();
CGame.GetInstance().addChild(_local10);
CGame.GetInstance().mEnemies.push(_local10);
if (mType == 5){
_local10.mSnakeBodyCount = 20;
_local10.mSnakeBodyMaxCount = 20;
_local10.StartSpawningSnakeBody();
};
};
if (mCount <= 0){
mStatus = STATUS_STOPPED;
Kill();
};
}
public function Update(_arg1:Event):void{
if (mStatus == STATUS_WAIT_PREV_GROUP_FINISHED){
if (CGame.GetInstance().mGroup[(mIdx - 1)].mFinishedFlag){
mStatus = STATUS_PREV_GROUP_DELAY;
};
} else {
if (mStatus == STATUS_PREV_GROUP_DELAY){
mGroupCounter--;
if (mGroupCounter <= 0){
mStatus = STATUS_RUNNING;
mUnitCounter = mDelay;
};
} else {
if (mStatus == STATUS_RUNNING){
mUnitCounter--;
if (mUnitCounter <= 0){
mUnitCounter = mDelay;
SpawnEnemy();
};
} else {
if (mStatus == STATUS_WAIT_PREV_GROUP_RUNNING){
if ((((CGame.GetInstance().mGroup[(mIdx - 1)].mStatus == STATUS_RUNNING)) || ((CGame.GetInstance().mGroup[(mIdx - 1)].mStatus == STATUS_STOPPED)))){
mStatus = STATUS_PREV_GROUP_DELAY;
mGroupCounter = mWaitPrevDelay;
};
};
};
};
};
}
}
}//package
Section 62
//CHero (CHero)
package {
import flash.display.*;
import flash.events.*;
import com.footloosemoose.particlegenerator.*;
import flash.media.*;
public class CHero extends MovieClip {
private var mSfxChannel:SoundChannel;
private var mROF:int;
public var mInvisibleCounter:int;
private var mROFCounter:int;
public var mRespawnCounter:int;
private var mRespawnX:Number;
private var mRespawnY:Number;
public var mBullet:Array;
private var mSpeed:Number;
public function CHero(){
mSpeed = 6;
mBullet = new Array();
mROF = 5;
mROFCounter = mROF;
mInvisibleCounter = 0;
mRespawnCounter = -1;
}
public function AddDispatcher():void{
Main.GetInstance().addEventListener("update", Update, false, 0, true);
}
private function DestroyMe():void{
var _local1:Number;
var _local2:Number;
CGame.GetInstance().PlayExplodeSfx2();
mRespawnCounter = 120;
mInvisibleCounter = 160;
ParticleManager.getInstance().createParticle(15, {xpos:x, ypos:y, wallx:Global.WORLD_WIDTH, wally:Global.WORLD_HEIGHT, type:0});
_local1 = x;
_local2 = y;
x = (Global.STAGE_WIDTH / 2);
y = (Global.STAGE_HEIGHT / 2);
mRespawnX = (x - _local1);
mRespawnY = (y - _local2);
CGame.GetInstance().IncreaseLife(-1);
CGame.GetInstance().ResetAfterHeroDead();
}
public function MoveBackward(){
if (mRespawnCounter > 0){
return;
};
y = (y + mSpeed);
if ((y + (this.height / 2)) > Global.WORLD_HEIGHT){
y = (y - mSpeed);
} else {
CGame.GetInstance().MoveCamera(0, -(mSpeed));
};
}
public function Fire(_arg1:int=1, _arg2=0){
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:Sound;
var _local7:Number;
var _local8:CBullet;
if ((((((mROFCounter > 0)) || ((mRespawnCounter > 0)))) || (!(mBullet)))){
return;
};
if (Main.GetInstance().mSfxPlayOption){
_local6 = new SFX1();
mSfxChannel = _local6.play();
};
_local3 = Global.AngleOfTwoLines(CGame.GetInstance().mCrossHair.x, CGame.GetInstance().mCrossHair.y, x, y);
_local3 = Global.RadToDeg(_local3);
_local4 = ((_arg1 - 1) / 2);
if (_arg1 > 1){
_local7 = (10 / _local4);
} else {
_local7 = 0;
};
_local3 = (_local3 - (_local4 * _local7));
_local5 = 0;
while (_local5 < _arg1) {
_local8 = new CBullet(this, _arg2);
mBullet.push(_local8);
CGame.GetInstance().addChild(_local8);
_local8.x = x;
_local8.y = y;
_local8.InitPos(Global.DegToRad((_local3 + (_local5 * _local7))));
_local8.AddDispatcher();
mROFCounter = mROF;
_local5++;
};
}
public function KillBullet(_arg1:CBullet){
_arg1.RemoveDispatcher();
if (_arg1.parent){
_arg1.parent.removeChild(_arg1);
};
if (mBullet){
mBullet.splice(mBullet.indexOf(_arg1), 1);
};
_arg1 = null;
}
public function RemoveDispatcher(){
Main.GetInstance().removeEventListener("update", Update);
}
public function MoveLeft(_arg1:Number){
var _local2:Number;
if (mRespawnCounter > 0){
return;
};
_local2 = (mSpeed * _arg1);
x = (x - _local2);
if ((x - (this.width / 2)) < 0){
x = (x + _local2);
} else {
CGame.GetInstance().MoveCamera(_local2, 0);
};
}
public function MoveForward(){
if (mRespawnCounter > 0){
return;
};
y = (y - mSpeed);
if ((y - (this.height / 2)) < 0){
y = (y + mSpeed);
} else {
CGame.GetInstance().MoveCamera(0, mSpeed);
};
}
public function Kill(){
var _local1:int;
if (mBullet){
_local1 = 0;
while (_local1 < mBullet.length) {
mBullet[_local1].RemoveDispatcher();
mBullet[_local1].parent.removeChild(mBullet[_local1]);
mBullet[_local1] = null;
_local1++;
};
mBullet = null;
};
}
public function MoveRight(_arg1:Number){
var _local2:Number;
if (mRespawnCounter > 0){
return;
};
_local2 = (mSpeed * _arg1);
x = (x + _local2);
if ((x + (this.width / 2)) > Global.WORLD_WIDTH){
x = (x - _local2);
} else {
CGame.GetInstance().MoveCamera(-(_local2), 0);
};
}
private function Update(_arg1:Event){
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (mRespawnCounter > 0){
mRespawnCounter--;
this.alpha = 0;
return;
};
if (mRespawnCounter == 0){
CGame.GetInstance().MoveCamera(-(mRespawnX), -(mRespawnY));
mRespawnCounter--;
} else {
if (mInvisibleCounter > 0){
mInvisibleCounter--;
if ((mInvisibleCounter % 12) == 0){
this.alpha = 1;
} else {
this.alpha = 0;
};
} else {
if (mInvisibleCounter == 0){
mInvisibleCounter--;
this.alpha = 1;
};
};
};
if (mROFCounter > 0){
mROFCounter--;
};
if (CGame.GetInstance().mGravitation.active){
_local3 = Global.AngleOfTwoLines(CGame.GetInstance().mGravitation.x, CGame.GetInstance().mGravitation.y, x, y);
_local4 = ((CGame.GetInstance().mGravitation.power + 1) * Math.cos(_local3));
_local5 = ((CGame.GetInstance().mGravitation.power + 1) * Math.sin(_local3));
this.x = (this.x + _local4);
this.y = (this.y + _local5);
CGame.GetInstance().MoveCamera(-(_local4), -(_local5));
};
_local2 = 0;
while (_local2 < CGame.GetInstance().mEnemies.length) {
if ((((CGame.GetInstance().mEnemies[_local2].mInvisibleCounter <= 0)) && (((hitTestObject(CGame.GetInstance().mEnemies[_local2])) && ((mInvisibleCounter <= 0)))))){
DestroyMe();
};
_local2++;
};
}
}
}//package
Section 63
//CHSWin (CHSWin)
package {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import flash.text.*;
import fl.controls.dataGridClasses.*;
import flash.net.*;
public class CHSWin extends MovieClip {
public var mNext:SimpleButton;
private var mPageTotal:int;
public var mTitle:TextField;
private var loader:URLLoader;
private var mRowPerPage:int;
public var mPrev:SimpleButton;
private var variables:URLVariables;
private var mPageIdx:int;
public var mFlag:Boolean;
public var mPageNumText:TextField;
public var mDataGrid:DataGrid;
public var mTableName:String;
public var mBackBtn:SimpleButton;
public var mPageText:TextField;
public var mGoBtn:SimpleButton;
public function CHSWin(){
mDataGrid = new DataGrid();
variables = new URLVariables();
super();
}
function createTable(_arg1:Event):void{
var _local2:XML;
var _local3:DataProvider;
var _local4:*;
var _local5:Number;
_local2 = XML(_arg1.target.data);
if (_arg1.target.data == "<flashScores>\n</flashScores>"){
return;
};
_local3 = new DataProvider(_local2);
_local4 = [];
_local5 = 0;
while (_local5 < _local2.children()[0].children().length()) {
_local4[_local5] = new DataGridColumn(String(_local2.children()[0].children()[_local5].name()));
_local5++;
};
if (_local2.children()[0].children().length() > 0){
_local4[0].width = 150;
_local4[1].width = 50;
_local4[2].width = 75;
};
_local5 = 0;
while (_local5 < _local2.children()[0].children().length()) {
mDataGrid.addColumn(_local4[_local5]);
_local5++;
};
mDataGrid.dataProvider = _local3;
mDataGrid.width = 500;
mDataGrid.rowCount = _local3.length;
mDataGrid.move(50, 70);
mDataGrid.sortableColumns = false;
addChild(mDataGrid);
loader.removeEventListener(Event.COMPLETE, createTable);
mPageText.visible = true;
mPageNumText.visible = true;
mGoBtn.visible = true;
mBackBtn.visible = true;
mNext.visible = true;
mPrev.visible = true;
if (mPageIdx == 1){
mPrev.visible = false;
};
if (mPageIdx == mPageTotal){
mNext.visible = false;
};
mPrev.y = ((mDataGrid.y + 20) + mDataGrid.height);
mNext.y = mPrev.y;
mGoBtn.y = (mPrev.y + 5);
mPageText.y = mPrev.y;
mPageNumText.y = mPrev.y;
mBackBtn.y = (mPrev.y + 5);
mPrev.x = (mDataGrid.x + 20);
mNext.x = (mPrev.x + 20);
mPageText.x = (mNext.x + 70);
mPageNumText.x = (mPageText.x + 70);
mGoBtn.x = (mPageNumText.x + 70);
mBackBtn.x = (mGoBtn.x + 50);
mFlag = true;
}
public function Init(_arg1:String, _arg2:int){
mPrev.visible = false;
mNext.visible = false;
mPageText.visible = false;
mPageNumText.visible = false;
mGoBtn.visible = false;
mBackBtn.visible = false;
trace(((("group name @Init HSWIN : " + _arg1) + " - startIdx : ") + _arg2));
mTableName = _arg1;
if (_arg1 == "shapesstriker_nilaiTinggi"){
mTitle.text = "GLOBAL HIGH SCORE";
} else {
_arg1 = _arg1.substr(13, (_arg1.length - 13));
mTitle.text = (_arg1 + " HIGH SCORE");
};
trace(("TITLE HIGH SCORE : " + mTitle.text));
mPageIdx = _arg2;
mRowPerPage = 15;
mPageNumText.text = "1";
CountPageTotal();
mNext.addEventListener(MouseEvent.MOUSE_UP, NextPage, false, 0, true);
mPrev.addEventListener(MouseEvent.MOUSE_UP, PrevPage, false, 0, true);
mGoBtn.addEventListener(MouseEvent.MOUSE_UP, GoToPage, false, 0, true);
mBackBtn.addEventListener(MouseEvent.MOUSE_UP, BackToMainMenu, false, 0, true);
mPageNumText.type = TextFieldType.INPUT;
mPageNumText.restrict = "0-9";
mPageNumText.maxChars = 2;
}
private function NextPage(_arg1:MouseEvent):void{
if (!mFlag){
return;
};
mPageIdx++;
CountPageTotal();
}
private function PrevPage(_arg1:MouseEvent):void{
if (!mFlag){
return;
};
if (mPageIdx > 1){
mPageIdx--;
CountPageTotal();
};
}
private function BackToMainMenu(_arg1:MouseEvent):void{
if (mFlag){
Main.GetInstance().KillHighScoreWin();
Main.GetInstance().Init();
};
}
public function LoadHSTable(){
var _local1:URLRequest;
if (mDataGrid){
if (mDataGrid.parent){
mDataGrid.parent.removeChild(mDataGrid);
};
mDataGrid = null;
};
mDataGrid = new DataGrid();
variables.minRank = ((mPageIdx - 1) * mRowPerPage);
variables.rowPerPage = mRowPerPage;
variables.playerTime = 5;
variables.sortField = "score";
variables.table = mTableName;
trace(("minRank : " + variables.minRank));
trace(("rowPerPage : " + variables.rowPerPage));
_local1 = new URLRequest();
_local1.url = (Global.HS_URL + "mintadaftar.php");
_local1.data = variables;
loader = new URLLoader();
loader.load(_local1);
loader.addEventListener(Event.COMPLETE, createTable);
}
public function CountPageTotal(){
var _local1:URLRequest;
mFlag = false;
mPageNumText.text = mPageIdx;
mNext.visible = false;
mPrev.visible = false;
_local1 = new URLRequest();
variables.table = mTableName;
_local1.url = "http://www.lazybanana.com/mintajmlrow.php";
_local1.data = variables;
loader = new URLLoader();
loader.load(_local1);
loader.addEventListener(Event.COMPLETE, SetPageTotal);
}
private function SetPageTotal(_arg1:Event):void{
mPageTotal = Math.ceil((int(_arg1.target.data) / mRowPerPage));
trace(((("page total : " + mPageTotal) + " - page idx : ") + mPageIdx));
loader.removeEventListener(Event.COMPLETE, SetPageTotal);
if ((((mPageIdx <= mPageTotal)) && ((mPageTotal > 0)))){
LoadHSTable();
} else {
trace("ERROR ! Requested page index is Greater than page total");
mBackBtn.visible = true;
mFlag = true;
};
}
public function GoToPage(_arg1:MouseEvent):void{
var _local2:String;
if (!mFlag){
return;
};
_local2 = mPageNumText.text;
if ((((_local2.length <= 0)) || ((_local2.charAt(0) == "0")))){
mPageNumText.text = "1";
_local2 = "1";
};
if (int(_local2) > mPageTotal){
mPageNumText.text = mPageTotal;
_local2 = mPageTotal;
};
mPageIdx = int(_local2);
CountPageTotal();
}
}
}//package
Section 64
//CHTP (CHTP)
package {
import flash.display.*;
import flash.events.*;
public class CHTP extends MovieClip {
public var mStarBg2:MovieClip;
public var mBackBtn:SimpleButton;
public function CHTP(){
InitGrid();
}
private function Back(_arg1:MouseEvent=null):void{
Main.GetInstance().KillHTP();
Main.GetInstance().Init();
}
public function Init(){
mBackBtn.addEventListener(MouseEvent.MOUSE_UP, Back, false, 0, true);
}
private function InitGrid():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Shape;
_local1 = 50;
_local2 = ((Global.STAGE_HEIGHT + 100) / _local1);
_local3 = ((Global.STAGE_WIDTH + 100) / _local1);
_local4 = getChildIndex(mStarBg2);
_local5 = 1;
while (_local5 <= _local2) {
_local6 = 1;
while (_local6 <= _local3) {
_local7 = new Shape();
_local7.graphics.lineStyle(4, 5592473, 0.5, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
_local7.graphics.moveTo(((_local6 - 1) * 50), (_local5 * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local7.graphics.moveTo((_local6 * 50), ((_local5 - 1) * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local6++;
};
_local5++;
};
}
}
}//package
Section 65
//CMainMenu (CMainMenu)
package {
import flash.display.*;
import flash.events.*;
public class CMainMenu extends MovieClip {
public var mStarBg:MovieClip;
public var mHS:SimpleButton;
public var mHtp:SimpleButton;
public var mPlay:SimpleButton;
public var mMoreBtn:SimpleButton;
public var mCredit:SimpleButton;
public function CMainMenu(){
InitGrid();
}
public function Init(){
var _local1:Sprite;
mPlay.addEventListener(MouseEvent.MOUSE_UP, NewGame, false, 0, true);
mHtp.addEventListener(MouseEvent.MOUSE_UP, ShowHTP, false, 0, true);
mCredit.addEventListener(MouseEvent.MOUSE_UP, ShowCredit, false, 0, true);
mMoreBtn.addEventListener(MouseEvent.MOUSE_UP, MoreGames, false, 0, true);
if (Main.GetInstance().game.UseLogo()){
_local1 = Main.GetInstance().game.GetLogo(250, 150);
_local1.x = 18;
_local1.y = 360;
this.addChild(_local1);
};
if (Main.GetInstance().game.UseHighScores()){
mHS.addEventListener(MouseEvent.MOUSE_UP, ShowHighScore, false, 0, true);
} else {
mHS.parent.removeChild(mHS);
};
}
private function MoreGames(_arg1:MouseEvent):void{
Main.GetInstance().game.MoreGames();
}
private function ShowCredit(_arg1:MouseEvent):void{
Main.GetInstance().KillMainMenuWin();
Main.GetInstance().KillGameWin();
Main.GetInstance().ShowCreditWin();
}
private function ShowHTP(_arg1:MouseEvent):void{
Main.GetInstance().KillMainMenuWin();
Main.GetInstance().KillGameWin();
Main.GetInstance().ShowHTP();
}
private function ShowHighScore(_arg1:MouseEvent):void{
Main.GetInstance().game.HighScores();
}
private function NewGame(_arg1:MouseEvent):void{
Main.GetInstance().KillMainMenuWin();
Main.GetInstance().InitGame();
}
private function InitGrid():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Shape;
_local1 = 50;
_local2 = ((Global.STAGE_HEIGHT + 100) / _local1);
_local3 = ((Global.STAGE_WIDTH + 100) / _local1);
_local4 = getChildIndex(mStarBg);
_local5 = 1;
while (_local5 <= _local2) {
_local6 = 1;
while (_local6 <= _local3) {
_local7 = new Shape();
_local7.graphics.lineStyle(4, 5592473, 0.5, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
_local7.graphics.moveTo(((_local6 - 1) * 50), (_local5 * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local7.graphics.moveTo((_local6 * 50), ((_local5 - 1) * 50));
_local7.graphics.lineTo((_local6 * 50), (_local5 * 50));
this.addChildAt(_local7, (_local4 + 1));
_local6++;
};
_local5++;
};
}
}
}//package
Section 66
//ColumnStretch_cursor (ColumnStretch_cursor)
package {
import flash.display.*;
public dynamic class ColumnStretch_cursor extends MovieClip {
}
}//package
Section 67
//CScoreBar (CScoreBar)
package {
import flash.display.*;
import flash.text.*;
public dynamic class CScoreBar extends MovieClip {
public var mLife:TextField;
public var mScore:TextField;
public var mCombo:TextField;
public var mBomb:TextField;
}
}//package
Section 68
//CSubmitScoreWin (CSubmitScoreWin)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.electrotank.util.*;
public class CSubmitScoreWin extends MovieClip {
private var mRealTableName:String;
public var mSubmitBtn:SimpleButton;
public var mCaller:int;
public var mName:TextField;
public var mQuitBtn:SimpleButton;
private var mTableName:String;
public var mTableNameText:TextField;
public var mScoreText:TextField;
public function CSubmitScoreWin(_arg1:String="", _arg2:int=0){
addFrameScript(1, frame2);
mRealTableName = _arg1;
mCaller = _arg2;
if (_arg1 == "shapesstriker_nilaiTinggi"){
_arg1 = "GLOBAL";
} else {
_arg1 = _arg1.substr(13, (_arg1.length - 13));
trace(("tableName : " + _arg1));
};
mName.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp, false, 0, true);
mTableName = _arg1;
mName.text = Main.GetInstance().mLastHSName;
trace(("mLastHsName : " + Main.GetInstance().mLastHSName));
}
public function Init(){
gotoAndStop(1);
mScoreText.selectable = false;
mScoreText.text = MemoryCrypto.getValue(CGame.GetInstance().mScore);
mName.selectable = true;
mName.addEventListener(MouseEvent.MOUSE_UP, SelectAll, false, 0, true);
mName.setSelection(1, 8);
mQuitBtn.addEventListener(MouseEvent.MOUSE_UP, CancelSubmit, false, 0, true);
mSubmitBtn.addEventListener(MouseEvent.MOUSE_UP, SubmitScore, false, 0, true);
}
private function CancelSubmit(_arg1:MouseEvent):void{
Main.GetInstance().KillSubmitScoreWin();
Main.GetInstance().mGameOverWin.gotoAndStop("Menu");
}
public function Quit(_arg1:MouseEvent):void{
Main.GetInstance().KillSubmitScoreWin();
Main.GetInstance().KillGameOverWin();
Main.GetInstance().ShowGameOverWin();
}
function frame2(){
mQuitBtn.addEventListener(MouseEvent.MOUSE_UP, Quit, false, 0, true);
}
private function SubmitScore(_arg1:MouseEvent):void{
Main.GetInstance().mLastHSName = mName.text;
Main.GetInstance().game.SubmitHighScore("", mName.text, MemoryCrypto.getValue(CGame.GetInstance().mScore));
Main.GetInstance().KillSubmitScoreWin();
Main.GetInstance().KillGameOverWin();
Main.GetInstance().KillGameWin();
Main.GetInstance().Init();
}
private function OnKeyUp(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 13){
SubmitScore(null);
};
}
private function SelectAll(_arg1:MouseEvent):void{
mName.setSelection(0, mName.text.length);
}
}
}//package
Section 69
//Data (Data)
package {
public class Data {
static var HOLE = 0;
static var DEnemy:Array = new Array(new Array({type:0, count:777, delay:120, holex:0, holey:0}, {type:0, count:777, delay:120, holex:0, holey:4, waitprev:0}, {type:0, count:777, delay:120, holex:4, holey:0}, {type:0, count:777, delay:120, holex:4, holey:4}, {type:1, count:777, delay:100, holex:-1, holey:0, waitprev:200}, {type:1, count:777, delay:120, holex:-1, holey:4, waitprev:100}, {type:1, count:777, delay:200, holex:-1, holey:0, waitprev:100}, {type:1, count:777, delay:300, holex:-1, holey:0, waitprev:100}, {type:0, count:777, delay:120, holex:-1, holey:4, waitprev:200}, {type:2, count:10, delay:400, holex:1, holey:1, waitprev:500}, {type:2, count:10, delay:400, holex:3, holey:1, waitprev:0}, {type:2, count:10, delay:400, holex:1, holey:3, waitprev:0}, {type:0, count:10, delay:80, holex:-1, holey:4, waitprev:100}, {type:2, count:10, delay:400, holex:3, holey:3, waitprev:400}, {type:3, count:777, delay:600, holex:-1, holey:0, waitprev:200}, {type:3, count:777, delay:500, holex:-1, holey:0, waitprev:200}, {type:5, count:777, delay:600, holex:-1, holey:0, waitprev:600}, {type:2, count:777, delay:400, holex:-1, holey:1, waitprev:500}, {type:2, count:777, delay:300, holex:-1, holey:1, waitprev:0}, {type:2, count:777, delay:400, holex:-1, holey:3, waitprev:0}, {type:6, count:2, delay:1500, holex:-1, holey:0, waitprev:100}, {type:7, count:1, delay:400, holex:0, holey:0, par1:8, par2:0, par3:0, par4:0, waitprev:2000}, {type:7, count:1, delay:400, holex:0, holey:0, par1:0, par2:0, par3:8, par4:0, waitprev:100}, {type:7, count:1, delay:400, holex:0, holey:0, par1:0, par2:8, par3:0, par4:0, waitprev:100}, {type:7, count:1, delay:400, holex:0, holey:0, par1:0, par2:0, par3:0, par4:6, waitprev:100}, {type:7, count:2, delay:600, holex:0, holey:0, par1:8, par2:8, par3:0, par4:0, waitprev:100}, {type:7, count:2, delay:600, holex:0, holey:0, par1:0, par2:0, par3:8, par4:8, waitprev:300}, {type:3, count:10, delay:400, holex:-1, holey:0, waitprev:300}, {type:3, count:10, delay:300, holex:-1, holey:0, waitprev:200}, {type:2, count:777, delay:400, holex:-1, holey:3, waitprev:0}, {type:7, count:5, delay:800, holex:0, holey:0, par1:4, par2:4, par3:4, par4:4, waitprev:400}, {type:6, count:5, delay:1500, holex:-1, holey:0, waitprev:500}, {type:3, count:777, delay:600, holex:-1, holey:0, waitprev:200}, {type:3, count:777, delay:500, holex:-1, holey:0, waitprev:200}, {type:2, count:10, delay:400, holex:1, holey:1, waitprev:600}, {type:2, count:10, delay:400, holex:3, holey:1, waitprev:0}, {type:2, count:10, delay:400, holex:1, holey:3, waitprev:0}, {type:2, count:10, delay:400, holex:3, holey:3, waitprev:0}, {type:7, count:5, delay:800, holex:0, holey:0, par1:5, par2:5, par3:5, par4:5, waitprev:800}, {type:7, count:777, delay:800, holex:0, holey:0, par1:8, par2:8, par3:8, par4:8, waitprev:800}));
static var BOARD = 2;
static var ENEMY = 1;
static var PARAM = 4;
static var BALL = 3;
}
}//package
Section 70
//DataGrid_skin (DataGrid_skin)
package {
import flash.display.*;
public dynamic class DataGrid_skin extends MovieClip {
}
}//package
Section 71
//DataGridCellEditor_skin (DataGridCellEditor_skin)
package {
import flash.display.*;
public dynamic class DataGridCellEditor_skin extends MovieClip {
}
}//package
Section 72
//Enemies (Enemies)
package {
import flash.display.*;
public dynamic class Enemies extends MovieClip {
public var enemy0:MovieClip;
public var enemy1:MovieClip;
public var enemy4:MovieClip;
public var enemy5:MovieClip;
public var enemy7:MovieClip;
public var enemy8:MovieClip;
public var enemy2:MovieClip;
public var enemy6:MovieClip;
public var enemy3:MovieClip;
}
}//package
Section 73
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 74
//Global (Global)
package {
public class Global {
protected static const WINDOW_OPEN_FUNCTION:String = "window.open";
static var STAGE_WIDTH = 640;
static var STAGE_HEIGHT = 480;
static var WORLD_HEIGHT = 720;
static var WORLD_WIDTH = 960;
static var HS_URL = "http://www.lazybanana.com/games/shape-em-up/";
public static function DegToRad(_arg1:Number):Number{
return (((_arg1 / 180) * Math.PI));
}
public static function AngleOfTwoLines(_arg1, _arg2, _arg3, _arg4):Number{
var _local5:Number;
var _local6:Number;
_local5 = (_arg1 - _arg3);
_local6 = (_arg2 - _arg4);
return (Math.atan2(_local6, _local5));
}
public static function Distance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt((Math.pow((_arg3 - _arg1), 2) + Math.pow((_arg4 - _arg2), 2))));
}
public static function openWindow(_arg1:String, _arg2:String="_blank", _arg3:String=""):void{
ExternalInterface.call(WINDOW_OPEN_FUNCTION, _arg1, _arg2, _arg3);
}
public static function RadToDeg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
}
}//package
Section 75
//GSFlashGameAPI (GSFlashGameAPI)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class GSFlashGameAPI {
private var container;
private var logoLoaded:Boolean;// = false
private var loader:URLLoader;
private var dataFailed:Boolean;// = false
private var logo:Loader;
private var logoUrl:String;
private var mainStage;
private var logoFailed:Boolean;// = false
private var dataLoaded:Boolean;// = false
private var splashClip:MovieClip;
private var showHighScoreUrl:String;
private var moreGamesUrl:String;
private var splash:Loader;
private var submitHighScoreUrl:String;
private var splashFinished:Boolean;// = false
private var gamename;
private static const defaultMoreGamesUrl:String = "http://www.bigfuntown.com";
private static const dataUrl:String = "http://gameapi.gamescore.com/flash/gamedata?referer=[referer]&host=[host]";
private static const splashUrl:String = "http://gameapi.gamescore.com/flash/splash.swf?referer=[referer]";
public function GSFlashGameAPI(_arg1, _arg2){
splashFinished = false;
dataLoaded = false;
dataFailed = false;
logoLoaded = false;
logoFailed = false;
super();
this.container = _arg1;
this.mainStage = this.container.stage;
this.gamename = _arg2;
Security.allowDomain("gamescore.com");
Security.allowDomain("www.gamescore.com");
Security.allowDomain("gameapi.gamescore.com");
Security.allowInsecureDomain("gamescore.com");
Security.allowInsecureDomain("www.gamescore.com");
Security.allowInsecureDomain("gameapi.gamescore.com");
this.loadData();
this.loadSplash();
}
public function HighScores(){
if (!this.dataLoaded){
return;
};
navigateToURL(new URLRequest(this.showHighScoreUrl.replace("[gamename]", this.gamename)), "_blank");
}
private function baseHex(_arg1:int){
switch (_arg1){
case 15:
return ("f");
case 14:
return ("e");
case 13:
return ("d");
case 12:
return ("c");
case 11:
return ("b");
case 10:
return ("a");
default:
return (("" + _arg1));
};
}
public function GetLogo(_arg1, _arg2){
var _local3:Sprite;
var _local4:*;
if (!this.logoLoaded){
return;
};
_local3 = new Sprite();
_local3.addChild(this.logo);
_local3.height = ((_arg1 / this.logo.width) * this.logo.height);
_local3.width = _arg1;
if (_arg2 < _local3.height){
_local3.width = ((_arg2 / _local3.height) * _local3.width);
_local3.height = _arg2;
};
_local3.x = ((_arg1 / 2) - (_local3.width / 2));
_local3.y = ((_arg2 / 2) - (_local3.height / 2));
_local4 = new Sprite();
_local4.addChild(_local3);
return (_local4);
}
private function splashSuccess(_arg1){
this.splashClip = (this.splash.content as MovieClip);
this.splash.addEventListener(Event.ENTER_FRAME, displaySplash);
}
private function logoClick(_arg1){
this.MoreGames();
}
private function endSplash(){
this.mainStage.removeChild(this.splash);
this.splashFinished = true;
}
private function splashFail(_arg1){
this.endSplash();
}
private function toHex(_arg1:String){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = this.lookupHex(_arg1.charCodeAt(_local3));
_local2[((_local3 * 4) + 0)] = _local4.charAt(0);
_local2[((_local3 * 4) + 1)] = _local4.charAt(1);
_local2[((_local3 * 4) + 2)] = _local4.charAt(2);
_local2[((_local3 * 4) + 3)] = _local4.charAt(3);
_local3++;
};
return (_local2.join(""));
}
public function UseHighScores(){
return (this.dataLoaded);
}
public function Loaded(){
return (((((this.splashFinished) && (((this.dataLoaded) || (this.dataFailed))))) && (((((this.logoLoaded) || (this.logoFailed))) || (this.dataFailed)))));
}
private function loadData(){
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.TEXT;
this.loader.addEventListener(Event.COMPLETE, downloadSuccess);
this.loader.addEventListener(IOErrorEvent.IO_ERROR, downloadFail);
this.loader.load(new URLRequest(GSFlashGameAPI.dataUrl.replace("[referer]", this.gamename).replace("[host]", encodeURI(this.container.loaderInfo.loaderURL))));
}
private function loadLogo(){
this.logo = new Loader();
this.logo.contentLoaderInfo.addEventListener(Event.COMPLETE, logoSuccess);
this.logo.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, logoFail);
this.logo.load(new URLRequest(this.logoUrl));
}
public function UseLogo(){
return (this.logoLoaded);
}
private function dubEncrypt(_arg1:String, _arg2:String){
var _local3:*;
_local3 = this.encrypt(_arg1, _arg2);
_local3 = this.encrypt(this.reverse(_local3), this.reverse(_arg2));
return (this.toHex(_local3));
}
public function SubmitHighScore(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:int;
var _local6:*;
var _local7:*;
var _local8:*;
if (!this.dataLoaded){
return;
};
_local4 = this.gamename.replace("|", "");
_arg1 = _arg1.replace("|", "");
_arg2 = _arg2.replace("|", "");
_arg3 = ("" + _arg3).replace("|", "");
_local5 = (Math.random() * 1000000);
_local6 = this.submitHighScoreUrl.replace("[gamename]", this.gamename);
_local7 = new URLRequest(_local6);
_local8 = new URLVariables();
_local8.scoreData = this.dubEncrypt(((((((((_local4 + "|") + _arg1) + "|") + _arg2) + "|") + _arg3) + "|") + _local5), "~d&j#9sK@8;dnHio3?Fp}h9#BDfvn#");
_local7.data = _local8;
_local7.method = URLRequestMethod.POST;
navigateToURL(_local7, "_blank");
}
private function lookupHex(_arg1:int){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = (_arg1 / 0x1000);
_arg1 = (_arg1 % 0x1000);
_local3 = (_arg1 / 0x0100);
_arg1 = (_arg1 % 0x0100);
_local4 = (_arg1 / 16);
_arg1 = (_arg1 % 16);
_local5 = _arg1;
return ((((this.baseHex(_local2) + this.baseHex(_local3)) + this.baseHex(_local4)) + this.baseHex(_local5)));
}
private function downloadFail(_arg1){
this.dataFailed = true;
}
private function displaySplash(_arg1){
if (splashClip.Finished == false){
return;
};
this.splash.removeEventListener(Event.ENTER_FRAME, displaySplash);
this.endSplash();
}
public function MoreGames(){
if (!this.dataLoaded){
navigateToURL(new URLRequest(GSFlashGameAPI.defaultMoreGamesUrl), "_blank");
return;
};
navigateToURL(new URLRequest(this.moreGamesUrl.replace("[referer]", this.gamename)), "_blank");
}
private function logoSuccess(_arg1){
this.logo.addEventListener(MouseEvent.CLICK, logoClick);
this.logoLoaded = true;
}
private function downloadSuccess(_arg1){
var _local2:Array;
var _local3:*;
var _local4:Array;
_local2 = this.loader.data.split("\n");
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = _local2[_local3].split("|||");
switch (_local4[0]){
case "MoreGames":
this.moreGamesUrl = _local4[1];
break;
case "SubmitHighScore":
this.submitHighScoreUrl = _local4[1];
break;
case "ShowHighScores":
this.showHighScoreUrl = _local4[1];
break;
case "Logo":
this.logoUrl = _local4[1];
this.loadLogo();
break;
};
_local3++;
};
this.dataLoaded = true;
}
private function reverse(_arg1){
return (_arg1.split("").reverse().join(""));
}
private function encrypt(_arg1:String, _arg2:String){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
_local3 = new Array();
_local3[0] = _arg1.charCodeAt(0);
_local4 = 1;
while (_local4 < _arg1.length) {
_local7 = _arg1.charCodeAt(_local4);
_local8 = (((_local3[(_local4 - 1)] + _arg2.charCodeAt((_local4 % _arg2.length))) + _arg2.charCodeAt((_local3[(_local4 - 1)] % _arg2.length))) % 65536);
_local3[_local4] = (_local7 ^ _local8);
_local4++;
};
_local5 = new Array();
_local6 = 0;
while (_local6 < _local3.length) {
_local5[_local6] = String.fromCharCode(_local3[_local6]);
_local6++;
};
return (_local5.join(""));
}
private function logoFail(_arg1){
this.logoFailed = true;
}
private function loadSplash(){
this.splash = new Loader();
this.splash.contentLoaderInfo.addEventListener(Event.COMPLETE, splashSuccess);
this.splash.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, splashFail);
this.mainStage.addChild(this.splash);
this.splash.load(new URLRequest(GSFlashGameAPI.splashUrl.replace("[referer]", this.gamename)));
}
}
}//package
Section 76
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_disabledSkin extends MovieClip {
}
}//package
Section 77
//HeaderRenderer_downSkin (HeaderRenderer_downSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_downSkin extends MovieClip {
}
}//package
Section 78
//HeaderRenderer_overSkin (HeaderRenderer_overSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_overSkin extends MovieClip {
}
}//package
Section 79
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 80
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 81
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 82
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 83
//HeaderRenderer_upSkin (HeaderRenderer_upSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_upSkin extends MovieClip {
}
}//package
Section 84
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_ascIcon extends MovieClip {
}
}//package
Section 85
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_descIcon extends MovieClip {
}
}//package
Section 86
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
import com.electrotank.util.*;
import be.boulevart.as3.security.*;
import flash.media.*;
import flash.ui.*;
import flash.system.*;
import flash.external.*;
public class Main extends MovieClip {
public var loader:URLLoader;
public var mState:int;
private var mCreditWin:CCreditWin;
public var mLastHSName:String;// = ""
private var mPausedAnim:pausedAnim;
public var mHighScoreWin:CHSWin;
public var mCreateGroupFlag:Boolean;
private var mSapiTimer:Timer;
private var mContextMenu:ContextMenu;
private var mSfxChannel:SoundChannel;
private var mHTPWin:CHTP;
private var mBgmFlag:Boolean;
private var mMainMenuWin:CMainMenu;
private var mGameWin:CGame;
public var mGameOverWin:CGameOverWin;
public var gameInitialized;// = false
public var mCurPageIdx:int;
public var mTableName:String;
public var mSfxPlayOption:Boolean;
public var mSubmitScoreWin:CSubmitScoreWin;
public var game:GSFlashGameAPI;
public var mGlobalFlag:Boolean;
private var mKambingFlag:Boolean;
protected static const WINDOW_OPEN_FUNCTION:String = "window.open";
public static var STATE_GAME = 1;
public static var MainGlobal:Main;
public static var STATE_HTP = 4;
public static var STATE_MAIN_MENU = 2;
public static var STATE_HS = 5;
public static var STATE_PAUSED = 3;
public static var STATE_CREDIT = 6;
public function Main(){
gameInitialized = false;
mLastHSName = "";
mSapiTimer = new Timer(2000, 1);
super();
addFrameScript(0, frame1, 8, frame9, 15, frame16);
mKambingFlag = false;
game = new GSFlashGameAPI(this, "Shape em Up");
mBgmFlag = true;
mSfxPlayOption = true;
loader = new URLLoader();
trace("init main 1");
MainGlobal = this;
mState = STATE_MAIN_MENU;
mContextMenu = new ContextMenu();
mContextMenu.hideBuiltInItems();
mContextMenu.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler, false, 0, true);
this.contextMenu = mContextMenu;
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame, false, 0, true);
mSapiTimer.addEventListener(TimerEvent.TIMER, AllowButtons, false, 0, true);
}
public function KillCredit(_arg1:Boolean=true){
if (mCreditWin){
if (((mCreditWin.parent) && (_arg1))){
mCreditWin.parent.removeChild(mCreditWin);
};
mCreditWin = null;
};
if (mCreditWin != null){
trace("WARNING ### mCreditWin Not null after Kill process");
};
}
private function AllowButtons(_arg1:TimerEvent):void{
mSapiTimer.reset();
}
function frame16(){
Init();
}
public function KillHighScoreWin(_arg1:Boolean=true){
if (mHighScoreWin){
if (((mHighScoreWin.parent) && (_arg1))){
mHighScoreWin.parent.removeChild(mHighScoreWin);
};
mHighScoreWin = null;
};
if (mHighScoreWin != null){
trace("WARNING ### mHighScoreWin Not null after Kill process");
};
}
function frame1(){
stop();
}
public function ShowHSWinAfterGameOver(){
if (mSapiTimer.running){
return;
};
KillGameOverWin();
if (!mGlobalFlag){
mCurPageIdx = 1;
};
Init();
}
function frame9(){
trace("kepleee");
}
private function isPlayerAllowed(_arg1:Array):Boolean{
var _local2:String;
var _local3:Number;
_local2 = Capabilities.playerType;
trace(("PlayerType : " + _local2));
_local3 = 0;
while (_local3 < _arg1.length) {
if (_local2 == _arg1[_local3]){
return (true);
};
_local3++;
};
return (false);
}
public function KillHTP(_arg1:Boolean=true){
if (mHTPWin){
if (((mHTPWin.parent) && (_arg1))){
mHTPWin.parent.removeChild(mHTPWin);
};
mHTPWin = null;
};
if (mHTPWin != null){
trace("WARNING ### mHTPWin Not null after Kill process");
};
}
public function ShowHTP(){
mState = STATE_HTP;
KillHTP();
mHTPWin = new CHTP();
stage.focus = mHTPWin;
mHTPWin.Init();
this.stage.addChild(mHTPWin);
}
private function OnKeyUp(_arg1:KeyboardEvent):void{
var _local2:Sound;
var _local3:SoundTransform;
if (_arg1.keyCode == 32){
CGame.GetInstance().Bomb();
} else {
if (_arg1.keyCode == 112){
trace(("memory : " + System.totalMemory));
CGame.GetInstance().Debug();
} else {
if (_arg1.keyCode == 27){
if (mState == STATE_GAME){
mState = STATE_PAUSED;
mPausedAnim = new pausedAnim();
stage.addChildAt(mPausedAnim, (stage.getChildIndex(mGameWin) + 1));
mPausedAnim.x = (Global.STAGE_WIDTH / 2);
mPausedAnim.y = (Global.STAGE_HEIGHT / 2);
} else {
if (mState == STATE_PAUSED){
mState = STATE_GAME;
if (mPausedAnim){
if (mPausedAnim.parent){
mPausedAnim.parent.removeChild(mPausedAnim);
};
mPausedAnim = null;
};
} else {
if (mState == STATE_HTP){
KillHTP();
Init();
} else {
if (mState == STATE_HS){
KillHighScoreWin();
Init();
};
};
};
};
} else {
if (_arg1.keyCode == 81){
if (mState == STATE_PAUSED){
if (mPausedAnim){
if (mPausedAnim.parent){
mPausedAnim.parent.removeChild(mPausedAnim);
};
mPausedAnim = null;
};
CGame.GetInstance().QuitGame();
};
} else {
if (_arg1.keyCode == 77){
if (!mKambingFlag){
return;
};
if (mSubmitScoreWin){
return;
};
if (mBgmFlag){
mBgmFlag = false;
mSfxChannel.stop();
} else {
mBgmFlag = true;
_local2 = new BGM();
_local3 = new SoundTransform(0.7, 0);
mSfxChannel = _local2.play(0, 999, _local3);
};
} else {
if (_arg1.keyCode == 78){
if (!mKambingFlag){
return;
};
if (mSubmitScoreWin){
return;
};
mSfxPlayOption = !(mSfxPlayOption);
};
};
};
};
};
};
}
public function ShowSubmitScoreWin(_arg1:String, _arg2:int=0){
if (!mSubmitScoreWin){
mSubmitScoreWin = new CSubmitScoreWin(_arg1, _arg2);
this.stage.addChild(mSubmitScoreWin);
mSubmitScoreWin.Init();
};
}
public function ShowMainMenuWin(){
mState = STATE_MAIN_MENU;
KillMainMenuWin();
mMainMenuWin = new CMainMenu();
mMainMenuWin.Init();
this.stage.addChild(mMainMenuWin);
}
public function ShowGameWin(){
KillGameWin();
mGameWin = new CGame();
mGameWin.Init();
this.stage.addChild(mGameWin);
}
public function ShowGameOverWin(_arg1:String="GAME OVER"){
if (!mGameOverWin){
mTableName = "shapesstriker_nilaiTinggi";
mGameOverWin = new CGameOverWin();
mGameOverWin.mTitleText.text = _arg1;
this.stage.addChild(mGameOverWin);
mSapiTimer.reset();
mSapiTimer.start();
mGameOverWin.mScoreText.text = ("Your Score : " + MemoryCrypto.getValue(mGameWin.mScore));
};
}
public function OnEnterFrame(_arg1:Event){
if (((!(gameInitialized)) && (game.Loaded()))){
gameInitialized = true;
this.stage.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
this.gotoAndStop("mainMenu");
};
if (gameInitialized){
switch (mState){
case STATE_GAME:
RunStateGame();
break;
case STATE_PAUSED:
this.dispatchEvent(new Event("pause"));
break;
default:
break;
};
};
}
public function KillGameWin(_arg1:Boolean=true){
if (mGameWin){
mGameWin.Kill();
if (((mGameWin.parent) && (_arg1))){
mGameWin.parent.removeChild(mGameWin);
};
mGameWin = null;
};
if (mGameWin != null){
trace("WARNING ### mGameWin Not null after Kill process");
};
}
private function isDomainAllowed(_arg1:Array):Boolean{
var _local2:LocalConnection;
var _local3:String;
var _local4:Number;
_local2 = new LocalConnection();
_local3 = _local2.domain;
trace(("Domain : " + _local3));
_local4 = 0;
while (_local4 < _arg1.length) {
if (_local3 == _arg1[_local4]){
return (true);
};
_local4++;
};
_local4 = 0;
while (_local4 < _arg1.length) {
if (_local3.substr(-((_arg1[_local4].length + 1))) == ("." + _arg1[_local4])){
return (true);
};
_local4++;
};
return (false);
}
public function Init(){
var _local1:Sound;
var _local2:SoundTransform;
if (!mKambingFlag){
stage.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp, false, 0, true);
_local1 = new BGM();
_local2 = new SoundTransform(0.7, 0);
mSfxChannel = _local1.play(0, 999, _local2);
mKambingFlag = true;
};
ShowMainMenuWin();
CheckDomain();
}
public function InitGame(){
mGlobalFlag = false;
ShowGameWin();
mGameWin.AddDispatcher();
mState = STATE_GAME;
if (this.hasEventListener(Event.ENTER_FRAME)){
this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame);
};
this.addEventListener(Event.ENTER_FRAME, OnEnterFrame, false, 0, true);
this.dispatchEvent(new Event("update"));
}
public function KillSubmitScoreWin(_arg1:Boolean=true){
if (mSubmitScoreWin){
if (((mSubmitScoreWin.parent) && (_arg1))){
mSubmitScoreWin.parent.removeChild(mSubmitScoreWin);
};
mSubmitScoreWin = null;
};
if (mSubmitScoreWin != null){
trace("WARNING ### mSubmitScoreWin Not null after Kill process");
};
}
public function SubmitScore(_arg1:String, _arg2:String, _arg3:int, _arg4:int){
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
_local5 = new URLVariables();
_local5.name = _arg2;
_local5.score = _arg3;
_local5.table = _arg1;
mTableName = _arg1;
mCaller = _arg4;
_local6 = MD5.calculate(("sapimiber7523" + _arg3));
_local5.sapi = _local6;
trace(((((("MD5 : " + _local6) + " - score : ") + _arg3) + " - table : ") + _arg1));
_local7 = new URLRequest();
_local7.url = (Global.HS_URL + "masuknilai.php");
_local7.data = _local5;
loader.load(_local7);
loader.addEventListener(Event.COMPLETE, completeWriting);
}
function completeWriting(_arg1:Event):void{
var _local2:TextField;
var _local3:TextFormat;
var _local4:int;
_local2 = new TextField();
_local2.x = 10;
_local2.y = 200;
loader.removeEventListener(Event.COMPLETE, completeWriting);
_local3 = new TextFormat();
_local3.font = "Arial";
_local3.color = 0xFF0000;
_local3.size = 12;
_local2.multiline = true;
_local3.align = TextFormatAlign.LEFT;
_local2.autoSize = TextFieldAutoSize.LEFT;
_local2.defaultTextFormat = _local3;
_local2.setTextFormat(_local3);
_local2.text = _arg1.target.data;
trace(("Feedback : " + _local2.text));
if (_local2.text == "out"){
mSubmitScoreWin.gotoAndStop(2);
trace("score not enough to be included in high score table");
} else {
_local4 = int(_local2.text.substr(5, (_local2.text.length - 5)));
KillSubmitScoreWin();
trace(("pageIdx : " + _local4));
mCurPageIdx = _local4;
if (mCaller == 0){
mGlobalFlag = true;
} else {
mGroupFlag = true;
};
mGameOverWin.gotoAndStop("Submit");
mGameOverWin.gotoAndStop("Menu");
};
}
public function ShowHighScoreWin(_arg1:String="shapesstriker_nilaiTinggi", _arg2:int=1){
if (!mHighScoreWin){
mState = STATE_HS;
trace(("group name @ShowHighScoreWin : " + _arg1));
mHighScoreWin = new CHSWin();
stage.focus = mHighScoreWin;
this.stage.addChild(mHighScoreWin);
mHighScoreWin.Init(_arg1, _arg2);
};
}
private function menuSelectHandler(_arg1:ContextMenuEvent){
}
public function ShowCreditWin(){
mState = STATE_CREDIT;
KillCredit();
mCreditWin = new CCreditWin();
mCreditWin.Init();
this.stage.addChild(mCreditWin);
}
public function KillMainMenuWin(_arg1:Boolean=true){
if (mMainMenuWin){
if (((mMainMenuWin.parent) && (_arg1))){
mMainMenuWin.parent.removeChild(mMainMenuWin);
};
mMainMenuWin = null;
};
if (mMainMenuWin != null){
trace("WARNING ### mGameWin Not null after Kill process");
};
}
public function CheckDomain(){
var _local1:Array;
var _local2:Array;
_local1 = new Array("lazybanana.com", "lazybananagames.com", "www.flashgamelicense.com", "flashgamelicense.com");
_local2 = new Array();
if (((!(isDomainAllowed(_local1))) && (!(isPlayerAllowed(_local2))))){
trace("BANNED DOMAIN !!!");
} else {
trace("Allowed DOMAIN !!!");
};
}
public function KillGameOverWin(_arg1:Boolean=true){
if (mGameOverWin){
if (((mGameOverWin.parent) && (_arg1))){
mGameOverWin.parent.removeChild(mGameOverWin);
};
mGameOverWin = null;
};
if (mGameOverWin != null){
trace("WARNING ### mGameOverWin Not null after Kill process");
};
}
private function RunStateGame(){
this.dispatchEvent(new Event("update"));
}
public static function openWindow(_arg1:String="http://www.lazybanana.com", _arg2:String="_blank", _arg3:String=""):void{
ExternalInterface.call(WINDOW_OPEN_FUNCTION, _arg1, _arg2, _arg3);
}
public static function GetInstance():Main{
return (MainGlobal);
}
}
}//package
Section 87
//pausedAnim (pausedAnim)
package {
import flash.display.*;
public dynamic class pausedAnim extends MovieClip {
}
}//package
Section 88
//PlayButtonDown (PlayButtonDown)
package {
import flash.display.*;
public dynamic class PlayButtonDown extends MovieClip {
public var button_mc:MovieClip;
}
}//package
Section 89
//PlayButtonNormal (PlayButtonNormal)
package {
import flash.display.*;
public dynamic class PlayButtonNormal extends MovieClip {
public var icon_mc:MovieClip;
public var button_mc:MovieClip;
}
}//package
Section 90
//PlayButtonOver (PlayButtonOver)
package {
import flash.display.*;
public dynamic class PlayButtonOver extends MovieClip {
public var button_mc:MovieClip;
}
}//package
Section 91
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 92
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 93
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 94
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 95
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 96
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 97
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 98
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 99
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 100
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 101
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 102
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 103
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 104
//SFX1 (SFX1)
package {
import flash.media.*;
public dynamic class SFX1 extends Sound {
}
}//package
Section 105
//SFX2 (SFX2)
package {
import flash.media.*;
public dynamic class SFX2 extends Sound {
}
}//package
Section 106
//SFX3 (SFX3)
package {
import flash.media.*;
public dynamic class SFX3 extends Sound {
}
}//package