Section 1
//ColorMatrix (com.threerings.display.ColorMatrix)
package com.threerings.display {
import flash.filters.*;
public class ColorMatrix {
public var matrix:Array;
protected var _hueInitialized:Boolean;
protected var _preHue:ColorMatrix;
protected var _postHue:ColorMatrix;
protected static const ONETHIRD:Number = 0.333333333333333;
protected static const LUMA_G:Number = 0.71516;
protected static const LUMA_B:Number = 0.072169;
protected static const LUMA_R2:Number = 0.3086;
protected static const LUMA_G2:Number = 0.6094;
protected static const LUMA_R:Number = 0.212671;
protected static const LUMA_B2:Number = 0.082;
protected static const RAD:Number = 0.0174532925199433;
protected static const IDENTITY:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
public static const COLOR_DEFICIENCY_TYPES:Array = ["Protanopia", "Protanomaly", "Deuteranopia", "Deuteranomaly", "Tritanopia", "Tritanomaly", "Achromatopsia", "Achromatomaly"];
public function ColorMatrix(_arg1:Object=null){
if ((_arg1 is ColorMatrix)){
matrix = _arg1.matrix.concat();
} else {
if ((_arg1 is Array)){
matrix = _arg1.concat();
} else {
reset();
};
};
}
public function makeGrayscale():ColorMatrix{
return (average(ONETHIRD, ONETHIRD, ONETHIRD));
}
protected function shearColor(_arg1:int, _arg2:int, _arg3:Number, _arg4:int, _arg5:Number):ColorMatrix{
var _local6:Array;
_local6 = IDENTITY.concat();
_local6[(_arg2 + (_arg1 * 5))] = _arg3;
_local6[(_arg4 + (_arg1 * 5))] = _arg5;
return (concat(_local6));
}
public function colorize(_arg1:int, _arg2:Number=1):ColorMatrix{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = (((_arg1 >> 16) & 0xFF) / 0xFF);
_local4 = (((_arg1 >> 8) & 0xFF) / 0xFF);
_local5 = ((_arg1 & 0xFF) / 0xFF);
_local6 = (1 - _arg2);
return (concat([(_local6 + ((_arg2 * _local3) * LUMA_R)), ((_arg2 * _local3) * LUMA_G), ((_arg2 * _local3) * LUMA_B), 0, 0, ((_arg2 * _local4) * LUMA_R), (_local6 + ((_arg2 * _local4) * LUMA_G)), ((_arg2 * _local4) * LUMA_B), 0, 0, ((_arg2 * _local5) * LUMA_R), ((_arg2 * _local5) * LUMA_G), (_local6 + ((_arg2 * _local5) * LUMA_B)), 0, 0, 0, 0, 0, 1, 0]));
}
public function adjustColor(_arg1:int, _arg2:int, _arg3:int, _arg4:int):ColorMatrix{
var _local5:Number;
if (_arg1 != 0){
adjustBrightness(_arg1, _arg1, _arg1);
};
if (_arg2 != 0){
_local5 = (_arg2 * 0.01);
adjustContrast(_local5, _local5, _local5);
};
if (_arg3 != 0){
adjustSaturation((1 + (_arg3 * 0.01)));
};
if (_arg4 != 0){
adjustHue(_arg4);
};
return (this);
}
public function createFilter():ColorMatrixFilter{
return (new ColorMatrixFilter(matrix));
}
public function setAlpha(_arg1:Number):ColorMatrix{
return (concat([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, _arg1, 0]));
}
public function rotateHue(_arg1:Number):ColorMatrix{
initHue();
concat(_preHue.matrix);
rotateBlue(_arg1);
return (concat(_postHue.matrix));
}
public function shearGreen(_arg1:Number, _arg2:Number):ColorMatrix{
return (shearColor(1, 0, _arg1, 2, _arg2));
}
public function concat(_arg1:Array):ColorMatrix{
var _local2:int;
var _local3:Array;
var _local4:int;
var _local5:int;
_local3 = [];
_local4 = 0;
while (_local4 < 4) {
_local5 = 0;
while (_local5 < 5) {
_local3[int((_local2 + _local5))] = (((((Number(_arg1[_local2]) * Number(matrix[_local5])) + (Number(_arg1[int((_local2 + 1))]) * Number(matrix[int((_local5 + 5))]))) + (Number(_arg1[int((_local2 + 2))]) * Number(matrix[int((_local5 + 10))]))) + (Number(_arg1[int((_local2 + 3))]) * Number(matrix[int((_local5 + 15))]))) + ((_local5 == 4)) ? Number(_arg1[int((_local2 + 4))]) : 0);
_local5++;
};
_local2 = (_local2 + 5);
_local4++;
};
matrix = _local3;
return (this);
}
public function average(_arg1:Number, _arg2:Number, _arg3:Number):ColorMatrix{
return (concat([_arg1, _arg2, _arg3, 0, 0, _arg1, _arg2, _arg3, 0, 0, _arg1, _arg2, _arg3, 0, 0, 0, 0, 0, 1, 0]));
}
public function invertAlpha():ColorMatrix{
return (concat([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0xFF]));
}
public function desaturate():ColorMatrix{
return (concat([LUMA_R, LUMA_G, LUMA_B, 0, 0, LUMA_R, LUMA_G, LUMA_B, 0, 0, LUMA_R, LUMA_G, LUMA_B, 0, 0, 0, 0, 0, 1, 0]));
}
public function randomize(_arg1:Number=1):ColorMatrix{
var _local2:Number;
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;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = (1 - _arg1);
_local3 = (_local2 + (_arg1 * (Math.random() - Math.random())));
_local4 = (_arg1 * (Math.random() - Math.random()));
_local5 = (_arg1 * (Math.random() - Math.random()));
_local6 = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
_local7 = (_arg1 * (Math.random() - Math.random()));
_local8 = (_local2 + (_arg1 * (Math.random() - Math.random())));
_local9 = (_arg1 * (Math.random() - Math.random()));
_local10 = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
_local11 = (_arg1 * (Math.random() - Math.random()));
_local12 = (_arg1 * (Math.random() - Math.random()));
_local13 = (_local2 + (_arg1 * (Math.random() - Math.random())));
_local14 = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
return (concat([_local3, _local4, _local5, 0, _local6, _local7, _local8, _local9, 0, _local10, _local11, _local12, _local13, 0, _local14, 0, 0, 0, 1, 0]));
}
public function rotateRed(_arg1:Number):ColorMatrix{
return (rotateColor(_arg1, 2, 1));
}
public function adjustContrast(_arg1:Number, _arg2:Number=NaN, _arg3:Number=NaN):ColorMatrix{
if (isNaN(_arg2)){
_arg2 = _arg1;
};
if (isNaN(_arg3)){
_arg3 = _arg1;
};
_arg1 = (_arg1 + 1);
_arg2 = (_arg2 + 1);
_arg3 = (_arg3 + 1);
return (concat([_arg1, 0, 0, 0, (128 * (1 - _arg1)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg3, 0, (128 * (1 - _arg3)), 0, 0, 0, 1, 0]));
}
public function thresholdAlpha(_arg1:Number, _arg2:Number=0x0100):ColorMatrix{
return (concat([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, _arg2, (-(_arg2) * _arg1)]));
}
public function averageRGB2Alpha():ColorMatrix{
return (concat([0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, ONETHIRD, ONETHIRD, ONETHIRD, 0, 0]));
}
public function clearChannels(_arg1:Boolean=false, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false):ColorMatrix{
if (_arg1){
matrix[0] = (matrix[1] = (matrix[2] = (matrix[3] = (matrix[4] = 0))));
};
if (_arg2){
matrix[5] = (matrix[6] = (matrix[7] = (matrix[8] = (matrix[9] = 0))));
};
if (_arg3){
matrix[10] = (matrix[11] = (matrix[12] = (matrix[13] = (matrix[14] = 0))));
};
if (_arg4){
matrix[15] = (matrix[16] = (matrix[17] = (matrix[18] = (matrix[19] = 0))));
};
return (this);
}
public function applyColorDeficiency(_arg1:String):ColorMatrix{
switch (_arg1){
case "Protanopia":
concat([0.567, 0.433, 0, 0, 0, 0.558, 0.442, 0, 0, 0, 0, 0.242, 0.758, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Protanomaly":
concat([0.817, 0.183, 0, 0, 0, 0.333, 0.667, 0, 0, 0, 0, 0.125, 0.875, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Deuteranopia":
concat([0.625, 0.375, 0, 0, 0, 0.7, 0.3, 0, 0, 0, 0, 0.3, 0.7, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Deuteranomaly":
concat([0.8, 0.2, 0, 0, 0, 0.258, 0.742, 0, 0, 0, 0, 0.142, 0.858, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Tritanopia":
concat([0.95, 0.05, 0, 0, 0, 0, 0.433, 0.567, 0, 0, 0, 0.475, 0.525, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Tritanomaly":
concat([0.967, 0.033, 0, 0, 0, 0, 0.733, 0.267, 0, 0, 0, 0.183, 0.817, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Achromatopsia":
concat([0.299, 0.587, 0.114, 0, 0, 0.299, 0.587, 0.114, 0, 0, 0.299, 0.587, 0.114, 0, 0, 0, 0, 0, 1, 0]);
break;
case "Achromatomaly":
concat([0.618, 0.32, 0.062, 0, 0, 0.163, 0.775, 0.062, 0, 0, 0.163, 0.32, 0.516, 0, 0, 0, 0, 0, 1, 0]);
break;
};
return (this);
}
public function adjustBrightness(_arg1:Number, _arg2:Number=NaN, _arg3:Number=NaN):ColorMatrix{
if (isNaN(_arg2)){
_arg2 = _arg1;
};
if (isNaN(_arg3)){
_arg3 = _arg1;
};
return (concat([1, 0, 0, 0, _arg1, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg3, 0, 0, 0, 1, 0]));
}
public function adjustSaturation(_arg1:Number):ColorMatrix{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = (1 - _arg1);
_local3 = (_local2 * LUMA_R);
_local4 = (_local2 * LUMA_G);
_local5 = (_local2 * LUMA_B);
return (concat([(_local3 + _arg1), _local4, _local5, 0, 0, _local3, (_local4 + _arg1), _local5, 0, 0, _local3, _local4, (_local5 + _arg1), 0, 0, 0, 0, 0, 1, 0]));
}
public function luminance2Alpha():ColorMatrix{
return (concat([0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, LUMA_R, LUMA_G, LUMA_B, 0, 0]));
}
public function adjustAlphaContrast(_arg1:Number):ColorMatrix{
_arg1 = (_arg1 + 1);
return (concat([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, _arg1, (128 * (1 - _arg1))]));
}
public function reset():ColorMatrix{
matrix = IDENTITY.concat();
return (this);
}
public function blend(_arg1:ColorMatrix, _arg2:Number):ColorMatrix{
var _local3:Number;
var _local4:int;
_local3 = (1 - _arg2);
_local4 = 0;
while (_local4 < 20) {
matrix[_local4] = ((_local3 * Number(matrix[_local4])) + (_arg2 * Number(_arg1.matrix[_local4])));
_local4++;
};
return (this);
}
public function setChannels(_arg1:int=1, _arg2:int=2, _arg3:int=4, _arg4:int=8):ColorMatrix{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local5 = (((((((_arg1 & 1) == 1)) ? 1 : ((0 + ((_arg1 & 2) == 2))) ? 1 : 0 + ((_arg1 & 4) == 4))) ? 1 : 0 + ((_arg1 & 8) == 8))) ? 1 : 0;
if (_local5 > 0){
_local5 = (1 / _local5);
};
_local6 = (((((((_arg2 & 1) == 1)) ? 1 : ((0 + ((_arg2 & 2) == 2))) ? 1 : 0 + ((_arg2 & 4) == 4))) ? 1 : 0 + ((_arg2 & 8) == 8))) ? 1 : 0;
if (_local6 > 0){
_local6 = (1 / _local6);
};
_local7 = (((((((_arg3 & 1) == 1)) ? 1 : ((0 + ((_arg3 & 2) == 2))) ? 1 : 0 + ((_arg3 & 4) == 4))) ? 1 : 0 + ((_arg3 & 8) == 8))) ? 1 : 0;
if (_local7 > 0){
_local7 = (1 / _local7);
};
_local8 = (((((((_arg4 & 1) == 1)) ? 1 : ((0 + ((_arg4 & 2) == 2))) ? 1 : 0 + ((_arg4 & 4) == 4))) ? 1 : 0 + ((_arg4 & 8) == 8))) ? 1 : 0;
if (_local8 > 0){
_local8 = (1 / _local8);
};
return (concat([(((_arg1 & 1) == 1)) ? _local5 : 0, (((_arg1 & 2) == 2)) ? _local5 : 0, (((_arg1 & 4) == 4)) ? _local5 : 0, (((_arg1 & 8) == 8)) ? _local5 : 0, 0, (((_arg2 & 1) == 1)) ? _local6 : 0, (((_arg2 & 2) == 2)) ? _local6 : 0, (((_arg2 & 4) == 4)) ? _local6 : 0, (((_arg2 & 8) == 8)) ? _local6 : 0, 0, (((_arg3 & 1) == 1)) ? _local7 : 0, (((_arg3 & 2) == 2)) ? _local7 : 0, (((_arg3 & 4) == 4)) ? _local7 : 0, (((_arg3 & 8) == 8)) ? _local7 : 0, 0, (((_arg4 & 1) == 1)) ? _local8 : 0, (((_arg4 & 2) == 2)) ? _local8 : 0, (((_arg4 & 4) == 4)) ? _local8 : 0, (((_arg4 & 8) == 8)) ? _local8 : 0, 0]));
}
public function rotateBlue(_arg1:Number):ColorMatrix{
return (rotateColor(_arg1, 1, 0));
}
public function invert():ColorMatrix{
return (concat([-1, 0, 0, 0, 0xFF, 0, -1, 0, 0, 0xFF, 0, 0, -1, 0, 0xFF, 0, 0, 0, 1, 0]));
}
protected function rotateColor(_arg1:Number, _arg2:int, _arg3:int):ColorMatrix{
var _local4:Array;
_arg1 = (_arg1 * RAD);
_local4 = IDENTITY.concat();
_local4[(_arg2 + (_arg2 * 5))] = (_local4[(_arg3 + (_arg3 * 5))] = Math.cos(_arg1));
_local4[(_arg3 + (_arg2 * 5))] = Math.sin(_arg1);
_local4[(_arg2 + (_arg3 * 5))] = -(Math.sin(_arg1));
return (concat(_local4));
}
public function rgb2Alpha(_arg1:Number, _arg2:Number, _arg3:Number):ColorMatrix{
return (concat([0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, 0, 0, 0, 0, 0xFF, _arg1, _arg2, _arg3, 0, 0]));
}
public function shearBlue(_arg1:Number, _arg2:Number):ColorMatrix{
return (shearColor(2, 0, _arg1, 1, _arg2));
}
public function clone():ColorMatrix{
return (new ColorMatrix(matrix));
}
public function applyMatrix(_arg1:uint):uint{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
_local2 = ((_arg1 >>> 24) & 0xFF);
_local3 = ((_arg1 >>> 16) & 0xFF);
_local4 = ((_arg1 >>> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
_local6 = (((((0.5 + (_local3 * matrix[0])) + (_local4 * matrix[1])) + (_local5 * matrix[2])) + (_local2 * matrix[3])) + matrix[4]);
_local7 = (((((0.5 + (_local3 * matrix[5])) + (_local4 * matrix[6])) + (_local5 * matrix[7])) + (_local2 * matrix[8])) + matrix[9]);
_local8 = (((((0.5 + (_local3 * matrix[10])) + (_local4 * matrix[11])) + (_local5 * matrix[12])) + (_local2 * matrix[13])) + matrix[14]);
_local9 = (((((0.5 + (_local3 * matrix[15])) + (_local4 * matrix[16])) + (_local5 * matrix[17])) + (_local2 * matrix[18])) + matrix[19]);
_local9 = Math.max(_local9, 0);
_local9 = Math.min(_local9, 0xFF);
_local6 = Math.max(_local6, 0);
_local6 = Math.min(_local6, 0xFF);
_local7 = Math.max(_local7, 0);
_local7 = Math.min(_local7, 0xFF);
_local8 = Math.max(_local8, 0);
_local8 = Math.min(_local8, 0xFF);
return (((((_local9 << 24) | (_local6 << 16)) | (_local7 << 8)) | _local8));
}
protected function initHue():void{
var _local1:Number;
var _local2:Array;
var _local3:Number;
var _local4:Number;
_local1 = 39.182655;
if (!_hueInitialized){
_hueInitialized = true;
_preHue = new ColorMatrix();
_preHue.rotateRed(45);
_preHue.rotateGreen(-(_local1));
_local2 = [LUMA_R2, LUMA_G2, LUMA_B2, 1];
_preHue.transformVector(_local2);
_local3 = (_local2[0] / _local2[2]);
_local4 = (_local2[1] / _local2[2]);
_preHue.shearBlue(_local3, _local4);
_postHue = new ColorMatrix();
_postHue.shearBlue(-(_local3), -(_local4));
_postHue.rotateGreen(_local1);
_postHue.rotateRed(-45);
};
}
public function transformVector(_arg1:Array):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (_arg1.length != 4){
return;
};
_local2 = (((((_arg1[0] * matrix[0]) + (_arg1[1] * matrix[1])) + (_arg1[2] * matrix[2])) + (_arg1[3] * matrix[3])) + matrix[4]);
_local3 = (((((_arg1[0] * matrix[5]) + (_arg1[1] * matrix[6])) + (_arg1[2] * matrix[7])) + (_arg1[3] * matrix[8])) + matrix[9]);
_local4 = (((((_arg1[0] * matrix[10]) + (_arg1[1] * matrix[11])) + (_arg1[2] * matrix[12])) + (_arg1[3] * matrix[13])) + matrix[14]);
_local5 = (((((_arg1[0] * matrix[15]) + (_arg1[1] * matrix[16])) + (_arg1[2] * matrix[17])) + (_arg1[3] * matrix[18])) + matrix[19]);
_arg1[0] = _local2;
_arg1[1] = _local3;
_arg1[2] = _local4;
_arg1[3] = _local5;
}
public function adjustHue(_arg1:Number):ColorMatrix{
var _local2:Number;
var _local3:Number;
_arg1 = (_arg1 * RAD);
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
return (concat([((LUMA_R + (_local2 * (1 - LUMA_R))) + (_local3 * -(LUMA_R))), ((LUMA_G + (_local2 * -(LUMA_G))) + (_local3 * -(LUMA_G))), ((LUMA_B + (_local2 * -(LUMA_B))) + (_local3 * (1 - LUMA_B))), 0, 0, ((LUMA_R + (_local2 * -(LUMA_R))) + (_local3 * 0.143)), ((LUMA_G + (_local2 * (1 - LUMA_G))) + (_local3 * 0.14)), ((LUMA_B + (_local2 * -(LUMA_B))) + (_local3 * -0.283)), 0, 0, ((LUMA_R + (_local2 * -(LUMA_R))) + (_local3 * -((1 - LUMA_R)))), ((LUMA_G + (_local2 * -(LUMA_G))) + (_local3 * LUMA_G)), ((LUMA_B + (_local2 * (1 - LUMA_B))) + (_local3 * LUMA_B)), 0, 0, 0, 0, 0, 1, 0]));
}
public function threshold(_arg1:Number, _arg2:Number=0x0100):ColorMatrix{
concat([(LUMA_R * _arg2), (LUMA_G * _arg2), (LUMA_B * _arg2), 0, (-(_arg2) * _arg1), (LUMA_R * _arg2), (LUMA_G * _arg2), (LUMA_B * _arg2), 0, (-(_arg2) * _arg1), (LUMA_R * _arg2), (LUMA_G * _arg2), (LUMA_B * _arg2), 0, (-(_arg2) * _arg1), 0, 0, 0, 1, 0]);
return (this);
}
public function rotateGreen(_arg1:Number):ColorMatrix{
return (rotateColor(_arg1, 0, 2));
}
public function setMultiplicators(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1):ColorMatrix{
var _local5:Array;
_local5 = new Array(_arg1, 0, 0, 0, 0, 0, _arg2, 0, 0, 0, 0, 0, _arg3, 0, 0, 0, 0, 0, _arg4, 0);
return (concat(_local5));
}
public function shearRed(_arg1:Number, _arg2:Number):ColorMatrix{
return (shearColor(0, 1, _arg1, 2, _arg2));
}
public function tint(_arg1:Number, _arg2:Number=1):ColorMatrix{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
_local3 = (((_arg1 >> 16) & 0xFF) * _arg2);
_local4 = (((_arg1 >> 8) & 0xFF) * _arg2);
_local5 = ((_arg1 & 0xFF) * _arg2);
_local6 = (1 - _arg2);
_local7 = [_local6, 0, 0, 0, _local3, 0, _local6, 0, 0, _local4, 0, 0, _local6, 0, _local5, 0, 0, 0, 1, 0];
return (concat(_local7));
}
}
}//package com.threerings.display
Section 2
//DisplayUtil (com.threerings.display.DisplayUtil)
package com.threerings.display {
import flash.display.*;
import flash.geom.*;
import com.threerings.util.*;
public class DisplayUtil {
public static function dumpHierarchy(_arg1:DisplayObject):String{
return (dumpHierarchy0(_arg1));
}
public static function centerRectInRect(_arg1:Rectangle, _arg2:Rectangle):Point{
return (new Point((_arg2.x + Math.max(0, ((_arg2.width - _arg1.width) / 2))), (_arg2.y + Math.max(0, ((_arg2.height - _arg1.height) / 2)))));
}
public static function sortDisplayChildren(_arg1:DisplayObjectContainer, _arg2:Function=null):void{
var _local3:int;
var _local4:Array;
var _local5:int;
_local3 = _arg1.numChildren;
_local4 = new Array(_local3);
_local5 = 0;
while (_local5 < _local3) {
_local4[_local5] = _arg1.getChildAt(_local5);
_local5++;
};
ArrayUtil.stableSort(_local4, _arg2);
_local5 = 0;
while (_local5 < _local3) {
_arg1.setChildIndex(DisplayObject(_local4[_local5]), _local5);
_local5++;
};
}
public static function transformPoint(_arg1:Point, _arg2:DisplayObject, _arg3:DisplayObject):Point{
return (_arg3.globalToLocal(_arg2.localToGlobal(_arg1)));
}
public static function positionBounds(_arg1:DisplayObject, _arg2:Number, _arg3:Number):void{
positionBoundsRelative(_arg1, _arg1, _arg2, _arg3);
}
public static function addChildAbove(_arg1:DisplayObjectContainer, _arg2:DisplayObject, _arg3:DisplayObject):void{
_arg1.addChildAt(_arg2, (_arg1.getChildIndex(_arg3) + 1));
}
public static function positionBoundsRelative(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:Number, _arg4:Number):void{
var _local5:Rectangle;
_local5 = _arg1.getBounds(_arg2);
_arg1.x = (_arg3 - _local5.left);
_arg1.y = (_arg4 - _local5.top);
}
public static function applyToHierarchy(_arg1:DisplayObject, _arg2:Function):void{
var container:DisplayObjectContainer;
var nn:int;
var ii:int;
var disp = _arg1;
var callbackFunction = _arg2;
callbackFunction(disp);
if ((disp is DisplayObjectContainer)){
container = (disp as DisplayObjectContainer);
nn = container.numChildren;
ii = 0;
for (;ii < nn;(ii = (ii + 1))) {
disp = container.getChildAt(ii);
//unresolved jump
var _slot1 = err;
continue;
applyToHierarchy(disp, callbackFunction);
};
};
}
public static function positionRect(_arg1:Rectangle, _arg2:Rectangle, _arg3:Array):Boolean{
var origPos:Point;
var pointSorter:Function;
var possibles:Array;
var dead:Array;
var p:Point;
var deadRect:Rectangle;
var ii:int;
var avoidRect:Rectangle;
var r = _arg1;
var bounds = _arg2;
var avoid = _arg3;
origPos = r.topLeft;
pointSorter = createPointSorter(origPos);
possibles = new Array();
possibles.push(fitRectInRect(r, bounds));
dead = new Array();
while (possibles.length > 0) {
try {
p = (possibles.shift() as Point);
r.x = p.x;
r.y = p.y;
if (!bounds.containsRect(r)){
continue;
};
for each (deadRect in dead) {
if (deadRect.intersects(r)){
throw (true);
};
};
ii = 0;
while (ii < avoid.length) {
avoidRect = (avoid[ii] as Rectangle);
if (avoidRect.intersects(r)){
avoid.splice(ii, 1);
dead.push(avoidRect);
possibles.push(new Point((avoidRect.x - r.width), r.y), new Point(r.x, (avoidRect.y - r.height)), new Point((avoidRect.x + avoidRect.width), r.y), new Point(r.x, (avoidRect.y + avoidRect.height)));
possibles.sort(pointSorter);
throw (true);
};
ii = (ii + 1);
};
return (true);
} catch(continueWhile:Boolean) {
};
};
r.x = origPos.x;
r.y = origPos.y;
return (false);
}
private static function dumpHierarchy0(_arg1:DisplayObject, _arg2:String="", _arg3:String=""):String{
var container:DisplayObjectContainer;
var ii:int;
var child:DisplayObject;
var obj = _arg1;
var spaces = _arg2;
var inStr = _arg3;
if (obj != null){
if (inStr != ""){
inStr = (inStr + "\n");
};
inStr = (inStr + ((((spaces + "\"") + obj.name) + "\" ") + ClassUtil.getClassName(obj)));
if ((obj is DisplayObjectContainer)){
spaces = (spaces + " ");
container = (obj as DisplayObjectContainer);
ii = 0;
while (ii < container.numChildren) {
try {
child = container.getChildAt(ii);
inStr = dumpHierarchy0(container.getChildAt(ii), spaces, inStr);
} catch(err:SecurityError) {
inStr = (inStr + (("\n" + spaces) + "SECURITY-BLOCKED"));
};
ii = (ii + 1);
};
};
};
return (inStr);
}
public static function addChildBelow(_arg1:DisplayObjectContainer, _arg2:DisplayObject, _arg3:DisplayObject):void{
_arg1.addChildAt(_arg2, _arg1.getChildIndex(_arg3));
}
public static function findInHierarchy(_arg1:DisplayObject, _arg2:String, _arg3:Boolean=true, _arg4:int=2147483647):DisplayObject{
var _local5:Array;
_local5 = findInHierarchy0(_arg1, _arg2, _arg3, _arg4);
return (((_local5)!=null) ? DisplayObject(_local5[0]) : null);
}
private static function findInHierarchy0(_arg1:DisplayObject, _arg2:String, _arg3:Boolean, _arg4:int, _arg5:int=0):Array{
var bestResult:Array;
var cont:DisplayObjectContainer;
var nextDepth:int;
var ii:int;
var result:Array;
var obj = _arg1;
var name = _arg2;
var shallow = _arg3;
var maxDepth = _arg4;
var curDepth = _arg5;
if (obj == null){
return (null);
};
if (obj.name == name){
if (shallow){
return ([obj, curDepth]);
};
bestResult = [obj, curDepth];
} else {
bestResult = null;
};
if ((((curDepth < maxDepth)) && ((obj is DisplayObjectContainer)))){
cont = (obj as DisplayObjectContainer);
nextDepth = (curDepth + 1);
ii = 0;
while (ii < cont.numChildren) {
try {
result = findInHierarchy0(cont.getChildAt(ii), name, shallow, maxDepth, nextDepth);
if (result != null){
if (shallow){
bestResult = result;
maxDepth = (int(result[1]) - 1);
if (maxDepth == curDepth){
break;
};
} else {
if ((((bestResult == null)) || ((int(result[1]) > int(bestResult[1]))))){
bestResult = result;
};
};
};
} catch(err:SecurityError) {
};
ii = (ii + 1);
};
};
return (bestResult);
}
public static function fitRectInRect(_arg1:Rectangle, _arg2:Rectangle):Point{
return (new Point(Math.min((_arg2.right - _arg1.width), Math.max(_arg1.x, _arg2.x)), Math.min((_arg2.bottom - _arg1.height), Math.max(_arg1.y, _arg2.y))));
}
public static function createPointSorter(_arg1:Point):Function{
var origin = _arg1;
return (function (_arg1:Point, _arg2:Point):Number{
var _local3:*;
var _local4:*;
_local3 = Point.distance(origin, _arg1);
_local4 = Point.distance(origin, _arg2);
return (((_local3)>_local4) ? 1 : ((_local3)<_local4) ? -1 : 0);
});
}
}
}//package com.threerings.display
Section 3
//AbstractMap (com.threerings.util.maps.AbstractMap)
package com.threerings.util.maps {
public class AbstractMap {
protected var _size:int;
public function size():int{
return (_size);
}
public function isEmpty():Boolean{
return ((0 == size()));
}
}
}//package com.threerings.util.maps
Section 4
//DefaultValueMap (com.threerings.util.maps.DefaultValueMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class DefaultValueMap extends ForwardingMap {
protected var _defVal:Object;
public function DefaultValueMap(_arg1:Map, _arg2:Object){
super(_arg1);
_defVal = _arg2;
}
override public function get(_arg1:Object){
var _local2:*;
_local2 = super.get(_arg1);
return (((_local2)!==undefined) ? _local2 : _defVal);
}
}
}//package com.threerings.util.maps
Section 5
//DictionaryMap (com.threerings.util.maps.DictionaryMap)
package com.threerings.util.maps {
import com.threerings.util.*;
import flash.utils.*;
public class DictionaryMap extends AbstractMap implements Map {
protected var _dict:Dictionary;
public function DictionaryMap(){
_dict = new Dictionary();
super();
}
public function containsKey(_arg1:Object):Boolean{
return ((_arg1 in _dict));
}
public function remove(_arg1:Object){
var _local2:*;
_local2 = _dict[_arg1];
if (_local2 !== undefined){
delete _dict[_arg1];
_size--;
};
return (_local2);
}
public function clear():void{
_dict = new Dictionary();
_size = 0;
}
public function get(_arg1:Object){
return (_dict[_arg1]);
}
public function values():Array{
return (Util.values(_dict));
}
public function forEach(_arg1:Function):void{
var _local2:Object;
for (_local2 in _dict) {
if (Boolean(_arg1(_local2, _dict[_local2]))){
return;
};
};
}
public function keys():Array{
return (Util.keys(_dict));
}
public function put(_arg1:Object, _arg2:Object){
var _local3:*;
_local3 = _dict[_arg1];
_dict[_arg1] = _arg2;
if (_local3 === undefined){
_size++;
};
return (_local3);
}
}
}//package com.threerings.util.maps
Section 6
//ExpiringEntry (com.threerings.util.maps.ExpiringEntry)
package com.threerings.util.maps {
public class ExpiringEntry extends LinkedEntry {
public var expireTime:int;
public function ExpiringEntry(_arg1:Object, _arg2:Object, _arg3:int){
super(_arg1, _arg2);
this.expireTime = _arg3;
}
}
}//package com.threerings.util.maps
Section 7
//ExpiringMap (com.threerings.util.maps.ExpiringMap)
package com.threerings.util.maps {
import flash.events.*;
import com.threerings.util.*;
import flash.utils.*;
public class ExpiringMap extends LinkedMap {
protected var _timer:Timer;
protected var _expireHandler:Function;
protected var _ttl:int;
public function ExpiringMap(_arg1:Map, _arg2:int, _arg3:Function=null){
super(_arg1);
_ttl = _arg2;
_expireHandler = _arg3;
_timer = new Timer(_ttl, 1);
_timer.addEventListener(TimerEvent.TIMER, handleTimer);
}
override protected function newEntry(_arg1:Object, _arg2:Object):LinkedEntry{
var _local3:ExpiringEntry;
_local3 = new ExpiringEntry(_arg1, _arg2, (getTimer() + _ttl));
if (!_timer.running){
_timer.delay = _ttl;
_timer.start();
};
return (_local3);
}
protected function handleTimer(_arg1:TimerEvent):void{
var now:int;
var exp:ExpiringEntry;
var untilExpire:int;
var event = _arg1;
_timer.reset();
now = getTimer();
while ((_anchor.after is ExpiringEntry)) {
exp = ExpiringEntry(_anchor.after);
untilExpire = (exp.expireTime - now);
if (untilExpire <= 0){
remove(exp.key);
if (_expireHandler != null){
try {
_expireHandler(exp.key, exp.value);
} catch(e:Error) {
Log.getLog(this).warning("Error calling expire handler", e);
};
};
} else {
_timer.delay = untilExpire;
_timer.start();
return;
};
};
}
}
}//package com.threerings.util.maps
Section 8
//ForeachingMap (com.threerings.util.maps.ForeachingMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class ForeachingMap extends ForwardingMap {
public function ForeachingMap(_arg1:Map){
super(_arg1);
}
override public function values():Array{
var arr:Array;
arr = [];
forEach(function (_arg1, _arg2):void{
arr.push(_arg2);
});
return (arr);
}
override public function keys():Array{
var arr:Array;
arr = [];
forEach(function (_arg1, _arg2):void{
arr.push(_arg1);
});
return (arr);
}
}
}//package com.threerings.util.maps
Section 9
//ForwardingMap (com.threerings.util.maps.ForwardingMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class ForwardingMap implements Map {
protected var _source:Map;
public function ForwardingMap(_arg1:Map){
_source = Preconditions.checkNotNull(_arg1);
}
public function containsKey(_arg1:Object):Boolean{
return (_source.containsKey(_arg1));
}
public function isEmpty():Boolean{
return (_source.isEmpty());
}
public function remove(_arg1:Object){
return (_source.remove(_arg1));
}
public function size():int{
return (_source.size());
}
public function clear():void{
_source.clear();
}
public function put(_arg1:Object, _arg2:Object){
return (_source.put(_arg1, _arg2));
}
public function values():Array{
return (_source.values());
}
public function get(_arg1:Object){
return (_source.get(_arg1));
}
public function forEach(_arg1:Function):void{
_source.forEach(_arg1);
}
public function keys():Array{
return (_source.keys());
}
}
}//package com.threerings.util.maps
Section 10
//HashMap (com.threerings.util.maps.HashMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class HashMap extends AbstractMap implements Map {
protected var _entries:Array;
protected var _loadFactor:Number;
protected static const DEFAULT_BUCKETS:int = 16;
public function HashMap(_arg1:Number=1.75){
_loadFactor = _arg1;
clear();
}
public function containsKey(_arg1:Object):Boolean{
return (!((undefined === get(_arg1))));
}
public function remove(_arg1:Object){
var _local2:Hashable;
var _local3:int;
var _local4:int;
var _local5:HashMap_Entry;
var _local6:HashMap_Entry;
var _local7:HashMap_Entry;
_local2 = toKey(_arg1);
_local3 = _local2.hashCode();
_local4 = indexFor(_local3);
_local5 = (_entries[_local4] as HashMap_Entry);
_local6 = _local5;
while (_local6 != null) {
_local7 = _local6.next;
if ((((_local6.hash == _local3)) && (_local6.key.equals(_local2)))){
if (_local5 == _local6){
_entries[_local4] = _local7;
} else {
_local5.next = _local7;
};
_size--;
if ((((_entries.length > DEFAULT_BUCKETS)) && ((_size < ((_entries.length * _loadFactor) * 0.125))))){
resize(Math.max(DEFAULT_BUCKETS, (_entries.length / 2)));
};
return (_local6.value);
};
_local5 = _local6;
_local6 = _local7;
};
return (undefined);
}
protected function resize(_arg1:int):void{
var _local2:Array;
var _local3:int;
var _local4:HashMap_Entry;
var _local5:HashMap_Entry;
var _local6:int;
_local2 = _entries;
_entries = [];
_entries.length = _arg1;
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = (_local2[_local3] as HashMap_Entry);
while (_local4 != null) {
_local5 = _local4.next;
_local6 = indexFor(_local4.hash);
_local4.next = (_entries[_local6] as HashMap_Entry);
_entries[_local6] = _local4;
_local4 = _local5;
};
_local3++;
};
}
public function clear():void{
_entries = [];
_entries.length = DEFAULT_BUCKETS;
_size = 0;
}
protected function fromKey(_arg1:Hashable):Object{
if ((_arg1 is StringWrapper)){
return (StringWrapper(_arg1).get());
};
return (_arg1);
}
protected function indexFor(_arg1:int):int{
return ((Math.abs(_arg1) % _entries.length));
}
public function get(_arg1:Object){
var _local2:Hashable;
var _local3:int;
var _local4:int;
var _local5:HashMap_Entry;
_local2 = toKey(_arg1);
_local3 = _local2.hashCode();
_local4 = indexFor(_local3);
_local5 = (_entries[_local4] as HashMap_Entry);
while (_local5 != null) {
if ((((_local5.hash == _local3)) && (_local5.key.equals(_local2)))){
return (_local5.value);
};
_local5 = _local5.next;
};
return (undefined);
}
public function values():Array{
var vals:Array;
vals = [];
forEach(function (_arg1, _arg2):void{
vals.push(_arg2);
});
return (vals);
}
protected function toKey(_arg1:Object):Hashable{
if ((((_arg1 is String)) || ((_arg1 == null)))){
return (new StringWrapper((_arg1 as String)));
};
return (Hashable(_arg1));
}
public function forEach(_arg1:Function):void{
var _local2:int;
var _local3:HashMap_Entry;
_local2 = (_entries.length - 1);
while (_local2 >= 0) {
_local3 = (_entries[_local2] as HashMap_Entry);
while (_local3 != null) {
if (Boolean(_arg1(fromKey(_local3.key), _local3.value))){
return;
};
_local3 = _local3.next;
};
_local2--;
};
}
public function put(_arg1:Object, _arg2:Object){
var _local3:Hashable;
var _local4:int;
var _local5:int;
var _local6:HashMap_Entry;
var _local7:HashMap_Entry;
var _local8:Object;
_local3 = toKey(_arg1);
_local4 = _local3.hashCode();
_local5 = indexFor(_local4);
_local6 = (_entries[_local5] as HashMap_Entry);
_local7 = _local6;
while (_local7 != null) {
if ((((_local7.hash == _local4)) && (_local7.key.equals(_local3)))){
_local8 = _local7.value;
_local7.value = _arg2;
return (_local8);
};
_local7 = _local7.next;
};
_entries[_local5] = new HashMap_Entry(_local4, _local3, _arg2, _local6);
_size++;
if (_size > (_entries.length * _loadFactor)){
resize((2 * _entries.length));
};
return (undefined);
}
public function keys():Array{
var keys:Array;
keys = [];
forEach(function (_arg1, _arg2):void{
keys.push(_arg1);
});
return (keys);
}
}
}//package com.threerings.util.maps
Section 11
//HashMap_Entry (com.threerings.util.maps.HashMap_Entry)
package com.threerings.util.maps {
import com.threerings.util.*;
public class HashMap_Entry {
public var hash:int;
public var value:Object;
public var next:HashMap_Entry;
public var key:Hashable;
public function HashMap_Entry(_arg1:int, _arg2:Hashable, _arg3:Object, _arg4:HashMap_Entry){
this.hash = _arg1;
this.key = _arg2;
this.value = _arg3;
this.next = _arg4;
}
}
}//package com.threerings.util.maps
Section 12
//ImmutableMap (com.threerings.util.maps.ImmutableMap)
package com.threerings.util.maps {
import com.threerings.util.*;
import flash.errors.*;
public class ImmutableMap extends ForwardingMap {
public function ImmutableMap(_arg1:Map){
super(_arg1);
}
protected function immutable():void{
throw (new IllegalOperationError());
}
override public function remove(_arg1:Object){
return (immutable());
}
override public function clear():void{
immutable();
}
override public function put(_arg1:Object, _arg2:Object){
return (immutable());
}
}
}//package com.threerings.util.maps
Section 13
//LinkedEntry (com.threerings.util.maps.LinkedEntry)
package com.threerings.util.maps {
public class LinkedEntry {
public var before:LinkedEntry;
public var value:Object;
public var after:LinkedEntry;
public var key:Object;
public function LinkedEntry(_arg1:Object, _arg2:Object){
this.key = _arg1;
this.value = _arg2;
}
public function addBefore(_arg1:LinkedEntry):void{
after = _arg1;
before = _arg1.before;
before.after = this;
after.before = this;
}
public function remove():void{
before.after = after;
after.before = before;
}
}
}//package com.threerings.util.maps
Section 14
//LinkedMap (com.threerings.util.maps.LinkedMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class LinkedMap extends ForeachingMap {
protected var _anchor:LinkedEntry;
public function LinkedMap(_arg1:Map){
super(_arg1);
_anchor = new LinkedEntry(this, this);
_anchor.before = (_anchor.after = _anchor);
}
override public function remove(_arg1:Object){
return (unlink(super.remove(_arg1)));
}
override public function clear():void{
super.clear();
_anchor.before = (_anchor.after = _anchor);
}
override public function put(_arg1:Object, _arg2:Object){
var _local3:LinkedEntry;
_local3 = newEntry(_arg1, _arg2);
_local3.addBefore(_anchor);
return (unlink(super.put(_arg1, _local3)));
}
protected function unlink(_arg1){
var _local2:LinkedEntry;
if (_arg1 === undefined){
return (undefined);
};
_local2 = LinkedEntry(_arg1);
_local2.remove();
return (_local2.value);
}
override public function get(_arg1:Object){
return (unwrap(getEntry(_arg1)));
}
protected function unwrap(_arg1, ... _args){
return (((_arg1 is LinkedEntry)) ? LinkedEntry(_arg1).value : _arg1);
}
override public function forEach(_arg1:Function):void{
var _local2:LinkedEntry;
_local2 = _anchor.after;
while (_local2 != _anchor) {
if (Boolean(_arg1(_local2.key, _local2.value))){
break;
};
_local2 = _local2.after;
};
}
protected function newEntry(_arg1:Object, _arg2:Object):LinkedEntry{
return (new LinkedEntry(_arg1, _arg2));
}
protected function getEntry(_arg1:Object){
return (super.get(_arg1));
}
}
}//package com.threerings.util.maps
Section 15
//LRMap (com.threerings.util.maps.LRMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class LRMap extends LinkedMap {
protected var _maxSize:int;
protected var _accessOrder:Boolean;
public function LRMap(_arg1:Map, _arg2:int, _arg3:Boolean=true){
super(_arg1);
_maxSize = _arg2;
_accessOrder = _arg3;
}
override public function put(_arg1:Object, _arg2:Object){
var _local3:*;
_local3 = super.put(_arg1, _arg2);
if ((((_local3 === undefined)) && ((size() > _maxSize)))){
remove(_anchor.after.key);
};
return (_local3);
}
override protected function getEntry(_arg1:Object){
var _local2:*;
var _local3:LinkedEntry;
_local2 = super.getEntry(_arg1);
if (((!((_local2 === undefined))) && (_accessOrder))){
_local3 = LinkedEntry(_local2);
_local3.remove();
_local3.addBefore(_anchor);
};
return (_local2);
}
}
}//package com.threerings.util.maps
Section 16
//MapBuilder (com.threerings.util.maps.MapBuilder)
package com.threerings.util.maps {
import com.threerings.util.*;
public class MapBuilder {
protected var _immutable:Boolean;
protected var _computer:Function;
protected var _maxSizeLR:int;
protected var _accessOrderLR:Boolean;
protected var _keyClazz:Class;
protected var _weakValues:Boolean;
protected var _sorted:Boolean;
protected var _defaultValue;
protected var _ttlExpiring:int;
protected var _expireHandler:Function;
protected var _comp:Function;
protected var _keyVals:Array;
public function MapBuilder(_arg1:Class){
_keyVals = [];
super();
_keyClazz = _arg1;
}
public function makeWeakValues():MapBuilder{
_weakValues = true;
return (this);
}
public function makeSorted(_arg1:Function=null):MapBuilder{
_sorted = true;
_comp = _arg1;
return (this);
}
public function put(_arg1:Object, _arg2:Object):MapBuilder{
_keyVals.push(_arg1, _arg2);
return (this);
}
public function makeComputing(_arg1:Function):MapBuilder{
_computer = _arg1;
return (this);
}
public function makeExpiring(_arg1:int, _arg2:Function=null):MapBuilder{
_ttlExpiring = _arg1;
_expireHandler = _arg2;
return (this);
}
public function build():Map{
var _local1:Boolean;
var _local2:Boolean;
var _local3:Map;
var _local4:int;
_local1 = (_maxSizeLR > 0);
_local2 = (_ttlExpiring > 0);
Preconditions.checkArgument(((!(_local1)) || (!(_local2))), "Cannot be both LR and Expiring");
_local3 = Maps.newMapOf(_keyClazz);
if (_local1){
_local3 = new LRMap(_local3, _maxSizeLR, _accessOrderLR);
} else {
if (_local2){
_local3 = new ExpiringMap(_local3, _ttlExpiring, _expireHandler);
};
};
if (_sorted){
_local3 = new SortedMap(_local3, ((_comp) || (Comparators.createNullSafe(Comparators.createFor(_keyClazz)))));
};
if (_weakValues){
_local3 = new WeakValueMap(_local3);
};
if (_computer !== null){
_local3 = new ValueComputingMap(_local3, _computer);
};
if (_defaultValue !== undefined){
_local3 = new DefaultValueMap(_local3, _defaultValue);
};
_local4 = 0;
while (_local4 < _keyVals.length) {
_local3.put(_keyVals[_local4], _keyVals[(_local4 + 1)]);
_local4 = (_local4 + 2);
};
if (_immutable){
_local3 = new ImmutableMap(_local3);
};
return (_local3);
}
public function setDefaultValue(_arg1):MapBuilder{
_defaultValue = _arg1;
return (this);
}
public function makeLR(_arg1:int, _arg2:Boolean=true):MapBuilder{
_maxSizeLR = _arg1;
_accessOrderLR = _arg2;
return (this);
}
public function makeImmutable():MapBuilder{
_immutable = true;
return (this);
}
}
}//package com.threerings.util.maps
Section 17
//SortedMap (com.threerings.util.maps.SortedMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class SortedMap extends ForwardingMap {
protected var _comp:Function;
public function SortedMap(_arg1:Map, _arg2:Function=null){
super(_arg1);
_comp = ((_arg2) || (Comparators.compareUnknowns));
}
override public function values():Array{
return (keys().map(Util.adapt(get)));
}
override public function forEach(_arg1:Function):void{
var _local2:Array;
var _local3:Object;
_local2 = keys();
for each (_local3 in _local2) {
if (Boolean(_arg1(_local3, get(_local3)))){
return;
};
};
}
override public function keys():Array{
var _local1:Array;
_local1 = super.keys();
_local1.sort(_comp);
return (_local1);
}
}
}//package com.threerings.util.maps
Section 18
//StringWrapper (com.threerings.util.maps.StringWrapper)
package com.threerings.util.maps {
import com.threerings.util.*;
public class StringWrapper implements Hashable {
protected var _val:String;
public function StringWrapper(_arg1:String){
_val = _arg1;
}
public function equals(_arg1:Object):Boolean{
return ((((_arg1 is StringWrapper)) && ((_val == StringWrapper(_arg1)._val))));
}
public function hashCode():int{
return (StringUtil.hashCode(_val));
}
public function get():String{
return (_val);
}
}
}//package com.threerings.util.maps
Section 19
//ValueComputingMap (com.threerings.util.maps.ValueComputingMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class ValueComputingMap extends ForwardingMap {
protected var _computer:Function;
public function ValueComputingMap(_arg1:Map, _arg2:Function){
super(_arg1);
_computer = _arg2;
}
override public function get(_arg1:Object){
var _local2:*;
_local2 = super.get(_arg1);
if (_local2 === undefined){
_local2 = _computer(_arg1);
if (_local2 !== undefined){
put(_arg1, _local2);
};
};
return (_local2);
}
}
}//package com.threerings.util.maps
Section 20
//WeakValueMap (com.threerings.util.maps.WeakValueMap)
package com.threerings.util.maps {
import com.threerings.util.*;
public class WeakValueMap extends ForeachingMap {
public function WeakValueMap(_arg1:Map){
super(_arg1);
}
override public function containsKey(_arg1:Object):Boolean{
var _local2:*;
_local2 = super.get(_arg1);
return ((((_local2 is WeakReference)) && (!((undefined === WeakReference(_local2).get())))));
}
override public function remove(_arg1:Object){
return (unwrap(super.remove(_arg1)));
}
override public function size():int{
forEach(function (... _args):void{
});
return (super.size());
}
override public function put(_arg1:Object, _arg2:Object){
return (unwrap(super.put(_arg1, ((_arg2)==null) ? null : new WeakReference(_arg2))));
}
override public function get(_arg1:Object){
return (unwrap(super.get(_arg1)));
}
protected function unwrap(_arg1){
return (((_arg1 is WeakReference)) ? WeakReference(_arg1).get() : _arg1);
}
override public function forEach(_arg1:Function):void{
var removeKeys:Array;
var key:Object;
var fn = _arg1;
removeKeys = [];
super.forEach(function (_arg1, _arg2):Boolean{
var _local3:*;
_local3 = unwrap(_arg2);
if (_local3 === undefined){
removeKeys.push(_arg1);
return (false);
};
return (Boolean(fn(_arg1, _local3)));
});
for each (key in removeKeys) {
super.remove(key);
};
}
}
}//package com.threerings.util.maps
Section 21
//ArrayUtil (com.threerings.util.ArrayUtil)
package com.threerings.util {
public class ArrayUtil {
public static function transpose(_arg1:Array, _arg2:Array, ... _args):Array{
var len:int;
var result:Array;
var tuple:Array;
var ii:int;
var jj:int;
var x = _arg1;
var y = _arg2;
var arrays = _args;
arrays.splice(0, 0, x, y);
len = Math.max.apply(null, arrays.map(Util.adapt(function (_arg1:Array):int{
return (_arg1.length);
})));
result = new Array(len);
ii = 0;
while (ii < len) {
var _local5 = new Array(arrays.length);
tuple = _local5;
result[ii] = _local5;
jj = 0;
while (jj < arrays.length) {
tuple[jj] = arrays[jj][ii];
jj = (jj + 1);
};
ii = (ii + 1);
};
return (result);
}
public static function removeLast(_arg1:Array, _arg2:Object):Boolean{
var _local3:Boolean;
_arg1.reverse();
_local3 = removeFirst(_arg1, _arg2);
_arg1.reverse();
return (_local3);
}
public static function create(_arg1:uint, _arg2=null):Array{
return (padToLength([], _arg1, _arg2));
}
private static function removeImpl(_arg1:Array, _arg2:Object, _arg3:Boolean):Boolean{
return (removeIfImpl(_arg1, Predicates.createEquals(_arg2), _arg3));
}
public static function shuffle(_arg1:Array, _arg2:Random=null):void{
var randFunc:Function;
var ii:int;
var idx:int;
var tmp:Object;
var arr = _arg1;
var rando = _arg2;
randFunc = ((rando)!=null) ? rando.nextInt : function (_arg1:int):int{
return (int((Math.random() * _arg1)));
};
ii = (arr.length - 1);
while (ii > 0) {
idx = randFunc((ii + 1));
tmp = arr[idx];
arr[idx] = arr[ii];
arr[ii] = tmp;
ii = (ii - 1);
};
}
public static function indexOf(_arg1:Array, _arg2:Object):int{
var _local3:int;
if (_arg1 != null){
_local3 = 0;
while (_local3 < _arg1.length) {
if (Util.equals(_arg1[_local3], _arg2)){
return (_local3);
};
_local3++;
};
};
return (-1);
}
public static function removeFirst(_arg1:Array, _arg2:Object):Boolean{
return (removeImpl(_arg1, _arg2, true));
}
public static function indexIf(_arg1:Array, _arg2:Function):int{
var _local3:int;
if (_arg1 != null){
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg2(_arg1[_local3])){
return (_local3);
};
_local3++;
};
};
return (-1);
}
public static function removeFirstIf(_arg1:Array, _arg2:Function):Boolean{
return (removeIfImpl(_arg1, _arg2, true));
}
public static function sortedInsert(_arg1:Array, _arg2, _arg3:Function=null):int{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:*;
if (_arg3 == null){
_arg3 = Comparators.compareComparables;
};
_local4 = -1;
_local5 = _arg1.length;
_local6 = 0;
while (_local6 < _local5) {
_local7 = _arg1[_local6];
if (_arg3(_arg2, _local7) <= 0){
_arg1.splice(_local6, 0, _arg2);
_local4 = _local6;
break;
};
_local6++;
};
if (_local4 < 0){
_arg1.push(_arg2);
_local4 = (_arg1.length - 1);
};
return (_local4);
}
private static function removeIfImpl(_arg1:Array, _arg2:Function, _arg3:Boolean):Boolean{
var _local4:Boolean;
var _local5:int;
_local4 = false;
_local5 = 0;
while (_local5 < _arg1.length) {
if (_arg2(_arg1[_local5])){
var _temp1 = _local5;
_local5 = (_local5 - 1);
_arg1.splice(_temp1, 1);
if (_arg3){
return (true);
};
_local4 = true;
};
_local5++;
};
return (_local4);
}
public static function sortOn(_arg1:Array, _arg2:Array):void{
stableSort(_arg1, Comparators.createFields(_arg2));
}
public static function sort(_arg1:Array):void{
_arg1.sort(Comparators.compareComparables);
}
public static function contains(_arg1:Array, _arg2:Object):Boolean{
return (!((indexOf(_arg1, _arg2) == -1)));
}
public static function copyOf(_arg1:Array):Array{
return (_arg1.slice());
}
public static function resize(_arg1:Array, _arg2:uint):void{
if (_arg1.length > _arg2){
_arg1.length = _arg2;
} else {
padToLength(_arg1, _arg2, undefined);
};
}
public static function copy(_arg1:Array, _arg2:uint, _arg3:Array, _arg4:uint, _arg5:uint):void{
var _local6:uint;
_local6 = 0;
while (_local6 < _arg5) {
var _temp1 = _arg4;
_arg4 = (_arg4 + 1);
var _local7 = _temp1;
var _temp2 = _arg2;
_arg2 = (_arg2 + 1);
_arg3[_local7] = _arg1[_temp2];
_local6++;
};
}
public static function findIf(_arg1:Array, _arg2:Function){
var _local3:int;
_local3 = ((_arg1)!=null) ? indexIf(_arg1, _arg2) : -1;
return (((_local3 >= 0)) ? _arg1[_local3] : undefined);
}
public static function removeLastIf(_arg1:Array, _arg2:Function):Boolean{
var _local3:Boolean;
_arg1.reverse();
_local3 = removeFirstIf(_arg1, _arg2);
_arg1.reverse();
return (_local3);
}
public static function stableSort(_arg1:Array, _arg2:Function=null):void{
var _local3:int;
var _local4:int;
var _local5:*;
var _local6:int;
var _local7:*;
if (_arg2 == null){
_arg2 = Comparators.compareComparables;
};
_local3 = _arg1.length;
_local4 = 1;
while (_local4 < _local3) {
_local5 = _arg1[_local4];
_local6 = (_local4 - 1);
while (_local6 >= 0) {
_local7 = _arg1[_local6];
if (_arg2(_local5, _local7) >= 0){
break;
};
_arg1[(_local6 + 1)] = _local7;
_local6--;
};
_arg1[(_local6 + 1)] = _local5;
_local4++;
};
}
public static function removeAllIf(_arg1:Array, _arg2:Function):Boolean{
return (removeIfImpl(_arg1, _arg2, false));
}
public static function padToLength(_arg1:Array, _arg2:uint, _arg3=null):Array{
while (_arg1.length < _arg2) {
_arg1.push(_arg3);
};
return (_arg1);
}
public static function splice(_arg1:Array, _arg2:int, _arg3:int, _arg4:Array=null):Array{
var _local5:Array;
_local5 = ((_arg4)==null) ? [] : _arg4.concat();
_local5.unshift(_arg2, _arg3);
return (_arg1.splice.apply(_arg1, _local5));
}
public static function removeAll(_arg1:Array, _arg2:Object):Boolean{
return (removeImpl(_arg1, _arg2, false));
}
public static function equals(_arg1:Array, _arg2:Array):Boolean{
var _local3:int;
if (_arg1 === _arg2){
return (true);
};
if ((((((_arg1 == null)) || ((_arg2 == null)))) || (!((_arg1.length == _arg2.length))))){
return (false);
};
_local3 = 0;
while (_local3 < _arg1.length) {
if (!Util.equals(_arg1[_local3], _arg2[_local3])){
return (false);
};
_local3++;
};
return (true);
}
}
}//package com.threerings.util
Section 22
//ClassUtil (com.threerings.util.ClassUtil)
package com.threerings.util {
import flash.utils.*;
public class ClassUtil {
public static function tinyClassName(_arg1:Object):String{
var _local2:String;
var _local3:int;
_local2 = getClassName(_arg1);
_local3 = _local2.lastIndexOf(".");
return (_local2.substring((_local3 + 1)));
}
public static function getClassByName(_arg1:String):Class{
var cname = _arg1;
try {
return ((getDefinitionByName(cname.replace("::", ".")) as Class));
} catch(error:ReferenceError) {
Log.getLog(ClassUtil).warning("Unknown class", "name", cname, error);
};
return (null);
}
public static function newInstance(_arg1:Object):Object{
var _local2:Class;
_local2 = getClass(_arg1);
return (new (_local2));
}
public static function shortClassName(_arg1:Object):String{
var _local2:String;
var _local3:int;
_local2 = getQualifiedClassName(_arg1);
_local3 = _local2.lastIndexOf(".");
_local2 = _local2.substring((_local3 + 1));
return (_local2.replace("::", "."));
}
public static function isSameClass(_arg1:Object, _arg2:Object):Boolean{
return ((getQualifiedClassName(_arg1) == getQualifiedClassName(_arg2)));
}
public static function getClass(_arg1:Object):Class{
if ((_arg1.constructor is Class)){
return (Class(_arg1.constructor));
};
return (getClassByName(getQualifiedClassName(_arg1)));
}
public static function isAssignableAs(_arg1:Class, _arg2:Class):Boolean{
var _local3:XMLList;
var _local4:XMLList;
var _local5:String;
var _local6:XMLList;
if ((((_arg1 == _arg2)) || ((_arg1 == Object)))){
return (true);
};
if (_arg2 == Object){
return (false);
};
_local3 = describeType(_arg2).child("factory");
_local4 = _local3.child("extendsClass").attribute("type");
for each (_local5 in _local4) {
if (_arg1 == getClassByName(_local5)){
return (true);
};
};
_local6 = _local3.child("implementsInterface").attribute("type");
for each (_local5 in _local6) {
if (_arg1 == getClassByName(_local5)){
return (true);
};
};
return (false);
}
public static function getClassName(_arg1:Object):String{
return (getQualifiedClassName(_arg1).replace("::", "."));
}
}
}//package com.threerings.util
Section 23
//Comparable (com.threerings.util.Comparable)
package com.threerings.util {
public interface Comparable {
function compareTo(_arg1:Object):int;
}
}//package com.threerings.util
Section 24
//Comparators (com.threerings.util.Comparators)
package com.threerings.util {
public class Comparators {
public static function compareStringsInsensitively(_arg1:String, _arg2:String, ... _args):int{
return (compareStrings(_arg1.toLowerCase(), _arg2.toLowerCase()));
}
public static function compareNumbers(_arg1:Number, _arg2:Number, ... _args):int{
if (_arg1 > _arg2){
return (1);
};
if (_arg1 < _arg2){
return (-1);
};
if (_arg1 == _arg2){
return (0);
};
return (compareBooleans(isNaN(_arg1), isNaN(_arg2)));
}
public static function createReverse(_arg1:Function):Function{
var comparator = _arg1;
return (function (_arg1:Object, _arg2:Object, ... _args):int{
return (comparator(_arg2, _arg1));
});
}
public static function compareInts(_arg1:int, _arg2:int, ... _args):int{
return (((_arg1)>_arg2) ? 1 : ((_arg1 == _arg2)) ? 0 : -1);
}
public static function createFor(_arg1:Class):Function{
switch (_arg1){
case String:
return (compareStrings);
case int:
return (compareInts);
case uint:
case Number:
return (compareNumbers);
case Boolean:
return (compareBooleans);
};
if (ClassUtil.isAssignableAs(Comparable, _arg1)){
return (compareComparables);
};
return (compareUnknowns);
}
public static function compareUnknowns(_arg1:Object, _arg2:Object, ... _args):int{
if (_arg1 === _arg2){
return (0);
};
if (_arg1 == null){
return (-1);
};
if (_arg2 == null){
return (1);
};
if ((_arg1 is Comparable)){
return (Comparable(_arg1).compareTo(_arg2));
};
if ((((_arg1 is Number)) && ((_arg2 is Number)))){
return (compareNumbers(Number(_arg1), Number(_arg2)));
};
if ((((_arg1 is Boolean)) && ((_arg2 is Boolean)))){
return (compareBooleans(Boolean(_arg1), Boolean(_arg2)));
};
return (compareStrings(String(_arg1), String(_arg2)));
}
public static function compareEnumsByName(_arg1:Enum, _arg2:Enum, ... _args):int{
return (compareStrings(_arg1.name(), _arg2.name()));
}
public static function createNullSafe(_arg1:Function):Function{
var comparator = _arg1;
return (function (_arg1:Object, _arg2:Object, ... _args):int{
if (_arg1 === _arg2){
return (0);
};
if (_arg1 == null){
return (-1);
};
if (_arg2 == null){
return (1);
};
return (comparator(_arg1, _arg2));
});
}
public static function compareComparables(_arg1:Comparable, _arg2:Comparable, ... _args):int{
return (_arg1.compareTo(_arg2));
}
public static function createFields(_arg1:Array, _arg2:Array=null):Function{
var sortFields = _arg1;
var defaults = _arg2;
if (defaults == null){
defaults = [];
};
return (function (_arg1:Object, _arg2:Object, ... _args):int{
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_local4 = 0;
while (_local4 < sortFields.length) {
_local5 = sortFields[_local4];
_local6 = defaults[_local4];
_local7 = (((!((_arg1 == null))) && (_arg1.hasOwnProperty(_local5)))) ? _arg1[_local5] : _local6;
_local8 = (((!((_arg2 == null))) && (_arg2.hasOwnProperty(_local5)))) ? _arg2[_local5] : _local6;
_local9 = compareUnknowns(_local7, _local8);
if (_local9 != 0){
return (_local9);
};
_local4++;
};
return (0);
});
}
public static function compareBooleans(_arg1:Boolean, _arg2:Boolean, ... _args):int{
return (((_arg1)==_arg2) ? 0 : (_arg1) ? 1 : -1);
}
public static function compareStrings(_arg1:String, _arg2:String, ... _args):int{
return (((_arg1)==_arg2) ? 0 : ((_arg1)>_arg2) ? 1 : -1);
}
}
}//package com.threerings.util
Section 25
//Enum (com.threerings.util.Enum)
package com.threerings.util {
import flash.utils.*;
public class Enum implements Hashable, Comparable {
protected var _name:String;
private static const _enums:Dictionary = new Dictionary(true);
private static const _blocked:Dictionary = new Dictionary(true);
public function Enum(_arg1:String){
var _local2:Class;
var _local3:Array;
var _local4:Enum;
super();
_local2 = ClassUtil.getClass(this);
if (Boolean(_blocked[_local2])){
throw (new Error("You may not just construct an enum!"));
};
if (_arg1 == null){
throw (new ArgumentError("null is invalid."));
};
_local3 = (_enums[_local2] as Array);
if (_local3 == null){
_local3 = [];
_enums[_local2] = _local3;
} else {
for each (_local4 in _local3) {
if (_local4.name() === _arg1){
throw (new ArgumentError(Joiner.args("Duplicate enum", _arg1)));
};
};
};
_local3.push(this);
_name = _arg1;
}
public function compareTo(_arg1:Object):int{
if (!ClassUtil.isSameClass(this, _arg1)){
throw (new ArgumentError("Not same class"));
};
return (Comparators.compareInts(this.ordinal(), Enum(_arg1).ordinal()));
}
public function valueOf():Object{
return (ordinal());
}
final public function name():String{
return (_name);
}
public function toString():String{
return (_name);
}
final public function ordinal():int{
return ((_enums[ClassUtil.getClass(this)] as Array).indexOf(this));
}
final public function hashCode():int{
return (ordinal());
}
final public function equals(_arg1:Object):Boolean{
return ((_arg1 === this));
}
public static function values(_arg1:Class):Array{
var _local2:Array;
_local2 = (_enums[_arg1] as Array);
if (_local2 == null){
throw (new ArgumentError(Joiner.pairs("Not an enum", "class", _arg1)));
};
return (_local2.concat());
}
public static function valueOf(_arg1:Class, _arg2:String):Enum{
var _local3:Enum;
for each (_local3 in values(_arg1)) {
if (_local3.name() === _arg2){
return (_local3);
};
};
throw (new ArgumentError(Joiner.pairs("No such enum", "class", _arg1, "name", _arg2)));
}
protected static function finishedEnumerating(_arg1:Class):void{
_blocked[_arg1] = true;
}
finishedEnumerating(Enum);
}
}//package com.threerings.util
Section 26
//Equalable (com.threerings.util.Equalable)
package com.threerings.util {
public interface Equalable {
function equals(_arg1:Object):Boolean;
}
}//package com.threerings.util
Section 27
//Hashable (com.threerings.util.Hashable)
package com.threerings.util {
public interface Hashable extends Equalable {
function hashCode():int;
}
}//package com.threerings.util
Section 28
//Joiner (com.threerings.util.Joiner)
package com.threerings.util {
import flash.utils.*;
public class Joiner {
protected var _msg:String;
protected var _details:String;
public function Joiner(_arg1:String=""){
_msg = _arg1;
_details = "";
}
public function add(... _args):Joiner{
_details = format(true, _details, _args);
return (this);
}
public function toString():String{
return (output(_msg, _details));
}
public function addFields(_arg1:Object, _arg2:Array=null):Joiner{
var args:Array;
var field:String;
var bit:String;
var dynamicFieldName:String;
var obj = _arg1;
var fieldNames = _arg2;
if (fieldNames == null){
fieldNames = [];
for each (bit in describeType(obj)..variable.@name) {
fieldNames.push(bit);
};
for (dynamicFieldName in obj) {
fieldNames.push(dynamicFieldName);
};
};
args = [];
for each (field in fieldNames) {
args.push(field);
try {
args.push(obj[field]);
} catch(re:ReferenceError) {
args.push("<ReferenceError>");
};
};
return (add.apply(null, args));
}
public function addArgsArray(_arg1:Array):Joiner{
return (addArgs.apply(null, _arg1));
}
public function addArgs(... _args):Joiner{
_details = format(false, _details, _args);
return (this);
}
public static function pairsArray(_arg1:String, _arg2:Array):String{
return (output(_arg1, format(true, "", _arg2)));
}
protected static function output(_arg1:String, _arg2:String):String{
return (((_arg2)=="") ? _arg1 : (((_arg1 + " [") + _arg2) + "]"));
}
public static function createFor(_arg1:Object):Joiner{
return (new Joiner(ClassUtil.tinyClassName(_arg1)));
}
protected static function format(_arg1:Boolean, _arg2:String, _arg3:Array):String{
var _local4:int;
_local4 = 0;
while (_local4 < _arg3.length) {
if (_arg2 != ""){
_arg2 = (_arg2 + ", ");
};
_arg2 = (_arg2 + argToString(_arg3[_local4]));
if (((_arg1) && ((_temp1 < _arg3.length)))){
_arg2 = (_arg2 + ("=" + argToString(_arg3[_local4])));
};
_local4++;
};
return (_arg2);
}
public static function pairs(_arg1:String, ... _args):String{
return (pairsArray(_arg1, _args));
}
protected static function argToString(_arg1):String{
return (String(_arg1));
}
public static function argsArray(_arg1:String, _arg2:Array):String{
return (output(_arg1, format(false, "", _arg2)));
}
public static function args(_arg1:String, ... _args):String{
return (argsArray(_arg1, _args));
}
public static function simpleToString(_arg1:Object, _arg2:Array=null):String{
return (createFor(_arg1).addFields(_arg1, _arg2).toString());
}
}
}//package com.threerings.util
Section 29
//Log (com.threerings.util.Log)
package com.threerings.util {
import flash.utils.*;
import flash.system.*;
public class Log {
protected var _module:String;
protected static const LEVEL_NAMES:Array = ["debug", "INFO", "WARN", "ERROR", false];
public static const OFF:int = 4;
public static const ERROR:int = 3;
public static const INFO:int = 1;
public static const DEBUG:int = 0;
public static const WARNING:int = 2;
protected static var _targets:Array = [];
protected static var _levels:Object = {};
protected static var _setLevels:Object = {:(Capabilities.isDebugger) ? DEBUG : OFF};
public function Log(_arg1:String){
if (_arg1 == null){
_arg1 = "";
};
_module = _arg1;
}
protected function getTimeStamp():String{
var _local1:Date;
_local1 = new Date();
return (((((((((((((_local1.fullYear + "-") + StringUtil.prepad(String((_local1.month + 1)), 2, "0")) + "-") + StringUtil.prepad(String(_local1.date), 2, "0")) + " ") + StringUtil.prepad(String(_local1.hours), 2, "0")) + ":") + StringUtil.prepad(String(_local1.minutes), 2, "0")) + ":") + StringUtil.prepad(String(_local1.seconds), 2, "0")) + ",") + StringUtil.prepad(String(_local1.milliseconds), 3, "0")));
}
public function logStackTrace(_arg1:Error):void{
warning(_arg1.getStackTrace());
}
protected function argToString(_arg1):String{
var arg = _arg1;
try {
if ((arg is Function)){
return (String(arg()));
} else {
return (String(arg));
};
} catch(e:Error) {
try {
return ((("<" + e) + ">"));
} catch(e2:Error) {
};
};
return ("<Error>");
}
public function info(... _args):void{
doLog(INFO, _args);
}
public function error(... _args):void{
doLog(ERROR, _args);
}
protected function formatMessage(_arg1:int, _arg2:Array):String{
var _local3:String;
var _local4:Error;
var _local5:Object;
var _local6:int;
_local3 = ((((getTimeStamp() + " ") + LEVEL_NAMES[_arg1]) + ": ") + _module);
if (_arg2.length > 0){
_local3 = (_local3 + (" " + String(_arg2[0])));
_local4 = null;
if ((_arg2.length % 2) == 0){
_local5 = _arg2.pop();
if ((_local5 is Error)){
_local4 = (_local5 as Error);
} else {
if (_local5 == null){
_arg2.push("error", _local5);
} else {
_arg2.push(_local5, "");
};
};
};
if (_arg2.length > 1){
_local6 = 1;
while (_local6 < _arg2.length) {
_local3 = (_local3 + ((_local6)==1) ? " [" : ", ");
_local3 = (_local3 + ((argToString(_arg2[_local6]) + "=") + argToString(_arg2[(_local6 + 1)])));
_local6 = (_local6 + 2);
};
_local3 = (_local3 + "]");
};
if (_local4 != null){
_local3 = (_local3 + ("\n" + _local4.getStackTrace()));
};
};
return (_local3);
}
public function debug(... _args):void{
doLog(DEBUG, _args);
}
protected function doLog(_arg1:int, _arg2:Array):void{
var _local3:String;
var _local4:LogTarget;
if (_arg1 < getLevel(_module)){
return;
};
_local3 = formatMessage(_arg1, _arg2);
trace(_local3);
for each (_local4 in _targets) {
_local4.log(_local3);
};
}
public function warning(... _args):void{
doLog(WARNING, _args);
}
public static function setLevel(_arg1:String, _arg2:int):void{
_setLevels[_arg1] = _arg2;
_levels = {};
}
public static function getLog(_arg1):Log{
var _local2:String;
_local2 = ((_arg1 is String)) ? String(_arg1) : getQualifiedClassName(_arg1).replace("::", ".");
return (new Log(_local2));
}
public static function addTarget(_arg1:LogTarget):void{
_targets.push(_arg1);
}
public static function testing(... _args):void{
var _local2:Log;
_local2 = new Log("testing");
_local2.debug.apply(_local2, _args);
}
protected static function getLevel(_arg1:String):int{
var _local2:Object;
var _local3:String;
var _local4:int;
_local2 = _levels[_arg1];
if (_local2 == null){
_local3 = _arg1;
while (true) {
_local2 = _setLevels[_local3];
if (((!((_local2 == null))) || ((_local3 == "")))){
_levels[_arg1] = int(_local2);
break;
};
_local4 = _local3.lastIndexOf(".");
_local3 = ((_local4)==-1) ? "" : _local3.substring(0, _local4);
};
};
return (int(_local2));
}
public static function setLevels(_arg1:String):void{
var _local2:String;
var _local3:Array;
for each (_local2 in _arg1.split(";")) {
_local3 = _local2.split(":");
_setLevels[_local3[0]] = stringToLevel(String(_local3[1]));
};
_levels = {};
}
public static function dumpStack(_arg1:String="dumpStack"):void{
testing(new Error(_arg1).getStackTrace());
}
public static function removeTarget(_arg1:LogTarget):void{
var _local2:int;
_local2 = _targets.indexOf(_arg1);
if (_local2 != -1){
_targets.splice(_local2, 1);
};
}
protected static function stringToLevel(_arg1:String):int{
switch (_arg1.toLowerCase()){
case "debug":
default:
return (DEBUG);
case "info":
return (INFO);
case "warning":
case "warn":
return (WARNING);
case "error":
return (ERROR);
case "off":
return (OFF);
};
}
}
}//package com.threerings.util
Section 30
//LogTarget (com.threerings.util.LogTarget)
package com.threerings.util {
public interface LogTarget {
function log(_arg1:String):void;
}
}//package com.threerings.util
Section 31
//Map (com.threerings.util.Map)
package com.threerings.util {
public interface Map {
function containsKey(_arg1:Object):Boolean;
function values():Array;
function isEmpty():Boolean;
function remove(_arg1:Object);
function size():int;
function forEach(_arg1:Function):void;
function clear():void;
function keys():Array;
function get(_arg1:Object);
function put(_arg1:Object, _arg2:Object);
}
}//package com.threerings.util
Section 32
//Maps (com.threerings.util.Maps)
package com.threerings.util {
import com.threerings.util.maps.*;
public class Maps {
public static function newMapOf(_arg1:Class):Map{
if ((((_arg1 === String)) || (((ClassUtil.isAssignableAs(Hashable, _arg1)) && (!(ClassUtil.isAssignableAs(Enum, _arg1))))))){
return (new HashMap());
};
return (new DictionaryMap());
}
public static function some(_arg1:Map, _arg2:Function):Boolean{
var found:Boolean;
var map = _arg1;
var condition = _arg2;
found = false;
map.forEach(function (_arg1:Object, _arg2:Object):Boolean{
if (condition(_arg1, _arg2)){
found = true;
return (true);
};
return (false);
});
return (found);
}
public static function selectValue(_arg1:Object, _arg2:Object):Object{
return (_arg2);
}
public static function findKey(_arg1:Map, _arg2:Object){
var key:*;
var map = _arg1;
var value = _arg2;
key = undefined;
map.forEach(function (_arg1:Object, _arg2:Object):Boolean{
if (Util.equals(value, _arg2)){
key = _arg1;
return (true);
};
return (false);
});
return (key);
}
public static function filter(_arg1:Map, _arg2:Function, _arg3:Function=null):Array{
var matches:Array;
var map = _arg1;
var condition = _arg2;
var transform = _arg3;
if (transform == null){
transform = selectValue;
};
matches = [];
map.forEach(function (_arg1:Object, _arg2:Object):void{
if (condition(_arg1, _arg2)){
matches.push(transform(_arg1, _arg2));
};
});
return (matches);
}
public static function selectKey(_arg1:Object, _arg2:Object):Object{
return (_arg1);
}
public static function newBuilder(_arg1:Class):MapBuilder{
return (new MapBuilder(_arg1));
}
public static function newSortedMapOf(_arg1:Class, _arg2:Function=null):Map{
return (newBuilder(_arg1).makeSorted(_arg2).build());
}
public static function equals(_arg1:Map, _arg2:Map):Boolean{
var allEquals:Boolean;
var map1 = _arg1;
var map2 = _arg2;
if (map1 === map2){
return (true);
};
if ((((((map1 == null)) || ((map2 == null)))) || (!((map1.size() == map2.size()))))){
return (false);
};
allEquals = true;
map1.forEach(function (_arg1:Object, _arg2:Object):Boolean{
var _local3:*;
_local3 = map2.get(_arg1);
if ((((_local3 === undefined)) || (!(Util.equals(_arg2, _local3))))){
allEquals = false;
};
return (!(allEquals));
});
return (allEquals);
}
}
}//package com.threerings.util
Section 33
//Preconditions (com.threerings.util.Preconditions)
package com.threerings.util {
public class Preconditions {
public static function checkNotNull(_arg1, _arg2:String=null){
if (_arg1 == null){
throw (new TypeError(((_arg2) || (""))));
};
return (_arg1);
}
public static function checkIndex(_arg1:int, _arg2:int, _arg3:String=null):int{
if ((((_arg1 < 0)) || ((_arg1 >= _arg2)))){
throw (new RangeError(((_arg3) || (Joiner.pairs("Index out of bounds", "index", _arg1, "size", _arg2)))));
};
return (_arg1);
}
public static function checkArgument(_arg1:Boolean, _arg2:String=null):void{
if (!_arg1){
throw (new ArgumentError(((_arg2) || (""))));
};
}
public static function checkRange(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:String=null):Number{
if (((((isNaN(_arg1)) || ((_arg1 < _arg2)))) || ((_arg1 > _arg3)))){
throw (new RangeError(((_arg4) || (Joiner.pairs("Value out of range", "value", _arg1, "low", _arg2, "high", _arg3)))));
};
return (_arg1);
}
}
}//package com.threerings.util
Section 34
//Predicates (com.threerings.util.Predicates)
package com.threerings.util {
public class Predicates {
public static function createPropertyEquals(_arg1:String, _arg2:Object):Function{
var propName = _arg1;
var value = _arg2;
return (function (_arg1, ... _args):Boolean{
return (((((!((_arg1 == null))) && (_arg1.hasOwnProperty(propName)))) && (Util.equals(_arg1[propName], value))));
});
}
public static function isNull(_arg1, ... _args):Boolean{
return ((_arg1 == null));
}
public static function createHasProperty(_arg1:String):Function{
var propName = _arg1;
return (function (_arg1, ... _args):Boolean{
return (((!((_arg1 == null))) && (_arg1.hasOwnProperty(propName))));
});
}
public static function createIs(_arg1:Class):Function{
var clazz = _arg1;
return (function (_arg1, ... _args):Boolean{
return ((_arg1 is clazz));
});
}
public static function createNot(_arg1:Function):Function{
var pred = _arg1;
return (function (... _args):Boolean{
return (!(pred.apply(null, _args)));
});
}
public static function createIn(_arg1:Array):Function{
var array = _arg1;
return (function (_arg1, ... _args):Boolean{
return (ArrayUtil.contains(array, _arg1));
});
}
public static function notNull(_arg1, ... _args):Boolean{
return (!((_arg1 == null)));
}
public static function createEquals(_arg1:Object):Function{
var value = _arg1;
return (function (_arg1, ... _args):Boolean{
return (Util.equals(_arg1, value));
});
}
public static function createAnd(... _args):Function{
var predicates = _args;
return (function (... _args):Boolean{
var _local2:*;
for each (_local2 in predicates) {
if (!_local2.apply(null, _args)){
return (false);
};
};
return (true);
});
}
public static function createOr(... _args):Function{
var predicates = _args;
return (function (... _args):Boolean{
var _local2:*;
for each (_local2 in predicates) {
if (_local2.apply(null, _args)){
return (true);
};
};
return (false);
});
}
}
}//package com.threerings.util
Section 35
//Random (com.threerings.util.Random)
package com.threerings.util {
public class Random {
protected var q:int;
protected var r:int;
protected var p:int;
protected var x:Array;
protected static const MATRIX_A:uint = 2567483615;
protected static const UPPER_MASK:uint = 2147483648;
protected static const LOWER_MASK:uint = 2147483647;
protected static const M:int = 397;
protected static const N:int = 624;
protected static var seedUniquifier:uint = 2812526361;
public function Random(_arg1:uint=0){
if (_arg1 == 0){
_arg1 = uint((seedUniquifier++ + uint((Math.random() * 4294967295))));
};
x = new Array();
setSeed(_arg1);
}
public function nextInt(_arg1:int=0):int{
var _local2:int;
var _local3:int;
if (_arg1 < 0){
throw (new Error("n must be positive"));
};
if (_arg1 == 0){
return (int(next(32)));
};
do {
_local2 = int(next(31));
_local3 = (_local2 % _arg1);
} while (((_local2 - _local3) + (_arg1 - 1)) < 0);
return (_local3);
}
protected function next(_arg1:int):uint{
var _local2:uint;
_local2 = ((x[p] & UPPER_MASK) | (x[q] & LOWER_MASK));
x[p] = ((x[r] ^ (_local2 >>> 1)) ^ ((_local2 & 1) * MATRIX_A));
_local2 = x[p];
if (++p == N){
p = 0;
};
if (++q == N){
q = 0;
};
if (++r == N){
r = 0;
};
_local2 = (_local2 ^ (_local2 >>> 11));
_local2 = (_local2 ^ ((_local2 << 7) & 2636928640));
_local2 = (_local2 ^ ((_local2 << 15) & 4022730752));
_local2 = (_local2 ^ (_local2 >>> 18));
return ((_local2 >>> (32 - _arg1)));
}
public function nextBoolean():Boolean{
return (!((next(1) == 0)));
}
public function setSeed(_arg1:uint):void{
var _local2:int;
x[0] = _arg1;
_local2 = 1;
while (_local2 < N) {
x[_local2] = (imul(1812433253, (x[(_local2 - 1)] ^ (x[(_local2 - 1)] >>> 30))) + _local2);
x[_local2] = (x[_local2] & 4294967295);
_local2++;
};
p = 0;
q = 1;
r = M;
}
protected function imul(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = (_arg1 & 0xFFFF);
_local4 = (_arg1 >>> 16);
_local5 = (_arg2 & 0xFFFF);
_local6 = (_arg2 >>> 16);
_local7 = (_local3 * _local5);
_local8 = (((((_local7 >>> 16) + (_local3 * _local6)) & 0xFFFF) + (_local4 * _local5)) & 0xFFFF);
return (((_local8 << 16) | (_local7 & 0xFFFF)));
}
public function nextNumber():Number{
return ((next(32) / 4294967296));
}
}
}//package com.threerings.util
Section 36
//StringUtil (com.threerings.util.StringUtil)
package com.threerings.util {
import flash.utils.*;
public class StringUtil {
protected static const DECIMAL:Array = HEX.slice(0, 10);
protected static const URL_REGEXP:RegExp = new RegExp("\\b(([\\w-]+://?|www[.])[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^!\\\"#$%&'()*+,\\-./:;<=>?@\\[\\\\\\]\\^_`{|}~\\s]|/)))", "i");
protected static const HEX:Array = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
public static function hexlate(_arg1:ByteArray):String{
var _local2:String;
var _local3:int;
var _local4:int;
_local2 = "";
if (_arg1 != null){
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1[_local3];
_local2 = (_local2 + (HEX[(_local4 >> 4)] + HEX[(_local4 & 15)]));
_local3++;
};
};
return (_local2);
}
public static function parseURLs(_arg1:String):Array{
var _local2:Array;
var _local3:Object;
var _local4:int;
var _local5:String;
_local2 = [];
while (true) {
_local3 = URL_REGEXP.exec(_arg1);
if (_local3 == null){
break;
};
_local4 = int(_local3.index);
_local5 = String(_local3[0]);
_local2.push(_arg1.substring(0, _local4));
_arg1 = _arg1.substring((_local4 + _local5.length));
if (startsWith(_local5.toLowerCase(), "www.")){
_local5 = ("http://" + _local5);
};
_local2.push(_local5);
};
if (((!((_arg1 == ""))) || ((_local2.length == 0)))){
_local2.push(_arg1);
};
return (_local2);
}
public static function isLowerCase(_arg1:String):Boolean{
var _local2:String;
_local2 = _arg1.charAt(0);
return (((!((_local2.toUpperCase() == _local2))) && ((_local2.toLowerCase() == _local2))));
}
public static function unhexlate(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:int;
var _local4:int;
if ((((_arg1 == null)) || (!(((_arg1.length % 2) == 0))))){
return (null);
};
_arg1 = _arg1.toLowerCase();
_local2 = new ByteArray();
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = (HEX.indexOf(_arg1.charAt(_local3)) << 4);
_local4 = (_local4 + HEX.indexOf(_arg1.charAt((_local3 + 1))));
_local2[(_local3 / 2)] = _local4;
_local3 = (_local3 + 2);
};
return (_local2);
}
public static function isBlank(_arg1:String):Boolean{
return ((((_arg1 == null)) || ((_arg1.search("\\S") == -1))));
}
public static function parseInteger(_arg1:String, _arg2:uint=0):int{
return (int(parseInt0(_arg1, _arg2, true)));
}
public static function isWhitespace(_arg1:String):Boolean{
switch (_arg1){
case " ":
case "\t":
case "\r":
case "\n":
case "\f":
return (true);
default:
return (false);
};
}
public static function hexdump(_arg1:ByteArray):String{
var _local2:String;
var _local3:int;
var _local4:int;
var _local5:uint;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + toHex(_local3, 4));
_local4 = 0;
while ((((_local4 < 16)) && (((_local3 + _local4) < _arg1.length)))) {
_local5 = _arg1[(_local3 + _local4)];
_local2 = (_local2 + ((" " + HEX[(_local5 >> 4)]) + HEX[(_local5 & 15)]));
_local4++;
};
_local2 = (_local2 + "\n");
_local3 = (_local3 + 16);
};
return (_local2);
}
public static function prepad(_arg1:String, _arg2:int, _arg3:String=" "):String{
while (_arg1.length < _arg2) {
_arg1 = (_arg3 + _arg1);
};
return (_arg1);
}
public static function pad(_arg1:String, _arg2:int, _arg3:String=" "):String{
while (_arg1.length < _arg2) {
_arg1 = (_arg1 + _arg3);
};
return (_arg1);
}
public static function parseUnsignedInteger(_arg1:String, _arg2:uint=0):uint{
var _local3:Number;
_local3 = parseInt0(_arg1, _arg2, false);
if (_local3 < 0){
throw (new ArgumentError(Joiner.pairs("parseUnsignedInteger parsed negative value", "value", _arg1)));
};
return (uint(_local3));
}
public static function trimEnd(_arg1:String):String{
var _local2:int;
if (_arg1 == null){
return (null);
};
_local2 = _arg1.length;
while (isWhitespace(_arg1.charAt((_local2 - 1)))) {
_local2--;
};
return (((_local2)<_arg1.length) ? _arg1.slice(0, _local2) : _arg1);
}
public static function substitute(_arg1:String, ... _args):String{
var _local3:int;
var _local4:int;
var _local2:Array = Util.unfuckVarargs(_args);
_local3 = _local2.length;
_local4 = 0;
while (_local4 < _local3) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local4) + "\\}"), "g"), _local2[_local4]);
_local4++;
};
return (_arg1);
}
public static function hashCode(_arg1:String):int{
var _local2:int;
var _local3:int;
_local2 = 0;
if (_arg1 != null){
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = ((31 * _local2) + _arg1.charCodeAt(_local3));
_local3++;
};
};
return (_local2);
}
public static function parseNumber(_arg1:String):Number{
var _local2:String;
var _local3:String;
if (_arg1 == null){
throw (new ArgumentError("Cannot parseNumber(null)"));
};
if (_arg1 == "Infinity"){
return (Infinity);
};
if (_arg1 == "-Infinity"){
return (-(Infinity));
};
if (_arg1 == "NaN"){
return (NaN);
};
_local2 = _arg1;
_arg1 = _arg1.replace(",", "");
_local3 = _arg1;
_arg1 = validateDecimal(_arg1, true, true);
if (((!((null == _arg1))) && ((_arg1.charAt(0) == "e")))){
_arg1 = _arg1.substring(1);
validateDecimal(_arg1, false, false);
};
if (null == _arg1){
throw (new ArgumentError(Joiner.args("Could not convert to Number", _local2)));
};
return (parseFloat(_local3));
}
public static function endsWith(_arg1:String, _arg2:String):Boolean{
var _local3:int;
_local3 = (_arg1.length - _arg2.length);
return ((((_local3 >= 0)) && ((_arg1.indexOf(_arg2, _local3) >= 0))));
}
public static function formatNumber(_arg1:Number):String{
var _local2:String;
var _local3:String;
var _local4:int;
var _local5:int;
_local2 = "";
_local3 = _arg1.toString();
_local4 = _local3.lastIndexOf(".");
if (_local4 != -1){
_local2 = _local3.substring(_local4);
_local3 = _local3.substring(0, _local4);
};
_local5 = ((_arg1)<0) ? 1 : 0;
while ((_local3.length - _local5) > 3) {
_local2 = (("," + _local3.substring((_local3.length - 3))) + _local2);
_local3 = _local3.substring(0, (_local3.length - 3));
};
return ((_local3 + _local2));
}
public static function fromBytes(_arg1:ByteArray):String{
var _local2:String;
var _local3:int;
_local2 = "";
if (_arg1 != null){
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
};
return (_local2);
}
public static function compare(_arg1:String, _arg2:String):int{
return (Comparators.compareStrings(_arg1, _arg2));
}
public static function truncate(_arg1:String, _arg2:int, _arg3:String=""):String{
if ((((_arg1 == null)) || ((_arg1.length <= _arg2)))){
return (_arg1);
};
return ((_arg1.substring(0, (_arg2 - _arg3.length)) + _arg3));
}
public static function compareIgnoreCase(_arg1:String, _arg2:String):int{
return (Comparators.compareStringsInsensitively(_arg1, _arg2));
}
public static function isUpperCase(_arg1:String):Boolean{
var _local2:String;
_local2 = _arg1.charAt(0);
return ((((_local2.toUpperCase() == _local2)) && (!((_local2.toLowerCase() == _local2)))));
}
public static function trim(_arg1:String):String{
return (trimEnd(trimBeginning(_arg1)));
}
public static function trimBeginning(_arg1:String):String{
var _local2:int;
if (_arg1 == null){
return (null);
};
_local2 = 0;
while (isWhitespace(_arg1.charAt(_local2))) {
_local2++;
};
return (((_local2)>0) ? _arg1.slice(_local2, _arg1.length) : _arg1);
}
public static function toString(_arg1, _arg2:Dictionary=null):String{
var _local3:Boolean;
var _local4:String;
var _local5:Array;
var _local6:int;
var _local7:String;
if (_arg1 == null){
return (String(_arg1));
};
_local3 = (_arg1 is Dictionary);
if ((((((_arg1 is Array)) || (_local3))) || (Util.isPlainObject(_arg1)))){
if (_arg2 == null){
_arg2 = new Dictionary();
} else {
if (_arg2[_arg1] !== undefined){
return ("[cyclic reference]");
};
};
_arg2[_arg1] = true;
if ((_arg1 is Array)){
_local5 = (_arg1 as Array);
_local4 = "";
_local6 = 0;
while (_local6 < _local5.length) {
if (_local6 > 0){
_local4 = (_local4 + ", ");
};
_local4 = (_local4 + ((_local6 + ": ") + toString(_local5[_local6], _arg2)));
_local6++;
};
return ((("Array(" + _local4) + ")"));
} else {
_local4 = "";
for (_local7 in _arg1) {
if (_local4.length > 0){
_local4 = (_local4 + ", ");
};
_local4 = (_local4 + ((_local7 + "=>") + toString(_arg1[_local7], _arg2)));
};
return (((((_local3) ? "Dictionary" : "Object" + "(") + _local4) + ")"));
};
} else {
if ((_arg1 is XML)){
return (XmlUtil.toXMLString((_arg1 as XML)));
};
};
return (String(_arg1));
}
public static function deNull(_arg1:String):String{
return (((_arg1)==null) ? "" : _arg1);
}
public static function toBytes(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:int;
if (_arg1 == null){
return (null);
};
_local2 = new ByteArray();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2[_local3] = (int(_arg1.charCodeAt(_local3)) & 0xFF);
_local3++;
};
return (_local2);
}
public static function toColorString(_arg1:uint, _arg2:String="0x"):String{
return ((_arg2 + prepad(_arg1.toString(16), 6, "0")));
}
public static function capitalize(_arg1:String):String{
if (isBlank(_arg1)){
return (_arg1);
};
return ((_arg1.substr(0, 1).toUpperCase() + _arg1.substr(1)));
}
protected static function parseInt0(_arg1:String, _arg2:uint, _arg3:Boolean):Number{
var _local5:Boolean;
var _local6:int;
var _local7:Number;
var _local8:int;
if (_arg1 == null){
throw (new ArgumentError("Cannot parseInt(null)"));
};
_local5 = (_arg1.charAt(0) == "-");
if (_local5){
_arg1 = _arg1.substring(1);
};
if (_arg1 == "0"){
return (0);
};
if (_arg2 == 0){
if (startsWith(_arg1, "0x")){
_arg1 = _arg1.substring(2);
_arg2 = 16;
} else {
if (startsWith(_arg1, "0")){
_arg1 = _arg1.substring(1);
_arg2 = 8;
} else {
_arg2 = 10;
};
};
} else {
if ((((_arg2 == 16)) && (startsWith(_arg1, "0x")))){
_arg1 = _arg1.substring(2);
} else {
if ((((_arg2 < 2)) || ((_arg2 > 16)))){
throw (new ArgumentError(Joiner.args("Radix out of range", _arg2)));
};
};
};
_local6 = 0;
while (_local6 < _arg1.length) {
_local8 = HEX.indexOf(_arg1.charAt(_local6).toLowerCase());
if ((((_local8 == -1)) || ((_local8 >= _arg2)))){
throw (new ArgumentError(Joiner.pairs("Invalid characters in String", "string", arguments[0], "radix", _arg2)));
};
_local6++;
};
_local7 = parseInt(_arg1, _arg2);
if (isNaN(_local7)){
throw (new ArgumentError(Joiner.args("Could not parseInt", arguments[0])));
};
if (_local5){
_local7 = (_local7 * -1);
};
return (_local7);
}
public static function parseBoolean(_arg1:String):Boolean{
var _local2:String;
_local2 = _arg1;
if (_arg1 != null){
_arg1 = _arg1.toLowerCase();
if ((((_arg1 == "true")) || ((_arg1 == "1")))){
return (true);
};
if ((((_arg1 == "false")) || ((_arg1 == "0")))){
return (false);
};
};
throw (new ArgumentError(Joiner.args("Could not convert to Boolean", _local2)));
}
public static function startsWith(_arg1:String, _arg2:String):Boolean{
return ((_arg1.lastIndexOf(_arg2, 0) == 0));
}
public static function toHex(_arg1:uint, _arg2:uint):String{
return (prepad(_arg1.toString(16), _arg2, "0"));
}
protected static function validateDecimal(_arg1:String, _arg2:Boolean, _arg3:Boolean):String{
var _local4:Boolean;
var _local5:Boolean;
var _local6:String;
if (_arg1.charAt(0) == "-"){
_arg1 = _arg1.substring(1);
};
while (_arg1.length > 0) {
_local6 = _arg1.charAt(0);
if (_local6 == "."){
if (((!(_arg2)) || (_local4))){
return (null);
};
_local4 = true;
} else {
if (_local6 == "e"){
if (!_arg3){
return (null);
};
break;
} else {
if (DECIMAL.indexOf(_local6) >= 0){
_local5 = true;
} else {
return (null);
};
};
};
_arg1 = _arg1.substring(1);
};
if (!_local5){
return (null);
};
return (_arg1);
}
public static function simpleToString(_arg1:Object, _arg2:Array=null):String{
return (Joiner.simpleToString(_arg1, _arg2));
}
}
}//package com.threerings.util
Section 37
//Util (com.threerings.util.Util)
package com.threerings.util {
import flash.utils.*;
public class Util {
public static function init(_arg1:Object, _arg2:Object, _arg3:Object=null, _arg4:Object=null):void{
var _local5:String;
for (_local5 in _arg2) {
if ((((_arg4 == null)) || (!((_local5 in _arg4))))){
_arg1[_local5] = _arg2[_local5];
};
};
if (_arg3 != null){
for (_local5 in _arg3) {
if ((((_arg2 == null)) || (!((_local5 in _arg2))))){
_arg1[_local5] = _arg3[_local5];
};
};
};
}
public static function sequence(... _args):Function{
var functions = _args;
return (function (... _args):void{
var _local2:*;
for each (_local2 in functions) {
_local2.apply(null, _args);
};
});
}
public static function adapt(_arg1:Function, ... _args):Function{
var fn = _arg1;
var prepend = _args;
return (function (... _args){
if (prepend.length > 0){
_args.unshift.apply(null, prepend);
};
ArrayUtil.resize(_args, fn.length);
return (fn.apply(null, _args));
});
}
public static function keys(_arg1:Object):Array{
var _local2:Array;
var _local3:*;
_local2 = [];
for (_local3 in _arg1) {
_local2.push(_local3);
};
return (_local2);
}
public static function unit(_arg1:int):Function{
var n = _arg1;
return (function (... _args){
return (_args[n]);
});
}
public static function equals(_arg1:Object, _arg2:Object):Boolean{
var _local3:ByteArray;
var _local4:ByteArray;
var _local5:int;
if (_arg1 === _arg2){
return (true);
};
if ((_arg1 is Equalable)){
return ((_arg1 as Equalable).equals(_arg2));
};
if ((((_arg1 is Array)) && ((_arg2 is Array)))){
return (ArrayUtil.equals((_arg1 as Array), (_arg2 as Array)));
};
if ((((_arg1 is ByteArray)) && ((_arg2 is ByteArray)))){
_local3 = (_arg1 as ByteArray);
_local4 = (_arg2 as ByteArray);
if (_local3.length != _local4.length){
return (false);
};
_local5 = 0;
while (_local5 < _local3.length) {
if (_local3[_local5] != _local4[_local5]){
return (false);
};
_local5++;
};
return (true);
};
return (false);
}
public static function values(_arg1:Object):Array{
var _local2:Array;
var _local3:*;
_local2 = [];
for each (_local3 in _arg1) {
_local2.push(_local3);
};
return (_local2);
}
public static function getDefault(_arg1:Object, _arg2:String, _arg3:Object):Object{
return (((_arg2 in _arg1)) ? _arg1[_arg2] : _arg3);
}
public static function isSimple(_arg1:Object):Boolean{
var _local2:String;
_local2 = typeof(_arg1);
switch (_local2){
case "number":
case "string":
case "boolean":
return (true);
case "object":
return ((((_arg1 is Date)) || ((_arg1 is Array))));
default:
return (false);
};
}
public static function unfuckVarargs(_arg1:Array):Array{
return (((((_arg1.length == 1)) && ((_arg1[0] is Array)))) ? (_arg1[0] as Array) : _arg1);
}
public static function isPlainObject(_arg1:Object):Boolean{
return ((getQualifiedClassName(_arg1) == "Object"));
}
}
}//package com.threerings.util
Section 38
//WeakReference (com.threerings.util.WeakReference)
package com.threerings.util {
import flash.utils.*;
public class WeakReference {
protected var _ref:Dictionary;
public function WeakReference(_arg1:Object){
_ref = new Dictionary(true);
super();
_ref[_arg1] = true;
}
public function get(){
var _local1:*;
for (_local1 in _ref) {
return (_local1);
};
return (undefined);
}
}
}//package com.threerings.util
Section 39
//XmlReadError (com.threerings.util.XmlReadError)
package com.threerings.util {
public class XmlReadError extends Error {
public function XmlReadError(_arg1:String="", _arg2:XML=null){
super(getErrString(_arg1, _arg2), 0);
}
protected static function getErrString(_arg1:String, _arg2:XML=null):String{
var _local3:String;
_local3 = _arg1;
if (_arg2 != null){
_local3 = (_local3 + ("\n" + XmlUtil.toXMLString(_arg2)));
};
return (_local3);
}
}
}//package com.threerings.util
Section 40
//XmlUtil (com.threerings.util.XmlUtil)
package com.threerings.util {
public class XmlUtil {
public static function getUintAttr(_arg1:XML, _arg2:String, _arg3=undefined):uint{
return (getAttr(_arg1, _arg2, _arg3, StringUtil.parseUnsignedInteger));
}
public static function hasAttribute(_arg1:XML, _arg2:String):Boolean{
return (!((null == _arg1.attribute(_arg2)[0])));
}
public static function getStringArrayAttr(_arg1:XML, _arg2:String, _arg3:Array, _arg4=undefined):int{
var xml = _arg1;
var name = _arg2;
var stringMapping = _arg3;
var defaultValue = _arg4;
return (getAttr(xml, name, defaultValue, function (_arg1:String):int{
return (parseStringMember(_arg1, stringMapping));
}));
}
protected static function parseStringMember(_arg1:String, _arg2:Array):int{
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:String;
_local5 = 0;
while (_local5 < _arg2.length) {
if (String(_arg2[_local5]) == _arg1){
_local3 = _local5;
_local4 = true;
break;
};
_local5++;
};
if (!_local4){
_local6 = (("could not convert '" + _arg1) + "' to the correct value (must be one of: ");
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = (_local6 + String(_arg2[_local5]));
if (_local5 < (_arg2.length - 1)){
_local6 = (_local6 + ", ");
};
_local5++;
};
_local6 = (_local6 + ")");
throw (new ArgumentError(_local6));
};
return (_local3);
}
public static function getAttr(_arg1:XML, _arg2:String, _arg3, _arg4:Function=null){
var value:*;
var attr:XML;
var xml = _arg1;
var name = _arg2;
var defaultValue = _arg3;
var parseFunction = _arg4;
attr = xml.attribute(name)[0];
if (null == attr){
if (undefined !== defaultValue){
return (defaultValue);
};
throw (new XmlReadError((("error reading attribute '" + name) + "': attribute does not exist"), xml));
};
try {
value = ((null)!=parseFunction) ? parseFunction(attr) : attr;
} catch(e:ArgumentError) {
throw (new XmlReadError(((("error reading attribute '" + name) + "': ") + e.message), xml));
};
return (value);
}
public static function getEnumAttr(_arg1:XML, _arg2:String, _arg3:Class, _arg4=undefined){
var xml = _arg1;
var name = _arg2;
var enumClazz = _arg3;
var defaultValue = _arg4;
return (getAttr(xml, name, defaultValue, function (_arg1:String):Enum{
return (Enum.valueOf(enumClazz, _arg1));
}));
}
public static function hasChild(_arg1:XML, _arg2:String):Boolean{
return ((_arg1.child(_arg2).length() > 0));
}
public static function getIntAttr(_arg1:XML, _arg2:String, _arg3=undefined):int{
return (getAttr(_arg1, _arg2, _arg3, StringUtil.parseInteger));
}
public static function toString(_arg1:XML, _arg2:Object=null):String{
var xml = _arg1;
var settings = _arg2;
return ((safeOp(function (){
return (xml.toString());
}, settings) as String));
}
public static function toXMLString(_arg1:XML, _arg2:Object=null):String{
var xml = _arg1;
var settings = _arg2;
return ((safeOp(function (){
return (xml.toXMLString());
}, settings) as String));
}
public static function safeOp(_arg1:Function, _arg2:Object=null){
var oldSettings:Object;
var fn = _arg1;
var settings = _arg2;
oldSettings = XML.settings();
try {
XML.setSettings(settings);
var _local4:* = fn();
//unresolved jump
0;
return (_local4);
} finally {
XML.setSettings(oldSettings);
};
}
public static function getNumberAttr(_arg1:XML, _arg2:String, _arg3=undefined):Number{
return (getAttr(_arg1, _arg2, _arg3, StringUtil.parseNumber));
}
public static function getBooleanAttr(_arg1:XML, _arg2:String, _arg3=undefined):Boolean{
return (getAttr(_arg1, _arg2, _arg3, StringUtil.parseBoolean));
}
public static function newXML(_arg1:Object, _arg2:Object=null):XML{
var value = _arg1;
var settings = _arg2;
return ((safeOp(function (){
return (new XML(value));
}, settings) as XML));
}
public static function getStringAttr(_arg1:XML, _arg2:String, _arg3=undefined):String{
return (getAttr(_arg1, _arg2, _arg3));
}
public static function getSingleChild(_arg1:XML, _arg2:String, _arg3=undefined):XML{
var _local4:XML;
_local4 = _arg1.child(_arg2)[0];
if (null == _local4){
if (undefined !== _arg3){
return (_arg3);
};
throw (new XmlReadError((("error accessing child '" + _arg2) + "': child does not exist"), _arg1));
};
return (_local4);
}
}
}//package com.threerings.util
Section 41
//AbstractControl (com.whirled.AbstractControl)
package com.whirled {
import flash.events.*;
import flash.display.*;
import flash.errors.*;
public class AbstractControl extends EventDispatcher {
protected var _subControls:Array;
protected var _funcs:Object;
public function AbstractControl(_arg1:DisplayObject, _arg2:Object=null){
var _local3:Object;
var _local4:ConnectEvent;
var _local5:Object;
super();
_subControls = createSubControls();
if ((this is AbstractSubControl)){
return;
};
if (_arg1.root == null){
throw (new Error("Display object used to instantiate a control must be on the stage"));
};
_arg1.root.loaderInfo.addEventListener(Event.UNLOAD, handleUnload, false, 0, true);
_local3 = ((_arg2)!=null) ? _arg2 : new Object();
setUserProps(_local3);
_local4 = new ConnectEvent();
_local4.props.userProps = _local3;
_arg1.root.loaderInfo.sharedEvents.dispatchEvent(_local4);
if (Boolean(_local4.props.alreadyConnected)){
throw (new Error("You've already set up a Control instance. There should only be one."));
};
_local5 = _local4.props.hostProps;
if (_local5 != null){
gotHostProps(_local5);
};
}
public function callHostCode(_arg1:String, ... _args){
var func:Function;
var name = _arg1;
var args = _args;
if (_funcs != null){
try {
func = (_funcs[name] as Function);
if (func == null){
trace((("Host code \"" + name) + "\" not found!"));
} else {
return (func.apply(null, args));
};
} catch(err:Error) {
trace(((((("Error! Your code is broken! Unable to call a host method, perhaps " + "you've been shut down? [msg=") + err.message) + ", trace=") + err.getStackTrace()) + "]."));
};
} else {
checkIsConnected();
};
return (undefined);
}
protected function handleUnload(_arg1:Event):void{
dispatchEvent(_arg1);
}
override public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
super.removeEventListener(_arg1, _arg2, _arg3);
}
override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
protected function checkIsConnected():void{
if (!isConnected()){
throw (new IllegalOperationError(("The control is not connected to the host framework, please check isConnected(). " + "If false, your SWF is being viewed standalone and should adjust.")));
};
}
public function setUserProps(_arg1:Object):void{
var _local2:AbstractSubControl;
for each (_local2 in _subControls) {
_local2.setUserProps(_arg1);
};
}
public function doBatch(_arg1:Function, ... _args):void{
var fn = _arg1;
var args = _args;
callHostCode("startTransaction");
try {
fn.apply(null, args);
} finally {
callHostCode("commitTransaction");
};
}
protected function createSubControls():Array{
return (null);
}
public function gotHostProps(_arg1:Object):void{
var _local2:AbstractSubControl;
_funcs = _arg1;
for each (_local2 in _subControls) {
_local2.gotHostProps(_arg1);
};
}
public function isConnected():Boolean{
return (!((_funcs == null)));
}
}
}//package com.whirled
import flash.events.*;
class ConnectEvent extends Event {
public var props:Object;
private function ConnectEvent(_arg1:Object=null){
super("controlConnect", true, false);
props = ((_arg1) || ({}));
}
override public function clone():Event{
return (new ConnectEvent(props));
}
}
Section 42
//AbstractSubControl (com.whirled.AbstractSubControl)
package com.whirled {
import flash.events.*;
public class AbstractSubControl extends AbstractControl {
protected var _parent:AbstractControl;
public function AbstractSubControl(_arg1:AbstractControl){
_parent = _arg1;
_parent.addEventListener(Event.UNLOAD, handleUnload, false, 0, true);
super(null);
}
override public function doBatch(_arg1:Function, ... _args):void{
_args.unshift(_arg1);
_parent.doBatch.apply(null, _args);
}
override public function callHostCode(_arg1:String, ... _args){
_args.unshift(_arg1);
return (_parent.callHostCode.apply(null, _args));
}
override public function isConnected():Boolean{
return (_parent.isConnected());
}
}
}//package com.whirled
Section 43
//ActorControl (com.whirled.ActorControl)
package com.whirled {
import flash.display.*;
public class ActorControl extends EntityControl {
protected var _orient:Number;// = 0
protected var _isMoving:Boolean;
public function ActorControl(_arg1:DisplayObject){
_orient = 0;
super(_arg1);
}
override protected function gotInitProps(_arg1:Object):void{
super.gotInitProps(_arg1);
_orient = (_arg1["orient"] as Number);
_isMoving = (_arg1["isMoving"] as Boolean);
}
public function isMoving():Boolean{
return (_isMoving);
}
public function getOrientation():Number{
return (_orient);
}
override public function setUserProps(_arg1:Object):void{
super.setUserProps(_arg1);
_arg1["appearanceChanged_v2"] = appearanceChanged_v2;
_arg1["stateSet_v1"] = stateSet_v1;
}
public function setLogicalLocation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
callHostCode("setLocation_v1", _arg1, _arg2, _arg3, _arg4);
}
public function setMoveSpeed(_arg1:Number):void{
callHostCode("setMoveSpeed_v1", _arg1);
}
public function setPixelLocation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Array;
_local5 = getRoomBounds();
setLogicalLocation((_arg1 / _local5[0]), (_arg2 / _local5[1]), (_arg3 / _local5[2]), _arg4);
}
public function setState(_arg1:String):void{
callHostCode("setState_v1", _arg1);
}
public function setOrientation(_arg1:Number):void{
callHostCode("setOrientation_v1", _arg1);
}
public function getState():String{
return ((isConnected()) ? (callHostCode("getState_v1") as String) : null);
}
protected function appearanceChanged_v2(_arg1:Array, _arg2:Number, _arg3:Boolean, _arg4:Boolean):void{
_location = _arg1;
_orient = _arg2;
_isMoving = _arg3;
dispatchCtrlEvent(ControlEvent.APPEARANCE_CHANGED);
}
protected function stateSet_v1(_arg1:String):void{
dispatchCtrlEvent(ControlEvent.STATE_CHANGED, _arg1);
}
}
}//package com.whirled
Section 44
//AvatarControl (com.whirled.AvatarControl)
package com.whirled {
import flash.display.*;
import com.threerings.util.*;
public class AvatarControl extends ActorControl {
protected var _states:Array;
protected var _isSleeping:Boolean;
protected var _actions:Array;
public function AvatarControl(_arg1:DisplayObject){
_actions = [];
_states = [];
super(_arg1);
}
override protected function gotInitProps(_arg1:Object):void{
super.gotInitProps(_arg1);
_isSleeping = (_arg1["isSleeping"] as Boolean);
}
override public function setUserProps(_arg1:Object):void{
super.setUserProps(_arg1);
_arg1["avatarSpoke_v1"] = avatarSpoke_v1;
_arg1["getActions_v1"] = getActions_v1;
_arg1["getStates_v1"] = getStates_v1;
}
protected function verifyActionsOrStates(_arg1:Array, _arg2:Boolean):void{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = (_arg2) ? "action" : "state";
_local4 = 0;
while (_local4 < _arg1.length) {
if (_arg1[_local4] != null){
if (!(_arg1[_local4] is String)){
throw (new ArgumentError((((("All " + _local3) + "s must be Strings (") + _local4) + ").")));
};
if (String(_arg1[_local4]).length > 64){
throw (new ArgumentError((("All " + _local3) + "s must be less than 64 characters.")));
};
};
_local5 = 0;
while (_local5 < _local4) {
if (_arg1[_local5] === _arg1[_local4]){
throw (new ArgumentError(((("Duplicate " + _local3) + " specified: ") + _arg1[_local4])));
};
_local5++;
};
_local4++;
};
}
protected function getStates_v1():Array{
return (_states);
}
override protected function appearanceChanged_v2(_arg1:Array, _arg2:Number, _arg3:Boolean, _arg4:Boolean):void{
_isSleeping = _arg4;
super.appearanceChanged_v2(_arg1, _arg2, _arg3, _arg4);
}
public function registerStates(... _args):void{
var _local1:Array = Util.unfuckVarargs(_args);
verifyActionsOrStates(_local1, false);
_states = _local1;
}
protected function avatarSpoke_v1():void{
dispatchCtrlEvent(ControlEvent.AVATAR_SPOKE);
}
public function registerActions(... _args):void{
var _local1:Array = Util.unfuckVarargs(_args);
verifyActionsOrStates(_local1, true);
_actions = _local1;
}
override public function getState():String{
var _local1:String;
_local1 = super.getState();
if ((((_local1 == null)) && ((_states.length > 0)))){
_local1 = (_states[0] as String);
};
return (_local1);
}
protected function getActions_v1():Array{
return (_actions);
}
public function setPreferredY(_arg1:int):void{
callHostCode("setPreferredY_v1", _arg1);
}
public function isSleeping():Boolean{
return (_isSleeping);
}
}
}//package com.whirled
Section 45
//ControlEvent (com.whirled.ControlEvent)
package com.whirled {
import flash.events.*;
public class ControlEvent extends Event {
protected var _name:String;
protected var _value:Object;
public static const APPEARANCE_CHANGED:String = "appearanceChanged";
public static const STATE_CHANGED:String = "stateChanged";
public static const HOVER_OUT:String = "hoverOut";
public static const AVATAR_SPOKE:String = "avatarSpoke";
public static const CONTROL_ACQUIRED:String = "controlAcquired";
public static const MEMORY_CHANGED:String = "memoryChanged";
public static const HOVER_OVER:String = "hoverOver";
public static const SIGNAL_RECEIVED:String = "signalRecieved";
public static const ENTITY_LEFT:String = "entityLeft";
public static const MUSIC_STARTED:String = "musicStarted";
public static const CHAT_RECEIVED:String = "chatReceived";
public static const ACTION_TRIGGERED:String = "actionTriggered";
public static const MUSIC_STOPPED:String = "musicStopped";
public static const ENTITY_MOVED:String = "entityMoved";
public static const MESSAGE_RECEIVED:String = "messageRecieved";
public static const ENTITY_ENTERED:String = "entityEntered";
public static const MUSIC_ID3:String = "musicId3";
public function ControlEvent(_arg1:String, _arg2:String=null, _arg3:Object=null){
super(_arg1);
_name = _arg2;
_value = _arg3;
}
public function get name():String{
return (_name);
}
override public function toString():String{
return ((((((("ControlEvent [type=" + type) + ", name=") + _name) + ", value=") + _value) + "]"));
}
override public function get target():Object{
return (super.target);
}
public function get value():Object{
return (_value);
}
override public function clone():Event{
return (new ControlEvent(type, _name, _value));
}
}
}//package com.whirled
Section 46
//EntityControl (com.whirled.EntityControl)
package com.whirled {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
public class EntityControl extends AbstractControl {
protected var _hasControl:Boolean;// = false
protected var _datapack:ByteArray;
protected var _env:String;
protected var _ticker:Timer;
protected var _location:Array;
protected var _propertyProvider:Function;
protected var _tickInterval:Number;// = 0
protected var _customConfig:Function;
public static const ENV_VIEWER:String = "viewer";
public static const PROP_MEMBER_ID:String = "std:member_id";
public static const ENV_ROOM:String = "room";
public static const PROP_HOTSPOT:String = "std:hotspot";
public static const PROP_ORIENTATION:String = "std:orientation";
public static const PROP_MOVE_SPEED:String = "std:move_speed";
public static const PROP_TYPE:String = "std:type";
public static const TYPE_FURNI:String = "furni";
public static const PROP_NAME:String = "std:name";
public static const PROP_DIMENSIONS:String = "std:dimensions";
public static const ENV_SHOP:String = "shop";
public static const PROP_LOCATION_PIXEL:String = "std:location_pixel";
public static const TYPE_PET:String = "pet";
public static const PROP_LOCATION_LOGICAL:String = "std:location_logical";
public static const TYPE_AVATAR:String = "avatar";
public function EntityControl(_arg1:DisplayObject){
_tickInterval = 0;
_hasControl = false;
super(_arg1);
if (Object(this).constructor == EntityControl){
throw (new Error(("Do not directly use EntityControl. " + "Use the appropriate subclass: AvatarControl, FurniControl, etc.")));
};
}
protected function lookupEntityProperty_v1(_arg1:String):Object{
return (((_propertyProvider == null)) ? null : _propertyProvider(_arg1));
}
public function setMemory(_arg1:String, _arg2:Object, _arg3:Function=null):void{
callHostCode("updateMemory_v1", _arg1, _arg2, _arg3);
}
public function setTickInterval(_arg1:Number):void{
_tickInterval = ((((_arg1 > 100)) || ((_arg1 <= 0)))) ? _arg1 : 100;
if (_hasControl){
recheckTicker();
};
}
public function getMusicId3():Object{
return (callHostCode("getMusicId3_v1"));
}
protected function entityMoved_v2(_arg1:String, _arg2:Array):void{
if (_hasControl){
dispatchCtrlEvent(ControlEvent.ENTITY_MOVED, _arg1, _arg2);
};
}
public function getDefaultDataPack():ByteArray{
return (_datapack);
}
protected function messageReceived_v1(_arg1:String, _arg2:Object, _arg3:Boolean):void{
dispatchCtrlEvent((_arg3) ? ControlEvent.ACTION_TRIGGERED : ControlEvent.MESSAGE_RECEIVED, _arg1, _arg2);
}
protected function gotInitProps(_arg1:Object):void{
_location = (_arg1["location"] as Array);
_datapack = (_arg1["datapack"] as ByteArray);
_env = (_arg1["env"] as String);
}
public function getInstanceId():int{
return (int(callHostCode("getInstanceId_v1")));
}
public function getCamera(_arg1:String=null):Camera{
return ((isConnected()) ? (callHostCode("getCamera_v1", _arg1) as Camera) : Camera.getCamera(_arg1));
}
public function dispatchCtrlEvent(_arg1:String, _arg2:String=null, _arg3:Object=null):void{
if (hasEventListener(_arg1)){
dispatchEvent(new ControlEvent(_arg1, _arg2, _arg3));
};
}
public function triggerAction(_arg1:String, _arg2:Object=null):void{
callHostCode("sendMessage_v1", _arg1, _arg2, true);
}
protected function entityEntered_v1(_arg1:String):void{
if (_hasControl){
dispatchCtrlEvent(ControlEvent.ENTITY_ENTERED, _arg1);
};
}
public function getEntityIds(_arg1:String=null):Array{
var _local2:Array;
_local2 = callHostCode("getEntityIds_v1", _arg1);
return (((_local2)==null) ? [] : _local2);
}
public function getMyEntityId():String{
return (callHostCode("getMyEntityId_v1"));
}
protected function receivedChat_v2(_arg1:String, _arg2:String):void{
if (_hasControl){
dispatchCtrlEvent(ControlEvent.CHAT_RECEIVED, _arg1, _arg2);
};
}
override public function setUserProps(_arg1:Object):void{
super.setUserProps(_arg1);
_arg1["memoryChanged_v1"] = memoryChanged_v1;
_arg1["gotControl_v1"] = gotControl_v1;
_arg1["messageReceived_v1"] = messageReceived_v1;
_arg1["signalReceived_v1"] = signalReceived_v1;
_arg1["receivedChat_v2"] = receivedChat_v2;
_arg1["hasConfigPanel_v1"] = hasConfigPanel_v1;
_arg1["getConfigPanel_v1"] = getConfigPanel_v1;
_arg1["musicStartStop_v1"] = musicStartStop_v1;
_arg1["musicId3_v1"] = musicId3_v1;
_arg1["entityEntered_v1"] = entityEntered_v1;
_arg1["entityLeft_v1"] = entityLeft_v1;
_arg1["entityMoved_v2"] = entityMoved_v2;
_arg1["lookupEntityProperty_v1"] = lookupEntityProperty_v1;
}
public function getPixelLocation():Array{
var _local1:Array;
var _local2:int;
if (_location == null){
return (null);
};
_local1 = getRoomBounds();
_local2 = 0;
while (_local2 < _location.length) {
_local1[_local2] = (_local1[_local2] * _location[_local2]);
_local2++;
};
return (_local1);
}
protected function recheckTicker():void{
if (((_hasControl) && ((_tickInterval > 0)))){
if (_ticker == null){
_ticker = new Timer(_tickInterval);
_ticker.addEventListener(TimerEvent.TIMER, dispatchEvent);
} else {
_ticker.delay = _tickInterval;
};
_ticker.start();
} else {
stopTicker();
};
}
public function getMicrophone(_arg1:int=-1):Microphone{
return ((isConnected()) ? (callHostCode("getMicrophone_v1", _arg1) as Microphone) : Microphone.getMicrophone(_arg1));
}
public function getLogicalLocation():Array{
return (_location);
}
public function registerPropertyProvider(_arg1:Function):void{
_propertyProvider = _arg1;
}
protected function stopTicker():void{
if (_ticker != null){
_ticker.stop();
_ticker = null;
};
}
public function setHotSpot(_arg1:Number, _arg2:Number, _arg3:Number=NaN):void{
callHostCode("setHotSpot_v1", _arg1, _arg2, _arg3);
}
public function showPopup(_arg1:String, _arg2:DisplayObject, _arg3:Number, _arg4:Number, _arg5:uint=0xFFFFFF, _arg6:Number=1):Boolean{
return ((callHostCode("showPopup_v1", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) as Boolean));
}
protected function hasConfigPanel_v1():Boolean{
return (!((_customConfig == null)));
}
protected function musicId3_v1(_arg1:Object):void{
dispatchCtrlEvent(ControlEvent.MUSIC_ID3, null, _arg1);
}
public function getViewerName(_arg1:int=0):String{
return ((callHostCode("getViewerName_v1", _arg1) as String));
}
public function getMusicOwnerId():int{
return (callHostCode("getMusicOwner_v1"));
}
protected function gotControl_v1():void{
if (_hasControl){
return;
};
_hasControl = true;
dispatchCtrlEvent(ControlEvent.CONTROL_ACQUIRED);
recheckTicker();
}
override protected function handleUnload(_arg1:Event):void{
super.handleUnload(_arg1);
_hasControl = false;
stopTicker();
}
public function canManageRoom(_arg1:int=0):Boolean{
return ((callHostCode("canEditRoom_v1", _arg1) as Boolean));
}
public function getMemories():Object{
var _local1:Object;
_local1 = callHostCode("getMemories_v1");
return (((_local1)==null) ? {} : _local1);
}
public function registerCustomConfig(_arg1:Function):void{
_customConfig = _arg1;
}
override protected function checkIsConnected():void{
}
protected function signalReceived_v1(_arg1:String, _arg2:Object):void{
if (_hasControl){
dispatchCtrlEvent(ControlEvent.SIGNAL_RECEIVED, _arg1, _arg2);
};
}
protected function musicStartStop_v1(_arg1:Boolean, ... _args):void{
dispatchCtrlEvent((_arg1) ? ControlEvent.MUSIC_STARTED : ControlEvent.MUSIC_STOPPED);
}
public function getEnvironment():String{
return (_env);
}
public function sendMessage(_arg1:String, _arg2:Object=null):void{
callHostCode("sendMessage_v1", _arg1, _arg2, false);
}
public function hasControl():Boolean{
return (_hasControl);
}
public function getRoomBounds():Array{
return ((callHostCode("getRoomBounds_v1") as Array));
}
public function sendSignal(_arg1:String, _arg2:Object=null):void{
callHostCode("sendSignal_v1", _arg1, _arg2);
}
protected function memoryChanged_v1(_arg1:String, _arg2:Object):void{
dispatchCtrlEvent(ControlEvent.MEMORY_CHANGED, _arg1, _arg2);
}
public function clearPopup():void{
callHostCode("clearPopup_v1");
}
public function getEntityProperty(_arg1:String, _arg2:String=null):Object{
return (callHostCode("getEntityProperty_v1", _arg2, _arg1));
}
protected function entityLeft_v1(_arg1:String):void{
if (_hasControl){
dispatchCtrlEvent(ControlEvent.ENTITY_LEFT, _arg1);
};
}
protected function getConfigPanel_v1():DisplayObject{
return (((_customConfig)!=null) ? (_customConfig() as DisplayObject) : null);
}
public function getMemory(_arg1:String, _arg2:Object=null):Object{
var _local3:Object;
_local3 = callHostCode("lookupMemory_v1", _arg1);
return (((_local3)==null) ? _arg2 : _local3);
}
override public function gotHostProps(_arg1:Object):void{
super.gotHostProps(_arg1);
if (("initProps" in _arg1)){
gotInitProps(_arg1.initProps);
delete _arg1.initProps;
};
}
}
}//package com.whirled
Section 47
//Back_L_Hand_99 (KawaiiConfig_fla.Back_L_Hand_99)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Back_L_Hand_99 extends MovieClip {
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 48
//Back_R_Hand_97 (KawaiiConfig_fla.Back_R_Hand_97)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Back_R_Hand_97 extends MovieClip {
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 49
//brb_80 (KawaiiConfig_fla.brb_80)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class brb_80 extends MovieClip {
public var item:MovieClip;
}
}//package KawaiiConfig_fla
Section 50
//button_color_113 (KawaiiConfig_fla.button_color_113)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class button_color_113 extends MovieClip {
public var options_color:MovieClip;
}
}//package KawaiiConfig_fla
Section 51
//Face_56 (KawaiiConfig_fla.Face_56)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Face_56 extends MovieClip {
public var theface:MovieClip;
}
}//package KawaiiConfig_fla
Section 52
//Face_57 (KawaiiConfig_fla.Face_57)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Face_57 extends MovieClip {
public var leye:MovieClip;
public var reye:MovieClip;
public var mouth:MovieClip;
}
}//package KawaiiConfig_fla
Section 53
//Front_Bangs_63 (KawaiiConfig_fla.Front_Bangs_63)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Bangs_63 extends MovieClip {
public var extra:MovieClip;
public var extra2:MovieClip;
public var hair:MovieClip;
}
}//package KawaiiConfig_fla
Section 54
//Front_Belly_42 (KawaiiConfig_fla.Front_Belly_42)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Belly_42 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
public var btop:MovieClip;
}
}//package KawaiiConfig_fla
Section 55
//Front_Chest_46 (KawaiiConfig_fla.Front_Chest_46)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Chest_46 extends MovieClip {
public var extra:MovieClip;
public var top:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 56
//Front_Hair_4 (KawaiiConfig_fla.Front_Hair_4)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Hair_4 extends MovieClip {
public var item:MovieClip;
}
}//package KawaiiConfig_fla
Section 57
//Front_L_Bicep_6 (KawaiiConfig_fla.Front_L_Bicep_6)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Bicep_6 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 58
//Front_L_Foot_19 (KawaiiConfig_fla.Front_L_Foot_19)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Foot_19 extends MovieClip {
public var shoes2:MovieClip;
public var shoes:MovieClip;
}
}//package KawaiiConfig_fla
Section 59
//Front_L_Forearm_12 (KawaiiConfig_fla.Front_L_Forearm_12)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Forearm_12 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 60
//Front_L_Hand_10 (KawaiiConfig_fla.Front_L_Hand_10)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Hand_10 extends MovieClip {
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 61
//Front_L_Shin_15 (KawaiiConfig_fla.Front_L_Shin_15)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Shin_15 extends MovieClip {
public var pants:MovieClip;
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 62
//Front_L_Thigh_22 (KawaiiConfig_fla.Front_L_Thigh_22)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_L_Thigh_22 extends MovieClip {
public var pants:MovieClip;
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 63
//Front_Neck_50 (KawaiiConfig_fla.Front_Neck_50)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Neck_50 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 64
//Front_Pelvis_37 (KawaiiConfig_fla.Front_Pelvis_37)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Pelvis_37 extends MovieClip {
public var pants:MovieClip;
public var belt:MovieClip;
public var extra:MovieClip;
public var skirt:MovieClip;
}
}//package KawaiiConfig_fla
Section 65
//Front_R_Bicep_60 (KawaiiConfig_fla.Front_R_Bicep_60)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Bicep_60 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 66
//Front_R_Foot_30 (KawaiiConfig_fla.Front_R_Foot_30)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Foot_30 extends MovieClip {
public var shoes2:MovieClip;
public var shoes:MovieClip;
}
}//package KawaiiConfig_fla
Section 67
//Front_R_Forearm_69 (KawaiiConfig_fla.Front_R_Forearm_69)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Forearm_69 extends MovieClip {
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 68
//Front_R_Hand_67 (KawaiiConfig_fla.Front_R_Hand_67)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Hand_67 extends MovieClip {
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 69
//Front_R_Shin_26 (KawaiiConfig_fla.Front_R_Shin_26)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Shin_26 extends MovieClip {
public var pants:MovieClip;
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 70
//Front_R_Thigh_33 (KawaiiConfig_fla.Front_R_Thigh_33)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_R_Thigh_33 extends MovieClip {
public var pants:MovieClip;
public var extra:MovieClip;
public var skin:MovieClip;
}
}//package KawaiiConfig_fla
Section 71
//Front_Skull_53 (KawaiiConfig_fla.Front_Skull_53)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Front_Skull_53 extends MovieClip {
public var skin:MovieClip;
public var hair:MovieClip;
}
}//package KawaiiConfig_fla
Section 72
//Happy_86 (KawaiiConfig_fla.Happy_86)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Happy_86 extends MovieClip {
public function Happy_86(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package KawaiiConfig_fla
Section 73
//MainTimeline (KawaiiConfig_fla.MainTimeline)
package KawaiiConfig_fla {
import com.whirled.*;
import flash.events.*;
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var _ctrl:AvatarControl;
public var _body:ConfigXPBody;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function handleUnload(... _args):void{
_body.shutdown();
}
function frame1(){
if (_ctrl == null){
_ctrl = new AvatarControl(this);
_body = new ConfigXPBody(_ctrl, this, 560);
_body.registerOption("hairColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("hairColor", ["hair", "item"], ["bangs", "hair"], ["skull", "hair"]);
_body.registerOption("hairNumber", ConfigXPBody.OPTION_DROPDOWN, 2, ["Wave", "Straight", "Short", "Side Tail", "Tails", "Bun", "Sweep", "Low Tails"]);
_body.setImageConfigFrames("hairNumber", ["hair", "item"]);
_body.registerOption("bangsNumber", ConfigXPBody.OPTION_DROPDOWN, 2, ["None", "Blunt", "Blunt Buns", "Sweep", "Cutie", "Messy", "Long Sweeps", "Hawk", "Messy Wave"]);
_body.setImageConfigFrames("bangsNumber", ["bangs", "hair"]);
_body.registerOption("hatNumber", ConfigXPBody.OPTION_DROPDOWN, 8, ["None", "Headphones", "Headband", "Bow", "Top Hat", "Bear Hat", "Goggles", "Bunny Ears", "Horns", "Halo", "Showgirl"]);
_body.setImageConfigFrames("hatNumber", ["bangs", "extra"], ["bangs", "extra2"]);
_body.registerOption("hatColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("hatColor", ["bangs", "extra"]);
_body.registerOption("hat2Color", ConfigXPBody.OPTION_COLOR_ALL, 0xFFFFFF);
_body.setRecolorFrames("hat2Color", ["bangs", "extra2"]);
_body.registerOption("eyeColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("eyeColor", ["theface", "theface", "leye"], ["theface", "theface", "reye"], ["theface2", "leye"], ["theface2", "reye"]);
_body.registerOption("topColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("topColor", ["chest", "top"]);
_body.registerOption("topNumber", ConfigXPBody.OPTION_DROPDOWN, 5, ["Tube", "Straps", "Cross", "Scoop", "Full", "Halter", "Wrap"]);
_body.setImageConfigFrames("topNumber", ["chest", "top"]);
_body.registerOption("extratColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("extratColor", ["chest", "extra"]);
_body.registerOption("extratNumber", ConfigXPBody.OPTION_DROPDOWN, 14, ["None", "Jewel", "Chain", "Flower", "Lace", "Ruffles", "Buttons", "Full Buttons", "Cross Belt", "Vest", "Jacket", "Cute Jacket", "Blazer", "Cut Out", "Suspenders"]);
_body.setImageConfigFrames("extratNumber", ["chest", "extra"]);
_body.registerOption("neckColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("neckColor", ["neck", "extra"]);
_body.registerOption("neckNumber", ConfigXPBody.OPTION_DROPDOWN, 10, ["None", "Choker", "Jewel Choker", "Pendant", "Flower Pendant", "Pearls", "Collar", "Tie", "Bandana", "Turtle", "Spiked Collar"]);
_body.setImageConfigFrames("neckNumber", ["neck", "extra"]);
_body.registerOption("bellyColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("bellyColor", ["belly", "btop"]);
_body.registerOption("bellyNumber", ConfigXPBody.OPTION_DROPDOWN, 5, ["None", "Short", "Medium", "Long", "Corset", "Triangle", "Fairy", "Fuzzyz"]);
_body.setImageConfigFrames("bellyNumber", ["belly", "btop"]);
_body.registerOption("extrabColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("extrabColor", ["belly", "extra"]);
_body.registerOption("extrabNumber", ConfigXPBody.OPTION_DROPDOWN, 5, ["None", "S Button", "S Lace", "S Panels", "M Fade", "M Panels", "M Trim", "L Buttons", "L Panels", "L Lace", "Cross Belts", "Suspenders", "Wrap"]);
_body.setImageConfigFrames("extrabNumber", ["belly", "extra"]);
_body.registerOption("bicepColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("bicepColor", ["lbicep", "extra"], ["rbicep", "extra"]);
_body.registerOption("bicepNumber", ConfigXPBody.OPTION_DROPDOWN, 3, ["None", "Cap", "Long", "Puff", "Fairy"]);
_body.setImageConfigFrames("bicepNumber", ["lbicep", "extra"], ["rbicep", "extra"]);
_body.registerOption("armColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("armColor", ["rarm", "extra"], ["larm", "extra"]);
_body.registerOption("armNumber", ConfigXPBody.OPTION_DROPDOWN, 4, ["None", "Warmer", "Long", "Stripes", "Armlet", "Spikes", "Pearls", "Bracelets", "Cuff", "Web", "Fuzzyz", "Cyber"]);
_body.setImageConfigFrames("armNumber", ["rarm", "extra"], ["larm", "extra"]);
_body.registerOption("brbColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("brbColor", ["brb", "item"]);
_body.registerOption("skirtColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("skirtColor", ["pelvis", "skirt"]);
_body.registerOption("skirtNumber", ConfigXPBody.OPTION_DROPDOWN, 1, ["None", "Princess", "Flow", "Cutie", "Mini", "Maria", "Fairy", "Warrior", "Fuzzyz"]);
_body.setImageConfigFrames("skirtNumber", ["pelvis", "skirt"]);
_body.registerOption("beltColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("beltColor", ["pelvis", "belt"]);
_body.registerOption("beltNumber", ConfigXPBody.OPTION_DROPDOWN, 2, ["None", "Belt"]);
_body.setImageConfigFrames("beltNumber", ["pelvis", "belt"]);
_body.registerOption("beltxxColor", ConfigXPBody.OPTION_COLOR_ALL, 0xFFFFFF);
_body.setRecolorFrames("beltxxColor", ["pelvis", "extra"]);
_body.registerOption("beltxxNumber", ConfigXPBody.OPTION_DROPDOWN, 3, ["None", "Loops", "Loops Chain", "Spikes"]);
_body.setImageConfigFrames("beltxxNumber", ["pelvis", "extra"]);
_body.registerOption("shoesColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("shoesColor", ["lfoot", "shoes"], ["rfoot", "shoes"]);
_body.registerOption("shoes2Color", ConfigXPBody.OPTION_COLOR_ALL, 0xFFFFFF);
_body.setRecolorFrames("shoes2Color", ["lfoot", "shoes2"], ["rfoot", "shoes2"]);
_body.registerOption("shoesNumber", ConfigXPBody.OPTION_DROPDOWN, 5, ["Rocker", "Sky High", "Cutie", "Fuzzyz", "Slippers", "Sneakers", "Sneakers V2"]);
_body.setImageConfigFrames("shoesNumber", ["lfoot", "shoes"], ["rfoot", "shoes"], ["lfoot", "shoes2"], ["rfoot", "shoes2"]);
_body.registerOption("shinColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("shinColor", ["rshin", "extra"], ["lshin", "extra"], ["lthigh", "extra"], ["rthigh", "extra"]);
_body.registerOption("shinNumber", ConfigXPBody.OPTION_DROPDOWN, 2, ["None", "Stripes", "Warmer", "Web", "Leglets", "Cyber"]);
_body.setImageConfigFrames("shinNumber", ["rshin", "extra"], ["lshin", "extra"], ["lthigh", "extra"], ["rthigh", "extra"]);
_body.registerOption("pantsColor", ConfigXPBody.OPTION_COLOR_ALL, 0x222222);
_body.setRecolorFrames("pantsColor", ["rshin", "pants"], ["lshin", "pants"], ["lthigh", "pants"], ["rthigh", "pants"], ["pelvis", "pants"]);
_body.registerOption("pantsNumber", ConfigXPBody.OPTION_DROPDOWN, 4, ["Shorts", "Rocker", "Regular", "Ripped", "Racer", "Plain"]);
_body.setImageConfigFrames("pantsNumber", ["rshin", "pants"], ["lshin", "pants"], ["lthigh", "pants"], ["rthigh", "pants"], ["pelvis", "pants"]);
_body.registerOption("skinColor", ConfigXPBody.OPTION_COLOR_SKIN, 13996874);
_body.setRecolorFrames("skinColor", ["skull", "skin"], ["chest", "skin"], ["rbicep", "skin"], ["rarm", "skin"], ["rhand", "skin"], ["rhand2", "skin"], ["rthigh", "skin"], ["rshin", "skin"], ["lshin", "skin"], ["belly", "skin"], ["lthigh", "skin"], ["pelvis", "skin"], ["lhand", "skin"], ["lhand2", "skin"], ["larm", "skin"], ["lbicep", "skin"], ["neck", "skin"]);
_body.registerOption("mouthNumber", ConfigXPBody.OPTION_DROPDOWN, 1, ["Smirk", "Serious", "Frown", "Lips", "Grin"]);
_body.setImageConfigFrames("mouthNumber", ["theface", "theface", "mouth"]);
_body.registerOption("wingsColor", ConfigXPBody.OPTION_COLOR_ALL, 12116218);
_body.setRecolorFrames("wingsColor", ["wings", "item"]);
_body.registerOption("wingsNumber", ConfigXPBody.OPTION_DROPDOWN, 1, ["None", "Fairy", "Pure", "Butterfly", "Demon", "Blade"]);
_body.setImageConfigFrames("wingsNumber", ["wings", "item"]);
_body.completeConfig();
_ctrl.setHotSpot(280, 366, 250);
_ctrl.setMoveSpeed(110);
_ctrl.addEventListener(Event.UNLOAD, handleUnload);
};
}
}
}//package KawaiiConfig_fla
Section 74
//popup_config_109 (KawaiiConfig_fla.popup_config_109)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class popup_config_109 extends MovieClip {
public var skirtColor:MovieClip;
public var shinNumber:SimpleButton;
public var extrabColor:MovieClip;
public var beltNumber:SimpleButton;
public var extrabNumber:SimpleButton;
public var skirtNumber:SimpleButton;
public var neckColor:MovieClip;
public var pantsNumber:SimpleButton;
public var shoesNumber:SimpleButton;
public var armColor:MovieClip;
public var bangsNumber:SimpleButton;
public var brbColor:MovieClip;
public var beltxxNumber:SimpleButton;
public var wingsColor:MovieClip;
public var neckNumber:SimpleButton;
public var hairColor:MovieClip;
public var hat2Color:MovieClip;
public var bellyNumber:SimpleButton;
public var armNumber:SimpleButton;
public var extratNumber:SimpleButton;
public var bicepNumber:SimpleButton;
public var beltxxColor:MovieClip;
public var button_randomize:SimpleButton;
public var pantsColor:MovieClip;
public var mouthNumber:SimpleButton;
public var bicepColor:MovieClip;
public var topNumber:SimpleButton;
public var topColor:MovieClip;
public var bellyColor:MovieClip;
public var beltColor:MovieClip;
public var wingsNumber:SimpleButton;
public var shoes2Color:MovieClip;
public var shinColor:MovieClip;
public var shoesColor:MovieClip;
public var extratColor:MovieClip;
public var hatColor:MovieClip;
public var eyeColor:MovieClip;
public var hairNumber:SimpleButton;
public var hatNumber:SimpleButton;
public var thumb:state_Default;
public var skinColor:MovieClip;
}
}//package KawaiiConfig_fla
Section 75
//popup_save_118 (KawaiiConfig_fla.popup_save_118)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class popup_save_118 extends MovieClip {
public var slot3:MovieClip;
public var slot1:MovieClip;
public var slot2:MovieClip;
public var slot4:MovieClip;
}
}//package KawaiiConfig_fla
Section 76
//popup_share_115 (KawaiiConfig_fla.popup_share_115)
package KawaiiConfig_fla {
import flash.display.*;
import flash.text.*;
public dynamic class popup_share_115 extends MovieClip {
public var loadCode:TextField;
public var buttonLoad:SimpleButton;
public var shareCode:TextField;
}
}//package KawaiiConfig_fla
Section 77
//saveSlot_119 (KawaiiConfig_fla.saveSlot_119)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class saveSlot_119 extends MovieClip {
public var buttonLoad:SimpleButton;
public var buttonSave:SimpleButton;
public var thumb:state_Default;
}
}//package KawaiiConfig_fla
Section 78
//Symbol10_91 (KawaiiConfig_fla.Symbol10_91)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Symbol10_91 extends MovieClip {
public var leye:MovieClip;
public var reye:MovieClip;
}
}//package KawaiiConfig_fla
Section 79
//Wings_2 (KawaiiConfig_fla.Wings_2)
package KawaiiConfig_fla {
import flash.display.*;
public dynamic class Wings_2 extends MovieClip {
public var item:MovieClip;
}
}//package KawaiiConfig_fla
Section 80
//action_Laugh (action_Laugh)
package {
import flash.display.*;
public dynamic class action_Laugh extends MovieClip {
public var pants:MovieClip;
public var belt:MovieClip;
public var extra:MovieClip;
public var skirt:MovieClip;
public var top:MovieClip;
public var shoes2:MovieClip;
public var skin:MovieClip;
public var btop:MovieClip;
public var shoes:MovieClip;
public var hair:MovieClip;
}
}//package
Section 81
//Brb_to_Default (Brb_to_Default)
package {
import flash.display.*;
public dynamic class Brb_to_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var brb:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 82
//ConfigXP (ConfigXP)
package {
public class ConfigXP {
public static const OPTION_COLOR_SKIN:String = "palette_skin";
public static const OPTION_DROPDOWN:String = "dropdown";
public static const OPTION_COLOR_ALL:String = "palette_all";
}
}//package
Section 83
//ConfigXPBody (ConfigXPBody)
package {
import com.whirled.*;
import flash.display.*;
import com.threerings.display.*;
import flash.filters.*;
public class ConfigXPBody extends MovieClipBody {
protected var _colorConfigs:Array;
protected var _imageConfigs:Array;
protected var _curConfigData:ConfigXPData;
protected static const MEMORY_CONFIG:String = "Config";
public static const OPTION_COLOR_SKIN:String = "palette_skin";
public static const OPTION_COLOR_ALL:String = "palette_all";
protected static const MEMORY_SLOTS:String = "slots";
public static const OPTION_DROPDOWN:String = "dropdown";
public function ConfigXPBody(_arg1:AvatarControl, _arg2:MovieClip, _arg3:int, _arg4:int=-1){
_colorConfigs = new Array();
_imageConfigs = new Array();
super(_arg1, _arg2, _arg3, _arg4);
if (_ctrl.hasControl()){
_ctrl.registerCustomConfig(createConfigPanel);
};
trace("[ConfigXP] Loading, if you do not see a ConfigXP finished message, please make sure you call the completeConfig method");
}
protected function applyCurConfigFilters(_arg1:Array):void{
var _local2:String;
var _local3:Array;
var _local4:MovieClip;
var _local5:Array;
_local3 = new Array();
for (_local2 in _colorConfigs) {
_local3[_local2] = createColorFilter(_curConfigData.values[_local2]);
};
for each (_local4 in _arg1) {
for (_local2 in _colorConfigs) {
for each (_local5 in _colorConfigs[_local2]) {
applyFilter(_local4, _local5, _local3[_local2]);
};
};
};
}
public function setRecolorFrames(_arg1:String, ... _args):void{
if (ConfigXPData.options.indexOf(_arg1) == -1){
trace((("[ConfigXP] !!WARNING!! " + _arg1) + " is not a registered option :O"));
};
_colorConfigs[_arg1] = _args;
}
protected function saveConfig(_arg1:ConfigXPData):void{
var configData = _arg1;
_ctrl.setMemory(MEMORY_CONFIG, configData.toMemory(), function (_arg1:Boolean):void{
if (!_arg1){
log.warning("Failed to save Config!");
};
});
}
protected function saveSlots():void{
_ctrl.setMemory(MEMORY_SLOTS, ConfigXPData.exportSlots(), function (_arg1:Boolean):void{
if (!_arg1){
log.warning("Failed to save memory slots!");
};
});
}
public function setImageConfigFrames(_arg1:String, ... _args):void{
if (ConfigXPData.options.indexOf(_arg1) == -1){
trace((("[ConfigXP] !!WARNING!! " + _arg1) + " is not a registered option :O"));
};
_imageConfigs[_arg1] = _args;
}
protected function createConfigPanel():Sprite{
return (new ConfigXPPanel(_curConfigData, _colorConfigs, _imageConfigs, function (_arg1:ConfigXPData):void{
saveConfig(_arg1);
saveSlots();
applyConfig(_arg1);
}));
}
protected function loadConfig():void{
var _local1:ConfigXPData;
_local1 = new ConfigXPData();
_local1.fromMemory(_ctrl.getMemory(MEMORY_CONFIG));
applyConfig(_local1);
loadSlots();
}
protected function selectCurConfigFrames(_arg1:Array):void{
var _local2:MovieClip;
var _local3:String;
var _local4:Array;
for each (_local2 in _arg1) {
for (_local3 in _imageConfigs) {
for each (_local4 in _imageConfigs[_local3]) {
selectFrame(_local2, _local4, _curConfigData.values[_local3]);
};
};
};
}
protected function applyConfig(_arg1:ConfigXPData):void{
var _local2:Array;
_curConfigData = _arg1;
_local2 = getAllMovies();
selectCurConfigFrames(_local2);
applyCurConfigFilters(_local2);
}
public function completeConfig():void{
trace("[ConfigXP] Finished, options locked in.");
loadConfig();
loadSlots();
_ctrl.addEventListener(ControlEvent.MEMORY_CHANGED, function (_arg1:ControlEvent):void{
if (_arg1.name == MEMORY_CONFIG){
loadConfig();
} else {
if (_arg1.name == MEMORY_SLOTS){
loadSlots();
};
};
});
trace("[ConfigXP] Testing config panel");
createConfigPanel();
trace("[ConfigXP] Test complete");
}
override protected function playMovie(_arg1:MovieClip):void{
super.playMovie(_arg1);
if (_arg1 != null){
restartAllMovies(_arg1);
selectCurConfigFrames([_arg1]);
};
}
protected function loadSlots():void{
ConfigXPData.importSlots(_ctrl.getMemory(MEMORY_SLOTS));
}
public function registerOption(_arg1:String, _arg2:String, _arg3, _arg4=null):void{
ConfigXPData.registerOption(_arg1, _arg3);
ConfigXPPanel.registerOption(_arg1, _arg2, _arg4);
}
protected static function findChild(_arg1:MovieClip, _arg2:Array):MovieClip{
var _local3:MovieClip;
var _local4:String;
_local3 = _arg1;
for each (_local4 in _arg2) {
_local3 = _local3[_local4];
if (_local3 == null){
break;
};
};
return (_local3);
}
protected static function applyFilter(_arg1:MovieClip, _arg2:Array, _arg3:BitmapFilter):void{
var _local4:MovieClip;
_local4 = findChild(_arg1, _arg2);
if (_local4 != null){
_local4.filters = [_arg3];
};
}
protected static function selectFrame(_arg1:MovieClip, _arg2:Array, _arg3:int):void{
var _local4:MovieClip;
_local4 = findChild(_arg1, _arg2);
if (_local4 != null){
_local4.gotoAndStop(_arg3);
};
}
protected static function restartAllMovies(_arg1:DisplayObjectContainer):void{
var _local2:int;
var _local3:DisplayObject;
if ((_arg1 is MovieClip)){
(_arg1 as MovieClip).gotoAndPlay(1);
};
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if ((_local3 is DisplayObjectContainer)){
restartAllMovies((_local3 as DisplayObjectContainer));
};
_local2++;
};
}
protected static function createColorFilter(_arg1:uint):ColorMatrixFilter{
return (new ColorMatrix().colorize(_arg1).createFilter());
}
}
}//package
Section 84
//ConfigXPData (ConfigXPData)
package {
public class ConfigXPData {
public var values:Object;
public static var defaults:Array = [];
public static var saveSlots:Object = new Object();
public static var options:Array = [];
public function ConfigXPData(){
values = new Object();
super();
}
public function getToken():String{
var _local1:String;
var _local2:String;
_local1 = "[";
for each (_local2 in options) {
if (values[_local2]){
_local1 = (_local1 + (values[_local2].toString(32) + ";"));
} else {
_local1 = (_local1 + "0;");
};
};
_local1 = (_local1 + "]");
return (_local1);
}
public function loadSlot(_arg1:int):void{
values = ConfigXPData.saveSlots[_arg1];
}
public function setWithToken(_arg1:String):void{
var _local2:Array;
var _local3:int;
var _local4:String;
_arg1 = _arg1.replace("[", "");
_arg1 = _arg1.replace("]", "");
_local2 = _arg1.split(";");
_local3 = 0;
for each (_local4 in options) {
if (((!((_local2[_local3] == null))) && (!(isNaN(parseInt(_local2[_local3], 32)))))){
values[_local4] = parseInt(_local2[_local3], 32);
};
_local3++;
};
}
public function fromMemory(_arg1:Object):void{
var _local2:String;
if (_arg1 == null){
for each (_local2 in options) {
values[_local2] = defaults[_local2];
};
} else {
values = _arg1;
};
}
public function saveSlot(_arg1:int):void{
ConfigXPData.saveSlots[_arg1] = values;
}
public function toMemory():Object{
return (values);
}
public function clone():ConfigXPData{
var _local1:ConfigXPData;
_local1 = new ConfigXPData();
_local1.fromMemory(toMemory());
return (_local1);
}
public static function exportSlots():Object{
return (saveSlots);
}
public static function importSlots(_arg1:Object):void{
if (_arg1 != null){
saveSlots = _arg1;
};
}
public static function registerOption(_arg1:String, _arg2):void{
options.push(_arg1);
defaults[_arg1] = _arg2;
}
}
}//package
Section 85
//ConfigXPPanel (ConfigXPPanel)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.threerings.util.*;
import com.threerings.display.*;
import flash.filters.*;
public class ConfigXPPanel extends Sprite {
protected var _panel;
protected var _dropdowns:Array;
protected var _config:ConfigXPData;
protected var _colorConfigs:Array;
protected var _imageConfigs:Array;
protected var _suppressConfigUpdates:Boolean;
protected var _originalConfig:ConfigXPData;
protected var _colorPickers:Array;
protected var _mouseCapture:Sprite;
protected var _applyConfigCallback:Function;
protected static const log:Log = Log.getLog(ConfigXPPanel);
public static var extras:Array = [];
public static var options:Array = [];
public function ConfigXPPanel(_arg1:ConfigXPData, _arg2:Array, _arg3:Array, _arg4:Function):void{
var panelClass:Class;
var optionName:String;
var randomizeButton:SimpleButton;
var g:Graphics;
var optionType:String;
var curConfigXPData = _arg1;
var colorConfigs = _arg2;
var imageConfigs = _arg3;
var applyConfigCallback = _arg4;
_dropdowns = [];
_colorPickers = [];
super();
_originalConfig = curConfigXPData;
_config = curConfigXPData.clone();
_applyConfigCallback = applyConfigCallback;
_colorConfigs = colorConfigs;
_imageConfigs = imageConfigs;
panelClass = getClass("popup_master");
_panel = new (panelClass);
addChild(_panel);
_panel["panel_share"].visible = false;
_panel["panel_save"].visible = false;
_panel["panel_config"].visible = true;
_panel["panel_share"].shareCode.text = _config.getToken();
_panel["panel_share"].buttonLoad.addEventListener(MouseEvent.CLICK, importToken);
_panel["buttonConfig"].addEventListener(MouseEvent.CLICK, switchPanel);
_panel["buttonSave"].addEventListener(MouseEvent.CLICK, switchPanel);
_panel["buttonShare"].addEventListener(MouseEvent.CLICK, switchPanel);
setupSavePanel();
for (optionName in options) {
if (_panel["panel_config"][optionName] == null){
trace((("[ConfigXP] !!WARNING!! " + optionName) + " was not found in your Config Panel symbol :O"));
};
optionType = options[optionName];
if (optionType == ConfigXP.OPTION_DROPDOWN){
createDropdown(_panel["panel_config"][optionName], extras[optionName], optionName);
} else {
createColorPicker(optionType, _panel["panel_config"][optionName], optionName);
};
};
if (_panel["panel_config"]["thumb"] != null){
colorizeAvatar(_panel["panel_config"]["thumb"], _config.values);
};
randomizeButton = _panel["panel_config"]["button_randomize"];
randomizeButton.addEventListener(MouseEvent.CLICK, function (... _args):void{
var _local2:Dropdown;
var _local3:MyColorPicker;
_suppressConfigUpdates = true;
for each (_local2 in _dropdowns) {
_local2.selectRandomItem();
};
for each (_local3 in _colorPickers) {
_local3.selectRandomColor();
};
_suppressConfigUpdates = false;
configUpdated();
});
_mouseCapture = new Sprite();
g = _mouseCapture.graphics;
g.beginFill(0, 0);
g.drawRect(0, 0, this.width, this.height);
g.endFill();
_mouseCapture.addEventListener(MouseEvent.CLICK, function (... _args):void{
hideAllPickers();
});
}
protected function updateSelections():void{
var _local1:String;
_suppressConfigUpdates = true;
for (_local1 in _colorPickers) {
_colorPickers[_local1].selectColor(_config.values[_local1]);
};
for (_local1 in _dropdowns) {
_dropdowns[_local1].selectItemByValue(_config.values[_local1]);
};
_suppressConfigUpdates = false;
}
protected function configUpdated():void{
if (!_suppressConfigUpdates){
_applyConfigCallback(_config);
_panel["panel_share"].shareCode.text = _config.getToken();
if (_panel["panel_config"]["thumb"] != null){
colorizeAvatar(_panel["panel_config"]["thumb"], _config.values);
};
};
}
protected function createDropdown(_arg1:SimpleButton, _arg2:Array, _arg3:String):Dropdown{
var dropdown:Dropdown;
var loc:Point;
var button = _arg1;
var items = _arg2;
var configName = _arg3;
dropdown = new Dropdown(button, numberItems(items), function (_arg1:int):void{
if (_config.values[configName] != _arg1){
_config.values[configName] = _arg1;
configUpdated();
};
});
loc = DisplayUtil.transformPoint(new Point(button.x, button.y), button.parent, this);
dropdown.x = loc.x;
dropdown.y = loc.y;
dropdown.selectItemByValue(_config.values[configName]);
button.addEventListener(MouseEvent.MOUSE_DOWN, function (... _args):void{
showPicker(dropdown);
});
_dropdowns[configName] = dropdown;
return (dropdown);
}
protected function createColorPicker(_arg1:String, _arg2:MovieClip, _arg3:String):MyColorPicker{
var cp:MyColorPicker;
var loc:Point;
var type = _arg1;
var button = _arg2;
var configName = _arg3;
cp = new MyColorPicker(type, button, function (_arg1:uint):void{
if (_config.values[configName] != _arg1){
_config.values[configName] = _arg1;
configUpdated();
};
});
loc = DisplayUtil.transformPoint(new Point(button.x, button.y), button.parent, this);
cp.x = loc.x;
cp.y = loc.y;
cp.selectColor(_config.values[configName]);
button.addEventListener(MouseEvent.MOUSE_DOWN, function (... _args):void{
showPicker(cp);
});
_colorPickers[configName] = cp;
return (cp);
}
protected function switchPanel(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "buttonConfig":
_panel["panel_config"].visible = true;
_panel["panel_save"].visible = false;
_panel["panel_share"].visible = false;
break;
case "buttonSave":
_panel["panel_config"].visible = false;
_panel["panel_save"].visible = true;
_panel["panel_share"].visible = false;
break;
case "buttonShare":
_panel["panel_config"].visible = false;
_panel["panel_save"].visible = false;
_panel["panel_share"].visible = true;
break;
};
}
protected function importToken(_arg1:MouseEvent):void{
_config.setWithToken(_panel["panel_share"].loadCode.text);
updateSelections();
configUpdated();
}
protected function setupSavePanel():void{
var i:int;
var saveSlot:MovieClip;
i = 0;
while (i < 4) {
saveSlot = _panel["panel_save"][("slot" + (i + 1))];
saveSlot.buttonLoad.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
var _local2:String;
var _local3:int;
_local2 = _arg1.target.parent.name;
_local3 = int(_local2.charAt((_local2.length - 1)));
_config.loadSlot((_local3 - 1));
updateSelections();
configUpdated();
});
saveSlot.buttonSave.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
var _local2:String;
var _local3:int;
_local2 = _arg1.target.parent.name;
_local3 = int(_local2.charAt((_local2.length - 1)));
_config.saveSlot((_local3 - 1));
configUpdated();
setupSavePanelSlot(_arg1.target.parent, (_local3 - 1));
});
setupSavePanelSlot(saveSlot, i);
i = (i + 1);
};
}
protected function hideAllPickers():void{
var _local1:Dropdown;
var _local2:MyColorPicker;
for each (_local1 in _dropdowns) {
if (_local1.parent != null){
_local1.parent.removeChild(_local1);
};
};
for each (_local2 in _colorPickers) {
if (_local2.parent != null){
_local2.parent.removeChild(_local2);
};
};
if (_mouseCapture.parent != null){
_mouseCapture.parent.removeChild(_mouseCapture);
};
}
protected function setupSavePanelSlot(_arg1:MovieClip, _arg2:int):void{
if (ConfigXPData.saveSlots[_arg2] != null){
_arg1.thumb.visible = true;
_arg1.buttonLoad.visible = true;
colorizeAvatar(_arg1.thumb, ConfigXPData.saveSlots[_arg2]);
} else {
_arg1.thumb.visible = false;
_arg1.buttonLoad.visible = false;
};
}
protected function colorizeAvatar(_arg1:MovieClip, _arg2:Object):void{
var _local3:String;
var _local4:Array;
var _local5:Array;
_local5 = new Array();
for (_local3 in _colorConfigs) {
_local5[_local3] = createColorFilter(_arg2[_local3]);
for each (_local4 in _colorConfigs[_local3]) {
applyFilter(_arg1, _local4, _local5[_local3]);
};
};
for (_local3 in _imageConfigs) {
for each (_local4 in _imageConfigs[_local3]) {
selectFrame(_arg1, _local4, _arg2[_local3]);
};
};
}
protected function showPicker(_arg1:DisplayObject):void{
hideAllPickers();
_mouseCapture.addChild(_arg1);
addChild(_mouseCapture);
}
protected static function findChild(_arg1:MovieClip, _arg2:Array):MovieClip{
var _local3:MovieClip;
var _local4:String;
_local3 = _arg1;
for each (_local4 in _arg2) {
_local3 = _local3[_local4];
if (_local3 == null){
break;
};
};
return (_local3);
}
protected static function applyFilter(_arg1:MovieClip, _arg2:Array, _arg3:BitmapFilter):void{
var _local4:MovieClip;
_local4 = findChild(_arg1, _arg2);
if (_local4 != null){
_local4.filters = [_arg3];
};
}
protected static function selectFrame(_arg1:MovieClip, _arg2:Array, _arg3:int):void{
var _local4:MovieClip;
_local4 = findChild(_arg1, _arg2);
if (_local4 != null){
_local4.gotoAndStop(_arg3);
};
}
protected static function numberItems(_arg1:Array):Array{
var _local2:Array;
var _local3:int;
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1[_local3], (_local3 + 1));
_local3++;
};
return (_local2);
}
public static function registerOption(_arg1:String, _arg2:String, _arg3=null):void{
options[_arg1] = _arg2;
if (_arg3 != null){
extras[_arg1] = _arg3;
};
}
protected static function createColorFilter(_arg1:uint):ColorMatrixFilter{
return (new ColorMatrix().colorize(_arg1).createFilter());
}
}
}//package
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.threerings.util.*;
import com.threerings.display.*;
import flash.text.*;
import flash.system.*;
private const rand:Function = function (_arg1:uint, _arg2:uint):uint{
return ((_arg1 + (Math.random() * ((_arg2 - _arg1) + 1))));
};
class Dropdown extends Sprite {
protected var _button:SimpleButton;
protected var _onItemSelected:Function;
protected var _items:Array;
protected static const BORDER:Number = 6;
protected static const log:Log = Log.getLog(Dropdown);
private function Dropdown(_arg1:SimpleButton, _arg2:Array, _arg3:Function){
var _local4:Sprite;
var _local5:Class;
var _local6:Number;
var _local7:int;
var _local8:Graphics;
var _local9:String;
var _local10:*;
var _local11:SimpleButton;
super();
_button = _arg1;
_items = _arg2;
_onItemSelected = _arg3;
_local4 = new Sprite();
_local5 = getClass("dropdown_option");
_local6 = 0;
_local7 = 0;
while (_local7 < _arg2.length) {
_local9 = _arg2[_local7];
_local10 = _arg2[(_local7 + 1)];
_local11 = new (_local5);
setButtonText(_local11, _local9);
_local11.addEventListener(MouseEvent.CLICK, createItemSelectedCallback(_local7));
_local11.x = (_local11.width * 0.5);
_local11.y = ((_local11.height * 0.5) + _local6);
_local4.addChild(_local11);
_local6 = (_local6 + 15);
_local7 = (_local7 + 2);
};
_local8 = this.graphics;
_local8.beginFill(0);
_local8.drawRect(0, 0, (_local4.width + (BORDER * 2)), (_local4.height + (BORDER * 2)));
_local8.endFill();
_local4.x = ((this.width - _local4.width) * 0.5);
_local4.y = ((this.height - _local4.height) * 0.5);
addChild(_local4);
}
public function selectItemByValue(_arg1):void{
var _local2:int;
_local2 = 0;
while (_local2 < _items.length) {
if (_items[(_local2 + 1)] == _arg1){
selectItem(_local2);
};
_local2 = (_local2 + 2);
};
}
protected function selectItem(_arg1:int):void{
var _local2:String;
var _local3:*;
_local2 = _items[_arg1];
_local3 = _items[(_arg1 + 1)];
setButtonText(_button, _local2);
_onItemSelected(_local3);
}
protected function createItemSelectedCallback(_arg1:int):Function{
var idx = _arg1;
return (function (... _args):void{
selectItem(idx);
});
}
public function selectItemByName(_arg1:String):void{
var _local2:int;
_local2 = 0;
while (_local2 < _items.length) {
if (_items[_local2] == _arg1){
selectItem(_local2);
};
_local2 = (_local2 + 2);
};
}
public function selectRandomItem():void{
selectItem((2 * rand(0, ((_items.length / 2) - 1))));
}
protected static function setButtonText(_arg1:SimpleButton, _arg2:String):void{
var setText:Function;
var button = _arg1;
var text = _arg2;
setText = function (_arg1:DisplayObjectContainer):void{
var _local2:int;
var _local3:DisplayObject;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if ((_local3 is TextField)){
(_local3 as TextField).text = text;
return;
};
_local2++;
};
};
setText(button.upState);
setText(button.downState);
setText(button.overState);
setText(button.hitTestState);
}
}
class MyColorPicker extends Sprite {
protected var _type:String;
protected var _palette:MovieClip;
protected var _swatch:Shape;
protected var _onColorSelected:Function;
protected var _button:MovieClip;
protected var _swatchColor:uint;
public static const PALETTE_SKIN:int = 0;
public static const PALETTE_GENERAL:int = 1;
protected static const PALETTE_MOVIES:Array = ["palette_skin", "palette_all"];
protected static const SCALES:Array = [3, 2];
protected static const BORDER:int = 6;
protected static const SWATCH_HEIGHT:int = 20;
protected static var _bitmaps:Array = [];
private function MyColorPicker(_arg1:String, _arg2:MovieClip, _arg3:Function){
var uiSprite:Sprite;
var paletteClass:Class;
var g:Graphics;
var type = _arg1;
var button = _arg2;
var onColorSelected = _arg3;
super();
_button = button;
_type = type;
_onColorSelected = onColorSelected;
uiSprite = new Sprite();
_swatch = new Shape();
uiSprite.addChild(_swatch);
paletteClass = getClass(type);
_palette = new (paletteClass);
_palette.scaleX = (_palette.scaleY = 3);
_palette.y = SWATCH_HEIGHT;
uiSprite.addChild(_palette);
setSwatchColor(0xFFFFFF);
g = this.graphics;
g.beginFill(0);
g.drawRect(0, 0, (uiSprite.width + (BORDER * 2)), (uiSprite.height + (BORDER * 2)));
g.endFill();
uiSprite.x = ((this.width - uiSprite.width) * 0.5);
uiSprite.y = ((this.height - uiSprite.height) * 0.5);
addChild(uiSprite);
if (_bitmaps[type] == null){
_bitmaps[type] = getBitmapData(_palette);
};
_palette.addEventListener(MouseEvent.MOUSE_MOVE, function (_arg1:MouseEvent):void{
var _local2:BitmapData;
_local2 = _bitmaps[type];
if ((((((((_arg1.localX >= 0)) && ((_arg1.localX < _local2.width)))) && ((_arg1.localY >= 0)))) && ((_arg1.localY < _local2.height)))){
setSwatchColor(_local2.getPixel(_arg1.localX, _arg1.localY));
};
});
_palette.addEventListener(MouseEvent.CLICK, function (... _args):void{
selectColor(_swatchColor);
});
}
protected function setSwatchColor(_arg1:uint):void{
_swatch.graphics.beginFill(_arg1);
_swatch.graphics.drawRect(0, 0, _palette.width, SWATCH_HEIGHT);
_swatch.graphics.endFill();
_swatchColor = _arg1;
}
public function selectColor(_arg1:uint):void{
setSwatchColor(_arg1);
_button.filters = [new ColorMatrix().colorize(_arg1).createFilter()];
_onColorSelected(_arg1);
}
public function selectRandomColor():void{
var _local1:BitmapData;
_local1 = _bitmaps[_type];
selectColor(_local1.getPixel(rand(0, (_local1.width - 1)), rand(0, (_local1.height - 1))));
}
public static function randPaletteColor(_arg1:String):uint{
var _local2:BitmapData;
_local2 = _bitmaps[_arg1];
return (_local2.getPixel(rand(0, (_local2.width - 1)), rand(0, (_local2.height - 1))));
}
protected static function getBitmapData(_arg1:DisplayObject):BitmapData{
var _local2:Rectangle;
var _local3:BitmapData;
_local2 = _arg1.getBounds(_arg1);
_local3 = new BitmapData(_local2.width, _local2.height, true, 0);
_local3.draw(_arg1, new Matrix(1, 0, 0, 1, -(_local2.x), -(_local2.y)));
return (_local3);
}
}
private const getClass:Function = function (_arg1:String):Class{
return ((ApplicationDomain.currentDomain.getDefinition(_arg1) as Class));
};
private const randPick:Function = function (_arg1:Array){
return (((_arg1.length == 0)) ? undefined : _arg1[rand(0, (_arg1.length - 1))]);
};
Section 86
//Dance_to_Default (Dance_to_Default)
package {
import flash.display.*;
public dynamic class Dance_to_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rhand2:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lhand2:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var rfoot:MovieClip;
public var hair:MovieClip;
}
}//package
Section 87
//Default_to_Brb (Default_to_Brb)
package {
import flash.display.*;
public dynamic class Default_to_Brb extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var brb:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 88
//Default_to_Dance (Default_to_Dance)
package {
import flash.display.*;
public dynamic class Default_to_Dance extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 89
//Default_to_Hug (Default_to_Hug)
package {
import flash.display.*;
public dynamic class Default_to_Hug extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function Default_to_Hug(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 90
//Default_to_Relax (Default_to_Relax)
package {
import flash.display.*;
public dynamic class Default_to_Relax extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 91
//Default_to_Snuggle (Default_to_Snuggle)
package {
import flash.display.*;
public dynamic class Default_to_Snuggle extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function Default_to_Snuggle(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 92
//dropdown_option (dropdown_option)
package {
import flash.display.*;
public dynamic class dropdown_option extends SimpleButton {
}
}//package
Section 93
//Hug_to_Default (Hug_to_Default)
package {
import flash.display.*;
public dynamic class Hug_to_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function Hug_to_Default(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 94
//MovieClipBody (MovieClipBody)
package {
import com.whirled.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.threerings.util.*;
public class MovieClipBody {
protected var _mediaHeight:int;
protected var _ctrl:AvatarControl;
protected var _state:String;
protected var _movieQueue:Array;
protected var _mediaWidth:int;
protected var _movies:Map;
protected var _media:MovieClip;
protected var _mode:String;// = ""
protected var _center:DisplayObject;
protected var _playing:MovieList;
protected var _curMovie:MovieClip;
public static var log:Log = Log.getLog(MovieClipBody);
public function MovieClipBody(_arg1:AvatarControl, _arg2:MovieClip, _arg3:int, _arg4:int=-1){
var movieChildren:Array;
var movie:MovieClip;
var ii:int;
var states:Array;
var actions:Array;
var startState:String;
var ctrl = _arg1;
var media = _arg2;
var width = _arg3;
var height = _arg4;
_movies = Maps.newMapOf(String);
_mode = "";
_movieQueue = [];
super();
_ctrl = ctrl;
_ctrl.addEventListener(ControlEvent.APPEARANCE_CHANGED, appearanceChanged);
_ctrl.addEventListener(ControlEvent.ACTION_TRIGGERED, function (_arg1:ControlEvent):void{
triggerAction(_arg1.name);
});
_ctrl.addEventListener(ControlEvent.STATE_CHANGED, function (_arg1:ControlEvent):void{
switchToState(_arg1.name);
});
_ctrl.addEventListener(Event.UNLOAD, function (_arg1:Event):void{
shutdown();
});
_media = media;
_media.addEventListener(Event.ADDED_TO_STAGE, handleAddRemove);
_media.addEventListener(Event.REMOVED_FROM_STAGE, handleAddRemove);
if (_media.stage != null){
_media.addEventListener(Event.ENTER_FRAME, onEnterFrame);
};
_mediaWidth = width;
_mediaHeight = height;
movieChildren = [];
ii = 0;
while (ii < _media.numChildren) {
movie = (_media.getChildAt(ii) as MovieClip);
if (movie != null){
log.info("Found movie", "name", getMovieName(movie));
movieChildren.push(movie);
};
ii = (ii + 1);
};
states = [];
actions = [];
for each (movie in movieChildren) {
_media.removeChild(movie);
registerMovie(movie, states, actions);
};
if (actions.length > 0){
_ctrl.registerActions(actions);
};
if (states.length > 1){
_ctrl.registerStates(states);
};
startState = null;
if (_ctrl.isConnected()){
startState = _ctrl.getState();
};
if (startState == null){
startState = "default";
};
switchToState(startState);
appearanceChanged(null);
}
public function switchToState(_arg1:String):void{
var _local2:MovieList;
_local2 = getMovie(("state_" + _arg1));
if (_local2 == null){
return;
};
log.info((("I'm transitioning to '" + _arg1) + "'."));
queueTransitions(_state, _arg1);
_state = _arg1;
queueMovie(_local2);
}
protected function registerMovie(_arg1:MovieClip, _arg2:Array, _arg3:Array):void{
var _local4:String;
var _local5:Array;
var _local6:Point;
var _local7:int;
var _local8:int;
var _local9:String;
var _local10:String;
var _local11:String;
var _local12:String;
var _local13:MovieList;
var _local14:int;
var _local15:String;
_local4 = getMovieName(_arg1);
_local5 = _local4.split("_");
if (_local5.length < 2){
log.warning((("Invalid movie name [movie=" + _local4) + "]."));
return;
};
_local6 = new Point(_arg1.x, _arg1.y);
if ((((_local5.length == 3)) && ((String(_local5[1]) == "to")))){
_movies.put(_local4.toLowerCase(), new MovieList(_local4, _arg1, _local6));
return;
};
_local7 = 1;
_local8 = 1;
_local9 = String(_local5[(_local5.length - 1)]);
if (_local9.match("[0-9]+(.[0-9]+)")){
_local14 = _local9.indexOf(".");
if (_local14 != -1){
_local8 = int(_local9.substring(0, _local14));
_local7 = int(_local9.substring((_local14 + 1)));
} else {
_local8 = int(_local9);
};
_local5.pop();
};
_local11 = String(_local5[0]);
_local12 = String(_local5[1]);
if (_local11 == "action"){
_local10 = ((_local11 + "_") + _local12);
if (_arg3.indexOf(_local12) == -1){
_arg3.push(_local12);
};
} else {
if (_local11 == "state"){
if (_local5.length < 3){
_local10 = ((_local11 + "_") + _local12);
} else {
_local15 = String(_local5[2]);
if (((((((((((!((_local15 == "walking"))) && (!((_local15 == "towalking"))))) && (!((_local15 == "fromwalking"))))) && (!((_local15 == "sleeping"))))) && (!((_local15 == "tosleeping"))))) && (!((_local15 == "fromsleeping"))))){
log.warning((((("Invalid mode [movie=" + _local4) + ", mode=") + _local15) + "]."));
return;
};
_local10 = ((((_local11 + "_") + _local12) + "_") + _local15);
};
if (_arg2.indexOf(_local12) == -1){
_arg2.push(_local12);
};
} else {
log.warning((("Invalid type [movie=" + _local4) + "]."));
return;
};
};
log.info((((((("Registering movie " + _local10) + " [weight=") + _local7) + ", num=") + _local8) + "]."));
_local13 = getMovie(_local10);
if (_local13 == null){
_movies.put(_local10.toLowerCase(), new MovieList(_local10, _arg1, _local6, _local7));
} else {
_local13.addMovie(_arg1, _local6, _local7);
};
}
public function triggerAction(_arg1:String):void{
var _local2:MovieList;
_local2 = getMovie(("action_" + _arg1));
if (_local2 == null){
return;
};
log.info((("I'm triggering action '" + _arg1) + "'."));
queueTransitions(_state, _arg1);
queueMovie(_local2);
queueTransitions(_arg1, _state);
queueMovie(getMovie(("state_" + _state)));
}
protected function getAllMovies():Array{
var _local1:Array;
var _local2:MovieList;
var _local3:MovieClip;
_local1 = [];
for each (_local2 in _movies.values()) {
for each (_local3 in _local2.movies) {
_local1.push(_local3);
};
};
return (_local1);
}
public function shutdown():void{
_media.removeEventListener(Event.ADDED_TO_STAGE, handleAddRemove);
_media.removeEventListener(Event.REMOVED_FROM_STAGE, handleAddRemove);
_media.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function inTransition():Boolean{
return ((_movieQueue.length > 0));
}
protected function playMovie(_arg1:MovieClip):void{
_arg1.gotoAndPlay(1);
}
protected function queueMovie(_arg1:MovieList, _arg2:Boolean=false):void{
if (_arg1 == null){
return;
};
if ((((_playing == null)) || (_arg2))){
log.info((("Switching immediately to " + _arg1.name) + "."));
_movieQueue.length = 0;
_playing = _arg1;
_playing.update();
_movieQueue.push(_arg1);
} else {
log.info((("Queueing " + _arg1.name) + "."));
_movieQueue.push(_arg1);
};
}
protected function getMovieName(_arg1:MovieClip):String{
return (ClassUtil.getClassName(_arg1));
}
protected function queueTransitions(_arg1:String, _arg2:String):void{
var _local3:MovieList;
_local3 = getMovie(((_arg1 + "_to_") + _arg2));
if (_local3 != null){
queueMovie(_local3);
} else {
queueMovie(getMovie((_arg1 + "_to_default")));
queueMovie(getMovie(("default_to_" + _arg2)));
};
}
protected function appearanceChanged(_arg1:ControlEvent):void{
var _local2:Number;
var _local3:String;
var _local4:MovieList;
var _local5:String;
_local2 = _ctrl.getOrientation();
if (_local2 < 180){
_media.x = _mediaWidth;
_media.scaleX = -1;
} else {
_media.x = 0;
_media.scaleX = 1;
};
_local3 = "";
if (_ctrl.isMoving()){
_local3 = "walking";
} else {
if (_ctrl.isSleeping()){
_local3 = "sleeping";
};
};
if (_mode == _local3){
return;
};
_local4 = null;
if (_mode == ""){
_local4 = getMovie(((("state_" + _state) + "_to") + _local3));
} else {
if (_local3 == ""){
_local4 = getMovie(((("state_" + _state) + "_from") + _mode));
};
};
_local5 = (("state_" + _state) + ((_local3)!="") ? ("_" + _local3) : "");
if (_local4 != null){
queueMovie(_local4, true);
queueMovie(getMovie(_local5), false);
} else {
if ((((_local3 == "walking")) && ((getMovie(_local5) == null)))){
queueMovie(getMovie("state_Default_walking"), true);
} else {
queueMovie(getMovie(_local5), true);
};
};
_mode = _local3;
}
protected function getMovie(_arg1:String):MovieList{
return ((_movies.get(_arg1.toLowerCase()) as MovieList));
}
protected function onEnterFrame(_arg1:Event):void{
if ((((_media == null)) || ((_playing == null)))){
return;
};
if (((!((_curMovie == _playing.current))) || (((!((_curMovie == null))) && ((_curMovie.currentFrame == _curMovie.totalFrames)))))){
if (_movieQueue.length > 0){
_playing = (_movieQueue.shift() as MovieList);
} else {
_playing.update();
};
if (_playing.current != _curMovie){
if (_curMovie != null){
_media.removeChild(_curMovie);
_curMovie = null;
};
if (_playing.current != null){
_curMovie = _playing.current;
_curMovie.x = _playing.currentLoc.x;
_curMovie.y = _playing.currentLoc.y;
_media.addChild(_curMovie);
playMovie(_curMovie);
_center = null;
};
};
};
if ((((_center == null)) && (!((_curMovie == null))))){
_center = _curMovie.getChildByName("center");
if (_center == null){
_center = _curMovie.getChildByName("ground");
};
if (_center != null){
_ctrl.setHotSpot(_center.x, _center.y, _mediaHeight);
};
};
}
protected function handleAddRemove(_arg1:Event):void{
if (_arg1.type == Event.ADDED_TO_STAGE){
_media.addEventListener(Event.ENTER_FRAME, onEnterFrame);
onEnterFrame(_arg1);
} else {
_media.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
}
}//package
import flash.display.*;
import flash.geom.*;
import com.threerings.util.*;
class MovieList {
protected var _movies:Array;
public var name:String;
protected var _rando:Random;
protected var _locs:Array;
protected var _weights:Array;
protected var _curidx:int;
protected var _totalWeight:int;// = 0
private function MovieList(_arg1:String, _arg2:MovieClip, _arg3:Point, _arg4:int=1){
_movies = [];
_weights = [];
_locs = [];
_totalWeight = 0;
_rando = new Random();
super();
this.name = _arg1;
addMovie(_arg2, _arg3, _arg4);
}
public function get movies():Array{
return (_movies);
}
public function update():void{
var _local1:int;
var _local2:int;
_local1 = _rando.nextInt(_totalWeight);
_local2 = 0;
while (_local2 < _movies.length) {
if (_local1 < int(_weights[_local2])){
_curidx = _local2;
return;
};
_local1 = (_local1 - int(_weights[_local2]));
_local2++;
};
}
public function get currentLoc():Point{
return ((_locs[_curidx] as Point));
}
public function addMovie(_arg1:MovieClip, _arg2:Point, _arg3:int=1):void{
_movies.push(_arg1);
_locs.push(_arg2);
_weights.push(_arg3);
_totalWeight = (_totalWeight + _arg3);
}
public function get current():MovieClip{
return ((_movies[_curidx] as MovieClip));
}
}
Section 95
//palette_all (palette_all)
package {
import flash.display.*;
public dynamic class palette_all extends MovieClip {
}
}//package
Section 96
//palette_skin (palette_skin)
package {
import flash.display.*;
public dynamic class palette_skin extends MovieClip {
}
}//package
Section 97
//popup_master (popup_master)
package {
import flash.display.*;
public dynamic class popup_master extends MovieClip {
public var panel_save:MovieClip;
public var panel_share:MovieClip;
public var buttonConfig:SimpleButton;
public var buttonShare:SimpleButton;
public var buttonSave:SimpleButton;
public var panel_config:MovieClip;
}
}//package
Section 98
//Relax_to_Default (Relax_to_Default)
package {
import flash.display.*;
public dynamic class Relax_to_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 99
//Snuggle_to_Default (Snuggle_to_Default)
package {
import flash.display.*;
public dynamic class Snuggle_to_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function Snuggle_to_Default(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 100
//state_Brb (state_Brb)
package {
import flash.display.*;
public dynamic class state_Brb extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var brb:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 101
//state_Brb_fromwalking (state_Brb_fromwalking)
package {
import flash.display.*;
public dynamic class state_Brb_fromwalking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var brb:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 102
//state_Dance (state_Dance)
package {
import flash.display.*;
public dynamic class state_Dance extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rhand2:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lhand2:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var rfoot:MovieClip;
public var hair:MovieClip;
}
}//package
Section 103
//state_Default (state_Default)
package {
import flash.display.*;
public dynamic class state_Default extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 104
//state_Default_fromwalking (state_Default_fromwalking)
package {
import flash.display.*;
public dynamic class state_Default_fromwalking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 105
//state_Default_towalking (state_Default_towalking)
package {
import flash.display.*;
public dynamic class state_Default_towalking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 106
//state_Default_walking (state_Default_walking)
package {
import flash.display.*;
public dynamic class state_Default_walking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 107
//state_Hug (state_Hug)
package {
import flash.display.*;
public dynamic class state_Hug extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 108
//state_Hug_fromwalking (state_Hug_fromwalking)
package {
import flash.display.*;
public dynamic class state_Hug_fromwalking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function state_Hug_fromwalking(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 109
//state_Relax (state_Relax)
package {
import flash.display.*;
public dynamic class state_Relax extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var theface:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var skull:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 110
//state_Snuggle (state_Snuggle)
package {
import flash.display.*;
public dynamic class state_Snuggle extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
}
}//package
Section 111
//state_Snuggle_fromwalking (state_Snuggle_fromwalking)
package {
import flash.display.*;
public dynamic class state_Snuggle_fromwalking extends MovieClip {
public var chest:MovieClip;
public var rthigh:MovieClip;
public var lthigh:MovieClip;
public var bangs:MovieClip;
public var skull:MovieClip;
public var neck:MovieClip;
public var larm:MovieClip;
public var rbicep:MovieClip;
public var lshin:MovieClip;
public var pelvis:MovieClip;
public var rarm:MovieClip;
public var rshin:MovieClip;
public var lbicep:MovieClip;
public var belly:MovieClip;
public var wings:MovieClip;
public var lfoot:MovieClip;
public var lhand:MovieClip;
public var rfoot:MovieClip;
public var rhand:MovieClip;
public var hair:MovieClip;
public function state_Snuggle_fromwalking(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package