Section 1
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public function JSON(){
super();
}
public static function decode(s:String){
var decoder:JSONDecoder;
decoder = new JSONDecoder(s);
return (decoder.getValue());
}
public static function encode(o:Object):String{
var encoder:JSONEncoder;
encoder = new JSONEncoder(o);
return (encoder.getString());
}
}
}//package com.adobe.serialization.json
Section 2
//JSONDecoder (com.adobe.serialization.json.JSONDecoder)
package com.adobe.serialization.json {
public class JSONDecoder {
private var value;
private var tokenizer:JSONTokenizer;
private var token:JSONToken;
public function JSONDecoder(s:String){
super();
tokenizer = new JSONTokenizer(s);
nextToken();
value = parseValue();
}
private function nextToken():JSONToken{
return ((token = tokenizer.getNextToken()));
}
private function parseObject():Object{
var o:Object;
var key:String;
o = new Object();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (o);
};
while (true) {
if (token.type == JSONTokenType.STRING){
key = String(token.value);
nextToken();
if (token.type == JSONTokenType.COLON){
nextToken();
o[key] = parseValue();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (o);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting } or , but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting : but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting string but found " + token.value));
};
};
return (null);
}
private function parseArray():Array{
var a:Array;
a = new Array();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (a);
};
while (true) {
a.push(parseValue());
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (a);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting ] or , but found " + token.value));
};
};
return (null);
}
public function getValue(){
return (value);
}
private function parseValue():Object{
if (token == null){
tokenizer.parseError("Unexpected end of input");
};
switch (token.type){
case JSONTokenType.LEFT_BRACE:
return (parseObject());
case JSONTokenType.LEFT_BRACKET:
return (parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (token.value);
default:
tokenizer.parseError(("Unexpected " + token.value));
};
return (null);
}
}
}//package com.adobe.serialization.json
Section 3
//JSONEncoder (com.adobe.serialization.json.JSONEncoder)
package com.adobe.serialization.json {
import flash.utils.*;
public class JSONEncoder {
private var jsonString:String;
public function JSONEncoder(value){
super();
jsonString = convertToString(value);
}
private function arrayToString(a:Array):String{
var s:String;
var i:int;
s = "";
i = 0;
while (i < a.length) {
if (s.length > 0){
s = (s + ",");
};
s = (s + convertToString(a[i]));
i++;
};
return ((("[" + s) + "]"));
}
private function convertToString(value):String{
if ((value is String)){
return (escapeString((value as String)));
};
if ((value is Number)){
return ((isFinite((value as Number))) ? value.toString() : "null");
} else {
if ((value is Boolean)){
return ((value) ? "true" : "false");
} else {
if ((value is Array)){
return (arrayToString((value as Array)));
};
if ((((value is Object)) && (!((value == null))))){
return (objectToString(value));
};
};
};
return ("null");
}
private function escapeString(str:String):String{
var s:String;
var ch:String;
var len:Number;
var i:int;
var hexCode:String;
var zeroPad:String;
s = "";
len = str.length;
i = 0;
while (i < len) {
ch = str.charAt(i);
switch (ch){
case "\"":
s = (s + "\\\"");
break;
case "\\":
s = (s + "\\\\");
break;
case "\b":
s = (s + "\\b");
break;
case "\f":
s = (s + "\\f");
break;
case "\n":
s = (s + "\\n");
break;
case "\r":
s = (s + "\\r");
break;
case "\t":
s = (s + "\\t");
break;
default:
if (ch < " "){
hexCode = ch.charCodeAt(0).toString(16);
zeroPad = ((hexCode.length == 2)) ? "00" : "000";
s = (s + (("\\u" + zeroPad) + hexCode));
} else {
s = (s + ch);
};
};
i++;
};
return ((("\"" + s) + "\""));
}
private function objectToString(o:Object):String{
var s:String;
var classInfo:XML;
var value:Object;
var key:String;
var v:XML;
var o = o;
s = "";
classInfo = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if ((value is Function)){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(key) + ":") + convertToString(value)));
};
};
} else {
for each (v in classInfo..*.(((name() == "variable")) || ((name() == "accessor")))) {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(v.@name.toString()) + ":") + convertToString(o[v.@name])));
};
};
return ((("{" + s) + "}"));
}
public function getString():String{
return (jsonString);
}
}
}//package com.adobe.serialization.json
Section 4
//JSONParseError (com.adobe.serialization.json.JSONParseError)
package com.adobe.serialization.json {
public class JSONParseError extends Error {
private var _text:String;
private var _location:int;
public function JSONParseError(message:String="", location:int=0, text:String=""){
super(message);
name = "JSONParseError";
_location = location;
_text = text;
}
public function get text():String{
return (_text);
}
public function get location():int{
return (_location);
}
}
}//package com.adobe.serialization.json
Section 5
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _value:Object;
private var _type:int;
public function JSONToken(type:int=-1, value:Object=null){
super();
_type = type;
_value = value;
}
public function set value(v:Object):void{
_value = v;
}
public function get value():Object{
return (_value);
}
public function set type(value:int):void{
_type = value;
}
public function get type():int{
return (_type);
}
}
}//package com.adobe.serialization.json
Section 6
//JSONTokenizer (com.adobe.serialization.json.JSONTokenizer)
package com.adobe.serialization.json {
public class JSONTokenizer {
private var loc:int;
private var ch:String;
private var obj:Object;
private var jsonString:String;
public function JSONTokenizer(s:String){
super();
jsonString = s;
loc = 0;
nextChar();
}
private function skipComments():void{
if (ch == "/"){
nextChar();
switch (ch){
case "/":
do {
nextChar();
} while (((!((ch == "\n"))) && (!((ch == "")))));
nextChar();
break;
case "*":
nextChar();
while (true) {
if (ch == "*"){
nextChar();
if (ch == "/"){
nextChar();
break;
};
} else {
nextChar();
};
if (ch == ""){
parseError("Multi-line comment not closed");
};
};
break;
default:
parseError((("Unexpected " + ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function isDigit(ch:String):Boolean{
return ((((ch >= "0")) && ((ch <= "9"))));
}
private function readNumber():JSONToken{
var token:JSONToken;
var input:String;
var num:Number;
token = new JSONToken();
token.type = JSONTokenType.NUMBER;
input = "";
if (ch == "-"){
input = (input + "-");
nextChar();
};
if (!isDigit(ch)){
parseError("Expecting a digit");
};
if (ch == "0"){
input = (input + ch);
nextChar();
if (isDigit(ch)){
parseError("A digit cannot immediately follow 0");
};
} else {
while (isDigit(ch)) {
input = (input + ch);
nextChar();
};
};
if (ch == "."){
input = (input + ".");
nextChar();
if (!isDigit(ch)){
parseError("Expecting a digit");
};
while (isDigit(ch)) {
input = (input + ch);
nextChar();
};
};
if ((((ch == "e")) || ((ch == "E")))){
input = (input + "e");
nextChar();
if ((((ch == "+")) || ((ch == "-")))){
input = (input + ch);
nextChar();
};
if (!isDigit(ch)){
parseError("Scientific notation number needs exponent value");
};
while (isDigit(ch)) {
input = (input + ch);
nextChar();
};
};
num = Number(input);
if (((isFinite(num)) && (!(isNaN(num))))){
token.value = num;
return (token);
};
parseError((("Number " + num) + " is not valid!"));
return (null);
}
private function nextChar():String{
return ((ch = jsonString.charAt(loc++)));
}
public function getNextToken():JSONToken{
var token:JSONToken;
var _local2:String;
var _local3:String;
var _local4:String;
token = new JSONToken();
skipIgnored();
switch (ch){
case "{":
token.type = JSONTokenType.LEFT_BRACE;
token.value = "{";
nextChar();
break;
case "}":
token.type = JSONTokenType.RIGHT_BRACE;
token.value = "}";
nextChar();
break;
case "[":
token.type = JSONTokenType.LEFT_BRACKET;
token.value = "[";
nextChar();
break;
case "]":
token.type = JSONTokenType.RIGHT_BRACKET;
token.value = "]";
nextChar();
break;
case ",":
token.type = JSONTokenType.COMMA;
token.value = ",";
nextChar();
break;
case ":":
token.type = JSONTokenType.COLON;
token.value = ":";
nextChar();
break;
case "t":
_local2 = ((("t" + nextChar()) + nextChar()) + nextChar());
if (_local2 == "true"){
token.type = JSONTokenType.TRUE;
token.value = true;
nextChar();
} else {
parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + nextChar()) + nextChar()) + nextChar()) + nextChar());
if (_local3 == "false"){
token.type = JSONTokenType.FALSE;
token.value = false;
nextChar();
} else {
parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + nextChar()) + nextChar()) + nextChar());
if (_local4 == "null"){
token.type = JSONTokenType.NULL;
token.value = null;
nextChar();
} else {
parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
token = readString();
break;
default:
if (((isDigit(ch)) || ((ch == "-")))){
token = readNumber();
} else {
if (ch == ""){
return (null);
};
parseError((("Unexpected " + ch) + " encountered"));
};
};
return (token);
}
private function skipWhite():void{
while (isWhiteSpace(ch)) {
nextChar();
};
}
private function isWhiteSpace(ch:String):Boolean{
return ((((((((ch == " ")) || ((ch == "\t")))) || ((ch == "\n")))) || ((ch == "\r"))));
}
public function parseError(message:String):void{
throw (new JSONParseError(message, loc, jsonString));
}
private function skipIgnored():void{
var originalLoc:int;
do {
originalLoc = loc;
skipWhite();
skipComments();
} while (originalLoc != loc);
}
private function isHexDigit(ch:String):Boolean{
var uc:String;
uc = ch.toUpperCase();
return (((isDigit(ch)) || ((((uc >= "A")) && ((uc <= "F"))))));
}
private function readString():JSONToken{
var token:JSONToken;
var string:String;
var _local5:String;
var i:int;
token = new JSONToken();
token.type = JSONTokenType.STRING;
string = "";
nextChar();
while (((!((ch == "\""))) && (!((ch == ""))))) {
if (ch == "\\"){
nextChar();
switch (ch){
case "\"":
string = (string + "\"");
break;
case "/":
string = (string + "/");
break;
case "\\":
string = (string + "\\");
break;
case "b":
string = (string + "\b");
break;
case "f":
string = (string + "\f");
break;
case "n":
string = (string + "\n");
break;
case "r":
string = (string + "\r");
break;
case "t":
string = (string + "\t");
break;
case "u":
_local5 = "";
i = 0;
while (i < 4) {
if (!isHexDigit(nextChar())){
parseError((" Excepted a hex digit, but found: " + ch));
};
_local5 = (_local5 + ch);
i++;
};
string = (string + String.fromCharCode(parseInt(_local5, 16)));
break;
default:
string = (string + ("\\" + ch));
};
} else {
string = (string + ch);
};
nextChar();
};
if (ch == ""){
parseError("Unterminated string literal");
};
nextChar();
token.value = string;
return (token);
}
}
}//package com.adobe.serialization.json
Section 7
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const NUMBER:int = 11;
public static const FALSE:int = 8;
public static const RIGHT_BRACKET:int = 4;
public static const NULL:int = 9;
public static const TRUE:int = 7;
public static const RIGHT_BRACE:int = 2;
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACKET:int = 3;
public static const STRING:int = 10;
public static const LEFT_BRACE:int = 1;
public static const COLON:int = 6;
public function JSONTokenType(){
super();
}
}
}//package com.adobe.serialization.json
Section 8
//ARC4 (com.hurlant.crypto.prng.ARC4)
package com.hurlant.crypto.prng {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
import com.hurlant.util.*;
public class ARC4 implements IPRNG, IStreamCipher {
private const psize:uint = 0x0100;
private var S:ByteArray;
private var i:int;// = 0
private var j:int;// = 0
public function ARC4(key:ByteArray=null){
i = 0;
j = 0;
super();
S = new ByteArray();
if (key){
init(key);
};
}
public function decrypt(block:ByteArray):void{
encrypt(block);
}
public function init(key:ByteArray):void{
var i:int;
var j:int;
var t:int;
i = 0;
while (i < 0x0100) {
S[i] = i;
i++;
};
j = 0;
i = 0;
while (i < 0x0100) {
j = (((j + S[i]) + key[(i % key.length)]) & 0xFF);
t = S[i];
S[i] = S[j];
S[j] = t;
i++;
};
this.i = 0;
this.j = 0;
}
public function dispose():void{
var i:uint;
i = 0;
if (S != null){
i = 0;
while (i < S.length) {
S[i] = (Math.random() * 0x0100);
i++;
};
S.length = 0;
S = null;
};
this.i = 0;
this.j = 0;
Memory.gc();
}
public function encrypt(block:ByteArray):void{
var i:uint;
i = 0;
while (i < block.length) {
var _temp1 = i;
i = (i + 1);
var _local3 = _temp1;
block[_local3] = (block[_local3] ^ next());
};
}
public function next():uint{
var t:int;
i = ((i + 1) & 0xFF);
j = ((j + S[i]) & 0xFF);
t = S[i];
S[i] = S[j];
S[j] = t;
return (S[((t + S[i]) & 0xFF)]);
}
public function getBlockSize():uint{
return (1);
}
public function getPoolSize():uint{
return (psize);
}
public function toString():String{
return ("rc4");
}
}
}//package com.hurlant.crypto.prng
Section 9
//IPRNG (com.hurlant.crypto.prng.IPRNG)
package com.hurlant.crypto.prng {
import flash.utils.*;
public interface IPRNG {
function init(/Users/Krin/Flash/Multiplayer/giraffe;com/hurlant/crypto/prng;IPRNG.as:ByteArray):void;
function next():uint;
function dispose():void;
function getPoolSize():uint;
function toString():String;
}
}//package com.hurlant.crypto.prng
Section 10
//Random (com.hurlant.crypto.prng.Random)
package com.hurlant.crypto.prng {
import flash.utils.*;
import flash.text.*;
import com.hurlant.util.*;
import flash.system.*;
public class Random {
private var psize:int;
private var ready:Boolean;// = false
private var seeded:Boolean;// = false
private var state:IPRNG;
private var pool:ByteArray;
private var pptr:int;
public function Random(prng:Class=null){
var t:uint;
ready = false;
seeded = false;
super();
if (prng == null){
prng = ARC4;
};
state = (new (prng) as IPRNG);
psize = state.getPoolSize();
pool = new ByteArray();
pptr = 0;
while (pptr < psize) {
t = (65536 * Math.random());
var _local3 = pptr++;
pool[_local3] = (t >>> 8);
var _local4 = pptr++;
pool[_local4] = (t & 0xFF);
};
pptr = 0;
seed();
}
public function seed(x:int=0):void{
if (x == 0){
x = new Date().getTime();
};
var _local2 = pptr++;
pool[_local2] = (pool[_local2] ^ (x & 0xFF));
var _local3 = pptr++;
pool[_local3] = (pool[_local3] ^ ((x >> 8) & 0xFF));
var _local4 = pptr++;
pool[_local4] = (pool[_local4] ^ ((x >> 16) & 0xFF));
var _local5 = pptr++;
pool[_local5] = (pool[_local5] ^ ((x >> 24) & 0xFF));
pptr = (pptr % psize);
seeded = true;
}
public function toString():String{
return (("random-" + state.toString()));
}
public function dispose():void{
var i:uint;
i = 0;
while (i < pool.length) {
pool[i] = (Math.random() * 0x0100);
i++;
};
pool.length = 0;
pool = null;
state.dispose();
state = null;
psize = 0;
pptr = 0;
Memory.gc();
}
public function autoSeed():void{
var b:ByteArray;
var a:Array;
var f:Font;
b = new ByteArray();
b.writeUnsignedInt(System.totalMemory);
b.writeUTF(Capabilities.serverString);
b.writeUnsignedInt(getTimer());
b.writeUnsignedInt(new Date().getTime());
a = Font.enumerateFonts(true);
for each (f in a) {
b.writeUTF(f.fontName);
b.writeUTF(f.fontStyle);
b.writeUTF(f.fontType);
};
b.position = 0;
while (b.bytesAvailable >= 4) {
seed(b.readUnsignedInt());
};
}
public function nextByte():int{
if (!ready){
if (!seeded){
autoSeed();
};
state.init(pool);
pool.length = 0;
pptr = 0;
ready = true;
};
return (state.next());
}
public function nextBytes(buffer:ByteArray, length:int):void{
while (length--) {
buffer.writeByte(nextByte());
};
}
}
}//package com.hurlant.crypto.prng
Section 11
//AESKey (com.hurlant.crypto.symmetric.AESKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
import com.hurlant.crypto.prng.*;
public class AESKey implements ISymmetricKey {
private var state:ByteArray;
private var tmp:ByteArray;
private var Nr:uint;
private var keyLength:uint;
private var key:ByteArray;
private static const _Xtime2:Array = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 27, 25, 31, 29, 19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5, 59, 57, 63, 61, 51, 49, 55, 53, 43, 41, 47, 45, 35, 33, 39, 37, 91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69, 123, 121, 127, 125, 115, 113, 119, 117, 107, 105, 111, 109, 99, 97, 103, 101, 155, 153, 159, 157, 147, 145, 151, 149, 139, 137, 143, 141, 131, 129, 135, 133, 187, 185, 191, 189, 179, 177, 183, 181, 171, 169, 175, 173, 163, 161, 167, 165, 219, 217, 223, 221, 211, 209, 215, 213, 203, 201, 207, 205, 195, 193, 199, 197, 251, 249, 0xFF, 253, 243, 241, 247, 245, 235, 233, 239, 237, 227, 225, 231, 229];
private static const _Xtime9:Array = [0, 9, 18, 27, 36, 45, 54, 63, 72, 65, 90, 83, 108, 101, 126, 119, 144, 153, 130, 139, 180, 189, 166, 175, 216, 209, 202, 195, 252, 245, 238, 231, 59, 50, 41, 32, 31, 22, 13, 4, 115, 122, 97, 104, 87, 94, 69, 76, 171, 162, 185, 176, 143, 134, 157, 148, 227, 234, 241, 248, 199, 206, 213, 220, 118, 127, 100, 109, 82, 91, 64, 73, 62, 55, 44, 37, 26, 19, 8, 1, 230, 239, 244, 253, 194, 203, 208, 217, 174, 167, 188, 181, 138, 131, 152, 145, 77, 68, 95, 86, 105, 96, 123, 114, 5, 12, 23, 30, 33, 40, 51, 58, 221, 212, 207, 198, 249, 240, 235, 226, 149, 156, 135, 142, 177, 184, 163, 170, 236, 229, 254, 247, 200, 193, 218, 211, 164, 173, 182, 191, 128, 137, 146, 155, 124, 117, 110, 103, 88, 81, 74, 67, 52, 61, 38, 47, 16, 25, 2, 11, 215, 222, 197, 204, 243, 250, 225, 232, 159, 150, 141, 132, 187, 178, 169, 160, 71, 78, 85, 92, 99, 106, 113, 120, 15, 6, 29, 20, 43, 34, 57, 48, 154, 147, 136, 129, 190, 183, 172, 165, 210, 219, 192, 201, 246, 0xFF, 228, 237, 10, 3, 24, 17, 46, 39, 60, 53, 66, 75, 80, 89, 102, 111, 116, 125, 161, 168, 179, 186, 133, 140, 151, 158, 233, 224, 251, 242, 205, 196, 223, 214, 49, 56, 35, 42, 21, 28, 7, 14, 121, 112, 107, 98, 93, 84, 79, 70];
private static const Nb:uint = 4;
private static const _XtimeB:Array = [0, 11, 22, 29, 44, 39, 58, 49, 88, 83, 78, 69, 116, 127, 98, 105, 176, 187, 166, 173, 156, 151, 138, 129, 232, 227, 254, 245, 196, 207, 210, 217, 123, 112, 109, 102, 87, 92, 65, 74, 35, 40, 53, 62, 15, 4, 25, 18, 203, 192, 221, 214, 231, 236, 241, 250, 147, 152, 133, 142, 191, 180, 169, 162, 246, 253, 224, 235, 218, 209, 204, 199, 174, 165, 184, 179, 130, 137, 148, 159, 70, 77, 80, 91, 106, 97, 124, 119, 30, 21, 8, 3, 50, 57, 36, 47, 141, 134, 155, 144, 161, 170, 183, 188, 213, 222, 195, 200, 249, 242, 239, 228, 61, 54, 43, 32, 17, 26, 7, 12, 101, 110, 115, 120, 73, 66, 95, 84, 247, 252, 225, 234, 219, 208, 205, 198, 175, 164, 185, 178, 131, 136, 149, 158, 71, 76, 81, 90, 107, 96, 125, 118, 31, 20, 9, 2, 51, 56, 37, 46, 140, 135, 154, 145, 160, 171, 182, 189, 212, 223, 194, 201, 248, 243, 238, 229, 60, 55, 42, 33, 16, 27, 6, 13, 100, 111, 114, 121, 72, 67, 94, 85, 1, 10, 23, 28, 45, 38, 59, 48, 89, 82, 79, 68, 117, 126, 99, 104, 177, 186, 167, 172, 157, 150, 139, 128, 233, 226, 0xFF, 244, 197, 206, 211, 216, 122, 113, 108, 103, 86, 93, 64, 75, 34, 41, 52, 63, 14, 5, 24, 19, 202, 193, 220, 215, 230, 237, 240, 251, 146, 153, 132, 143, 190, 181, 168, 163];
private static const _XtimeE:Array = [0, 14, 28, 18, 56, 54, 36, 42, 112, 126, 108, 98, 72, 70, 84, 90, 224, 238, 252, 242, 216, 214, 196, 202, 144, 158, 140, 130, 168, 166, 180, 186, 219, 213, 199, 201, 227, 237, 0xFF, 241, 171, 165, 183, 185, 147, 157, 143, 129, 59, 53, 39, 41, 3, 13, 31, 17, 75, 69, 87, 89, 115, 125, 111, 97, 173, 163, 177, 191, 149, 155, 137, 135, 221, 211, 193, 207, 229, 235, 249, 247, 77, 67, 81, 95, 117, 123, 105, 103, 61, 51, 33, 47, 5, 11, 25, 23, 118, 120, 106, 100, 78, 64, 82, 92, 6, 8, 26, 20, 62, 48, 34, 44, 150, 152, 138, 132, 174, 160, 178, 188, 230, 232, 250, 244, 222, 208, 194, 204, 65, 79, 93, 83, 121, 119, 101, 107, 49, 63, 45, 35, 9, 7, 21, 27, 161, 175, 189, 179, 153, 151, 133, 139, 209, 223, 205, 195, 233, 231, 245, 251, 154, 148, 134, 136, 162, 172, 190, 176, 234, 228, 246, 248, 210, 220, 206, 192, 122, 116, 102, 104, 66, 76, 94, 80, 10, 4, 22, 24, 50, 60, 46, 32, 236, 226, 240, 254, 212, 218, 200, 198, 156, 146, 128, 142, 164, 170, 184, 182, 12, 2, 16, 30, 52, 58, 40, 38, 124, 114, 96, 110, 68, 74, 88, 86, 55, 57, 43, 37, 15, 1, 19, 29, 71, 73, 91, 85, 127, 113, 99, 109, 215, 217, 203, 197, 239, 225, 243, 253, 167, 169, 187, 181, 159, 145, 131, 141];
private static const _Xtime2Sbox:Array = [198, 248, 238, 246, 0xFF, 214, 222, 145, 96, 2, 206, 86, 231, 181, 77, 236, 143, 31, 137, 250, 239, 178, 142, 251, 65, 179, 95, 69, 35, 83, 228, 155, 117, 225, 61, 76, 108, 126, 245, 131, 104, 81, 209, 249, 226, 171, 98, 42, 8, 149, 70, 157, 48, 55, 10, 47, 14, 36, 27, 223, 205, 78, 127, 234, 18, 29, 88, 52, 54, 220, 180, 91, 164, 118, 183, 125, 82, 221, 94, 19, 166, 185, 0, 193, 64, 227, 121, 182, 212, 141, 103, 114, 148, 152, 176, 133, 187, 197, 79, 237, 134, 154, 102, 17, 138, 233, 4, 254, 160, 120, 37, 75, 162, 93, 128, 5, 63, 33, 112, 241, 99, 119, 175, 66, 32, 229, 253, 191, 129, 24, 38, 195, 190, 53, 136, 46, 147, 85, 252, 122, 200, 186, 50, 230, 192, 25, 158, 163, 68, 84, 59, 11, 140, 199, 107, 40, 167, 188, 22, 173, 219, 100, 116, 20, 146, 12, 72, 184, 159, 189, 67, 196, 57, 49, 211, 242, 213, 139, 110, 218, 1, 177, 156, 73, 216, 172, 243, 207, 202, 244, 71, 16, 111, 240, 74, 92, 56, 87, 115, 151, 203, 161, 232, 62, 150, 97, 13, 15, 224, 124, 113, 204, 144, 6, 247, 28, 194, 106, 174, 105, 23, 153, 58, 39, 217, 235, 43, 34, 210, 169, 7, 51, 45, 60, 21, 201, 135, 170, 80, 165, 3, 89, 9, 26, 101, 215, 132, 208, 130, 41, 90, 30, 123, 168, 109, 44];
private static const _Xtime3Sbox:Array = [165, 132, 153, 141, 13, 189, 177, 84, 80, 3, 169, 125, 25, 98, 230, 154, 69, 157, 64, 135, 21, 235, 201, 11, 236, 103, 253, 234, 191, 247, 150, 91, 194, 28, 174, 106, 90, 65, 2, 79, 92, 244, 52, 8, 147, 115, 83, 63, 12, 82, 101, 94, 40, 161, 15, 181, 9, 54, 155, 61, 38, 105, 205, 159, 27, 158, 116, 46, 45, 178, 238, 251, 246, 77, 97, 206, 123, 62, 113, 151, 245, 104, 0, 44, 96, 31, 200, 237, 190, 70, 217, 75, 222, 212, 232, 74, 107, 42, 229, 22, 197, 215, 85, 148, 207, 16, 6, 129, 240, 68, 186, 227, 243, 254, 192, 138, 173, 188, 72, 4, 223, 193, 117, 99, 48, 26, 14, 109, 76, 20, 53, 47, 225, 162, 204, 57, 87, 242, 130, 71, 172, 231, 43, 149, 160, 152, 209, 127, 102, 126, 171, 131, 202, 41, 211, 60, 121, 226, 29, 118, 59, 86, 78, 30, 219, 10, 108, 228, 93, 110, 239, 166, 168, 164, 55, 139, 50, 67, 89, 183, 140, 100, 210, 224, 180, 250, 7, 37, 175, 142, 233, 24, 213, 136, 111, 114, 36, 241, 199, 81, 35, 124, 156, 33, 221, 220, 134, 133, 144, 66, 196, 170, 216, 5, 1, 18, 163, 95, 249, 208, 145, 88, 39, 185, 56, 19, 179, 51, 187, 112, 137, 167, 182, 34, 146, 32, 73, 0xFF, 120, 122, 143, 248, 128, 23, 218, 49, 198, 184, 195, 176, 119, 17, 203, 252, 214, 58];
private static const _InvSbox:Array = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 0xFF, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125];
private static const _XtimeD:Array = [0, 13, 26, 23, 52, 57, 46, 35, 104, 101, 114, 127, 92, 81, 70, 75, 208, 221, 202, 199, 228, 233, 254, 243, 184, 181, 162, 175, 140, 129, 150, 155, 187, 182, 161, 172, 143, 130, 149, 152, 211, 222, 201, 196, 231, 234, 253, 240, 107, 102, 113, 124, 95, 82, 69, 72, 3, 14, 25, 20, 55, 58, 45, 32, 109, 96, 119, 122, 89, 84, 67, 78, 5, 8, 31, 18, 49, 60, 43, 38, 189, 176, 167, 170, 137, 132, 147, 158, 213, 216, 207, 194, 225, 236, 251, 246, 214, 219, 204, 193, 226, 239, 248, 245, 190, 179, 164, 169, 138, 135, 144, 157, 6, 11, 28, 17, 50, 63, 40, 37, 110, 99, 116, 121, 90, 87, 64, 77, 218, 215, 192, 205, 238, 227, 244, 249, 178, 191, 168, 165, 134, 139, 156, 145, 10, 7, 16, 29, 62, 51, 36, 41, 98, 111, 120, 117, 86, 91, 76, 65, 97, 108, 123, 118, 85, 88, 79, 66, 9, 4, 19, 30, 61, 48, 39, 42, 177, 188, 171, 166, 133, 136, 159, 146, 217, 212, 195, 206, 237, 224, 247, 250, 183, 186, 173, 160, 131, 142, 153, 148, 223, 210, 197, 200, 235, 230, 241, 252, 103, 106, 125, 112, 83, 94, 73, 68, 15, 2, 21, 24, 59, 54, 33, 44, 12, 1, 22, 27, 56, 53, 34, 47, 100, 105, 126, 115, 80, 93, 74, 71, 220, 209, 198, 203, 232, 229, 242, 0xFF, 180, 185, 174, 163, 128, 141, 154, 151];
private static const _Sbox:Array = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 0xFF, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
private static var XtimeE:ByteArray = new ByteArray();
private static var i:uint = 0;
private static var Xtime2Sbox:ByteArray = new ByteArray();
private static var Xtime3Sbox:ByteArray = new ByteArray();
private static var _Rcon:Array = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54];
private static var Sbox:ByteArray = new ByteArray();
private static var Rcon:ByteArray = new ByteArray();
private static var InvSbox:ByteArray = new ByteArray();
private static var Xtime2:ByteArray = new ByteArray();
private static var Xtime9:ByteArray = new ByteArray();
private static var XtimeB:ByteArray = new ByteArray();
private static var XtimeD:ByteArray = new ByteArray();
public function AESKey(key:ByteArray){
super();
tmp = new ByteArray();
state = new ByteArray();
keyLength = key.length;
this.key = new ByteArray();
this.key.writeBytes(key);
expandKey();
}
public function toString():String{
return (("aes" + (8 * keyLength)));
}
public function decrypt(block:ByteArray, index:uint=0):void{
var round:uint;
state.position = 0;
state.writeBytes(block, index, (Nb * 4));
addRoundKey(key, ((Nr * Nb) * 4));
invShiftRows();
round = Nr;
while (round--) {
addRoundKey(key, ((round * Nb) * 4));
if (round){
invMixSubColumns();
};
};
block.position = index;
block.writeBytes(state);
}
protected function invShiftRows():void{
var tmp:uint;
state[0] = InvSbox[state[0]];
state[4] = InvSbox[state[4]];
state[8] = InvSbox[state[8]];
state[12] = InvSbox[state[12]];
tmp = InvSbox[state[13]];
state[13] = InvSbox[state[9]];
state[9] = InvSbox[state[5]];
state[5] = InvSbox[state[1]];
state[1] = tmp;
tmp = InvSbox[state[2]];
state[2] = InvSbox[state[10]];
state[10] = tmp;
tmp = InvSbox[state[6]];
state[6] = InvSbox[state[14]];
state[14] = tmp;
tmp = InvSbox[state[3]];
state[3] = InvSbox[state[7]];
state[7] = InvSbox[state[11]];
state[11] = InvSbox[state[15]];
state[15] = tmp;
}
public function dispose():void{
var i:uint;
var r:Random;
r = new Random();
i = 0;
while (i < key.length) {
key[i] = r.nextByte();
i++;
};
Nr = r.nextByte();
i = 0;
while (i < state.length) {
state[i] = r.nextByte();
i++;
};
i = 0;
while (i < tmp.length) {
tmp[i] = r.nextByte();
i++;
};
key.length = 0;
keyLength = 0;
state.length = 0;
tmp.length = 0;
key = null;
state = null;
tmp = null;
Nr = 0;
Memory.gc();
}
protected function invMixSubColumns():void{
var i:uint;
tmp.length = 0;
tmp[0] = (((XtimeE[state[0]] ^ XtimeB[state[1]]) ^ XtimeD[state[2]]) ^ Xtime9[state[3]]);
tmp[5] = (((Xtime9[state[0]] ^ XtimeE[state[1]]) ^ XtimeB[state[2]]) ^ XtimeD[state[3]]);
tmp[10] = (((XtimeD[state[0]] ^ Xtime9[state[1]]) ^ XtimeE[state[2]]) ^ XtimeB[state[3]]);
tmp[15] = (((XtimeB[state[0]] ^ XtimeD[state[1]]) ^ Xtime9[state[2]]) ^ XtimeE[state[3]]);
tmp[4] = (((XtimeE[state[4]] ^ XtimeB[state[5]]) ^ XtimeD[state[6]]) ^ Xtime9[state[7]]);
tmp[9] = (((Xtime9[state[4]] ^ XtimeE[state[5]]) ^ XtimeB[state[6]]) ^ XtimeD[state[7]]);
tmp[14] = (((XtimeD[state[4]] ^ Xtime9[state[5]]) ^ XtimeE[state[6]]) ^ XtimeB[state[7]]);
tmp[3] = (((XtimeB[state[4]] ^ XtimeD[state[5]]) ^ Xtime9[state[6]]) ^ XtimeE[state[7]]);
tmp[8] = (((XtimeE[state[8]] ^ XtimeB[state[9]]) ^ XtimeD[state[10]]) ^ Xtime9[state[11]]);
tmp[13] = (((Xtime9[state[8]] ^ XtimeE[state[9]]) ^ XtimeB[state[10]]) ^ XtimeD[state[11]]);
tmp[2] = (((XtimeD[state[8]] ^ Xtime9[state[9]]) ^ XtimeE[state[10]]) ^ XtimeB[state[11]]);
tmp[7] = (((XtimeB[state[8]] ^ XtimeD[state[9]]) ^ Xtime9[state[10]]) ^ XtimeE[state[11]]);
tmp[12] = (((XtimeE[state[12]] ^ XtimeB[state[13]]) ^ XtimeD[state[14]]) ^ Xtime9[state[15]]);
tmp[1] = (((Xtime9[state[12]] ^ XtimeE[state[13]]) ^ XtimeB[state[14]]) ^ XtimeD[state[15]]);
tmp[6] = (((XtimeD[state[12]] ^ Xtime9[state[13]]) ^ XtimeE[state[14]]) ^ XtimeB[state[15]]);
tmp[11] = (((XtimeB[state[12]] ^ XtimeD[state[13]]) ^ Xtime9[state[14]]) ^ XtimeE[state[15]]);
i = 0;
while (i < (4 * Nb)) {
state[i] = InvSbox[tmp[i]];
i++;
};
}
private function expandKey():void{
var tmp0:uint;
var tmp1:uint;
var tmp2:uint;
var tmp3:uint;
var tmp4:uint;
var idx:uint;
var Nk:uint;
Nk = (key.length / 4);
Nr = (Nk + 6);
idx = Nk;
while (idx < (Nb * (Nr + 1))) {
tmp0 = key[((4 * idx) - 4)];
tmp1 = key[((4 * idx) - 3)];
tmp2 = key[((4 * idx) - 2)];
tmp3 = key[((4 * idx) - 1)];
if (!(idx % Nk)){
tmp4 = tmp3;
tmp3 = Sbox[tmp0];
tmp0 = (Sbox[tmp1] ^ Rcon[(idx / Nk)]);
tmp1 = Sbox[tmp2];
tmp2 = Sbox[tmp4];
} else {
if ((((Nk > 6)) && (((idx % Nk) == 4)))){
tmp0 = Sbox[tmp0];
tmp1 = Sbox[tmp1];
tmp2 = Sbox[tmp2];
tmp3 = Sbox[tmp3];
};
};
key[((4 * idx) + 0)] = (key[(((4 * idx) - (4 * Nk)) + 0)] ^ tmp0);
key[((4 * idx) + 1)] = (key[(((4 * idx) - (4 * Nk)) + 1)] ^ tmp1);
key[((4 * idx) + 2)] = (key[(((4 * idx) - (4 * Nk)) + 2)] ^ tmp2);
key[((4 * idx) + 3)] = (key[(((4 * idx) - (4 * Nk)) + 3)] ^ tmp3);
idx++;
};
}
protected function addRoundKey(key:ByteArray, offset:uint):void{
var idx:uint;
idx = 0;
while (idx < 16) {
state[idx] = (state[idx] ^ key[(idx + offset)]);
idx++;
};
}
public function encrypt(block:ByteArray, index:uint=0):void{
var round:uint;
state.position = 0;
state.writeBytes(block, index, (Nb * 4));
addRoundKey(key, 0);
round = 1;
while (round < (Nr + 1)) {
if (round < Nr){
mixSubColumns();
} else {
shiftRows();
};
addRoundKey(key, ((round * Nb) * 4));
round++;
};
block.position = index;
block.writeBytes(state);
}
protected function mixSubColumns():void{
tmp.length = 0;
tmp[0] = (((Xtime2Sbox[state[0]] ^ Xtime3Sbox[state[5]]) ^ Sbox[state[10]]) ^ Sbox[state[15]]);
tmp[1] = (((Sbox[state[0]] ^ Xtime2Sbox[state[5]]) ^ Xtime3Sbox[state[10]]) ^ Sbox[state[15]]);
tmp[2] = (((Sbox[state[0]] ^ Sbox[state[5]]) ^ Xtime2Sbox[state[10]]) ^ Xtime3Sbox[state[15]]);
tmp[3] = (((Xtime3Sbox[state[0]] ^ Sbox[state[5]]) ^ Sbox[state[10]]) ^ Xtime2Sbox[state[15]]);
tmp[4] = (((Xtime2Sbox[state[4]] ^ Xtime3Sbox[state[9]]) ^ Sbox[state[14]]) ^ Sbox[state[3]]);
tmp[5] = (((Sbox[state[4]] ^ Xtime2Sbox[state[9]]) ^ Xtime3Sbox[state[14]]) ^ Sbox[state[3]]);
tmp[6] = (((Sbox[state[4]] ^ Sbox[state[9]]) ^ Xtime2Sbox[state[14]]) ^ Xtime3Sbox[state[3]]);
tmp[7] = (((Xtime3Sbox[state[4]] ^ Sbox[state[9]]) ^ Sbox[state[14]]) ^ Xtime2Sbox[state[3]]);
tmp[8] = (((Xtime2Sbox[state[8]] ^ Xtime3Sbox[state[13]]) ^ Sbox[state[2]]) ^ Sbox[state[7]]);
tmp[9] = (((Sbox[state[8]] ^ Xtime2Sbox[state[13]]) ^ Xtime3Sbox[state[2]]) ^ Sbox[state[7]]);
tmp[10] = (((Sbox[state[8]] ^ Sbox[state[13]]) ^ Xtime2Sbox[state[2]]) ^ Xtime3Sbox[state[7]]);
tmp[11] = (((Xtime3Sbox[state[8]] ^ Sbox[state[13]]) ^ Sbox[state[2]]) ^ Xtime2Sbox[state[7]]);
tmp[12] = (((Xtime2Sbox[state[12]] ^ Xtime3Sbox[state[1]]) ^ Sbox[state[6]]) ^ Sbox[state[11]]);
tmp[13] = (((Sbox[state[12]] ^ Xtime2Sbox[state[1]]) ^ Xtime3Sbox[state[6]]) ^ Sbox[state[11]]);
tmp[14] = (((Sbox[state[12]] ^ Sbox[state[1]]) ^ Xtime2Sbox[state[6]]) ^ Xtime3Sbox[state[11]]);
tmp[15] = (((Xtime3Sbox[state[12]] ^ Sbox[state[1]]) ^ Sbox[state[6]]) ^ Xtime2Sbox[state[11]]);
state.position = 0;
state.writeBytes(tmp, 0, (Nb * 4));
}
protected function shiftRows():void{
var tmp:uint;
state[0] = Sbox[state[0]];
state[4] = Sbox[state[4]];
state[8] = Sbox[state[8]];
state[12] = Sbox[state[12]];
tmp = Sbox[state[1]];
state[1] = Sbox[state[5]];
state[5] = Sbox[state[9]];
state[9] = Sbox[state[13]];
state[13] = tmp;
tmp = Sbox[state[2]];
state[2] = Sbox[state[10]];
state[10] = tmp;
tmp = Sbox[state[6]];
state[6] = Sbox[state[14]];
state[14] = tmp;
tmp = Sbox[state[15]];
state[15] = Sbox[state[11]];
state[11] = Sbox[state[7]];
state[7] = Sbox[state[3]];
state[3] = tmp;
}
public function getBlockSize():uint{
return (16);
}
while (i < 0x0100) {
Sbox[i] = _Sbox[i];
InvSbox[i] = _InvSbox[i];
Xtime2Sbox[i] = _Xtime2Sbox[i];
Xtime3Sbox[i] = _Xtime3Sbox[i];
Xtime2[i] = _Xtime2[i];
Xtime9[i] = _Xtime9[i];
XtimeB[i] = _XtimeB[i];
XtimeD[i] = _XtimeD[i];
XtimeE[i] = _XtimeE[i];
i++;
};
i = 0;
while (i < _Rcon.length) {
Rcon[i] = _Rcon[i];
i++;
};
}
}//package com.hurlant.crypto.symmetric
Section 12
//CBCMode (com.hurlant.crypto.symmetric.CBCMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class CBCMode extends IVMode implements IMode {
public function CBCMode(key:ISymmetricKey, padding:IPad=null){
super(key, padding);
}
public function toString():String{
return ((key.toString() + "-cbc"));
}
public function decrypt(src:ByteArray):void{
var vector:ByteArray;
var tmp:ByteArray;
var i:uint;
var j:uint;
vector = getIV4d();
tmp = new ByteArray();
i = 0;
while (i < src.length) {
tmp.position = 0;
tmp.writeBytes(src, i, blockSize);
key.decrypt(src, i);
j = 0;
while (j < blockSize) {
src[(i + j)] = (src[(i + j)] ^ vector[j]);
j++;
};
vector.position = 0;
vector.writeBytes(tmp, 0, blockSize);
i = (i + blockSize);
};
padding.unpad(src);
}
public function encrypt(src:ByteArray):void{
var vector:ByteArray;
var i:uint;
var j:uint;
padding.pad(src);
vector = getIV4e();
i = 0;
while (i < src.length) {
j = 0;
while (j < blockSize) {
src[(i + j)] = (src[(i + j)] ^ vector[j]);
j++;
};
key.encrypt(src, i);
vector.position = 0;
vector.writeBytes(src, i, blockSize);
i = (i + blockSize);
};
}
}
}//package com.hurlant.crypto.symmetric
Section 13
//ICipher (com.hurlant.crypto.symmetric.ICipher)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface ICipher {
function encrypt(/Users/Krin/Flash/Multiplayer/giraffe;com/hurlant/crypto/symmetric;ICipher.as:ByteArray):void;
function dispose():void;
function getBlockSize():uint;
function toString():String;
function decrypt(/Users/Krin/Flash/Multiplayer/giraffe;com/hurlant/crypto/symmetric;ICipher.as:ByteArray):void;
}
}//package com.hurlant.crypto.symmetric
Section 14
//IMode (com.hurlant.crypto.symmetric.IMode)
package com.hurlant.crypto.symmetric {
public interface IMode extends ICipher {
}
}//package com.hurlant.crypto.symmetric
Section 15
//IPad (com.hurlant.crypto.symmetric.IPad)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface IPad {
function pad(:ByteArray):void;
function unpad(:ByteArray):void;
function setBlockSize(:uint):void;
}
}//package com.hurlant.crypto.symmetric
Section 16
//IStreamCipher (com.hurlant.crypto.symmetric.IStreamCipher)
package com.hurlant.crypto.symmetric {
public interface IStreamCipher extends ICipher {
}
}//package com.hurlant.crypto.symmetric
Section 17
//ISymmetricKey (com.hurlant.crypto.symmetric.ISymmetricKey)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public interface ISymmetricKey {
function encrypt(_arg1:ByteArray, _arg2:uint=0):void;
function dispose():void;
function getBlockSize():uint;
function toString():String;
function decrypt(_arg1:ByteArray, _arg2:uint=0):void;
}
}//package com.hurlant.crypto.symmetric
Section 18
//IVMode (com.hurlant.crypto.symmetric.IVMode)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
import com.hurlant.util.*;
import com.hurlant.crypto.prng.*;
public class IVMode {
protected var lastIV:ByteArray;
protected var iv:ByteArray;
protected var blockSize:uint;
protected var padding:IPad;
protected var prng:Random;
protected var key:ISymmetricKey;
public function IVMode(key:ISymmetricKey, padding:IPad=null){
super();
this.key = key;
blockSize = key.getBlockSize();
if (padding == null){
padding = new PKCS5(blockSize);
} else {
padding.setBlockSize(blockSize);
};
this.padding = padding;
prng = new Random();
iv = null;
lastIV = new ByteArray();
}
public function set IV(value:ByteArray):void{
iv = value;
lastIV.length = 0;
lastIV.writeBytes(iv);
}
protected function getIV4d():ByteArray{
var vec:ByteArray;
vec = new ByteArray();
if (iv){
vec.writeBytes(iv);
} else {
throw (new Error("an IV must be set before calling decrypt()"));
};
return (vec);
}
protected function getIV4e():ByteArray{
var vec:ByteArray;
vec = new ByteArray();
if (iv){
vec.writeBytes(iv);
} else {
prng.nextBytes(vec, blockSize);
};
lastIV.length = 0;
lastIV.writeBytes(vec);
return (vec);
}
public function get IV():ByteArray{
return (lastIV);
}
public function dispose():void{
var i:uint;
if (iv != null){
i = 0;
while (i < iv.length) {
iv[i] = prng.nextByte();
i++;
};
iv.length = 0;
iv = null;
};
if (lastIV != null){
i = 0;
while (i < iv.length) {
lastIV[i] = prng.nextByte();
i++;
};
lastIV.length = 0;
lastIV = null;
};
key.dispose();
key = null;
padding = null;
prng.dispose();
prng = null;
Memory.gc();
}
public function getBlockSize():uint{
return (key.getBlockSize());
}
}
}//package com.hurlant.crypto.symmetric
Section 19
//PKCS5 (com.hurlant.crypto.symmetric.PKCS5)
package com.hurlant.crypto.symmetric {
import flash.utils.*;
public class PKCS5 implements IPad {
private var blockSize:uint;
public function PKCS5(blockSize:uint=0){
super();
this.blockSize = blockSize;
}
public function unpad(a:ByteArray):void{
var c:uint;
var i:uint;
var v:uint;
c = (a.length % blockSize);
if (c != 0){
throw (new Error("PKCS#5::unpad: ByteArray.length isn't a multiple of the blockSize"));
};
c = a[(a.length - 1)];
i = c;
while (i > 0) {
v = a[(a.length - 1)];
a.length--;
if (c != v){
throw (new Error((((("PKCS#5:unpad: Invalid padding value. expected [" + c) + "], found [") + v) + "]")));
};
i--;
};
}
public function pad(a:ByteArray):void{
var c:uint;
var i:uint;
c = (blockSize - (a.length % blockSize));
i = 0;
while (i < c) {
a[a.length] = c;
i++;
};
}
public function setBlockSize(bs:uint):void{
blockSize = bs;
}
}
}//package com.hurlant.crypto.symmetric
Section 20
//Base64 (com.hurlant.util.Base64)
package com.hurlant.util {
import flash.utils.*;
public class Base64 {
public static const version:String = "1.0.0";
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public function Base64(){
super();
throw (new Error("Base64 class is static container only"));
}
public static function encode(data:String):String{
var bytes:ByteArray;
bytes = new ByteArray();
bytes.writeUTFBytes(data);
return (encodeByteArray(bytes));
}
public static function encodeByteArray(data:ByteArray):String{
var output:String;
var dataBuffer:Array;
var outputBuffer:Array;
var i:uint;
var j:uint;
var k:uint;
output = "";
outputBuffer = new Array(4);
data.position = 0;
while (data.bytesAvailable > 0) {
dataBuffer = new Array();
i = 0;
while ((((i < 3)) && ((data.bytesAvailable > 0)))) {
dataBuffer[i] = data.readUnsignedByte();
i++;
};
outputBuffer[0] = ((dataBuffer[0] & 252) >> 2);
outputBuffer[1] = (((dataBuffer[0] & 3) << 4) | (dataBuffer[1] >> 4));
outputBuffer[2] = (((dataBuffer[1] & 15) << 2) | (dataBuffer[2] >> 6));
outputBuffer[3] = (dataBuffer[2] & 63);
j = dataBuffer.length;
while (j < 3) {
outputBuffer[(j + 1)] = 64;
j++;
};
k = 0;
while (k < outputBuffer.length) {
output = (output + BASE64_CHARS.charAt(outputBuffer[k]));
k++;
};
};
return (output);
}
public static function decode(data:String):String{
var bytes:ByteArray;
bytes = decodeToByteArray(data);
return (bytes.readUTFBytes(bytes.length));
}
public static function decodeToByteArray(data:String):ByteArray{
var output:ByteArray;
var dataBuffer:Array;
var outputBuffer:Array;
var i:uint;
var j:uint;
var k:uint;
output = new ByteArray();
dataBuffer = new Array(4);
outputBuffer = new Array(3);
i = 0;
while (i < data.length) {
j = 0;
while ((((j < 4)) && (((i + j) < data.length)))) {
dataBuffer[j] = BASE64_CHARS.indexOf(data.charAt((i + j)));
j++;
};
outputBuffer[0] = ((dataBuffer[0] << 2) + ((dataBuffer[1] & 48) >> 4));
outputBuffer[1] = (((dataBuffer[1] & 15) << 4) + ((dataBuffer[2] & 60) >> 2));
outputBuffer[2] = (((dataBuffer[2] & 3) << 6) + dataBuffer[3]);
k = 0;
while (k < outputBuffer.length) {
if (dataBuffer[(k + 1)] == 64){
break;
};
output.writeByte(outputBuffer[k]);
k++;
};
i = (i + 4);
};
output.position = 0;
return (output);
}
}
}//package com.hurlant.util
Section 21
//Memory (com.hurlant.util.Memory)
package com.hurlant.util {
import flash.net.*;
import flash.system.*;
public class Memory {
public function Memory(){
super();
}
public static function gc():void{
new LocalConnection().connect("foo");
new LocalConnection().connect("foo");
//unresolved jump
var _slot1 = e;
}
public static function get used():uint{
return (System.totalMemory);
}
}
}//package com.hurlant.util
Section 22
//BasicSocket (com.jiggmin.blossomSocket.BasicSocket)
package com.jiggmin.blossomSocket {
import flash.events.*;
import flash.net.*;
public class BasicSocket extends Socket {
public function BasicSocket(){
super();
}
protected function securityErrorHandler(e:SecurityErrorEvent):void{
dataTracer.noMoreProgress();
dataTracer.update("Security Error: Couldn't get permission to connect to server.");
trace("Couldn't get permission to connect to server.");
}
public function remove():void{
removeListeners();
if (connected){
super.close();
};
}
protected function closeHandler(e:Event):void{
trace("Disconnected.");
dataTracer.DC();
remove();
}
protected function connectHandler(e:Event):void{
trace("Connected.");
dataTracer.update("Connected!");
}
private function removeListeners():void{
removeEventListener(Event.CLOSE, closeHandler);
removeEventListener(Event.CONNECT, connectHandler);
removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
removeEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
}
private function addListeners():void{
removeListeners();
addEventListener(Event.CLOSE, closeHandler, false, 0, true);
addEventListener(Event.CONNECT, connectHandler, false, 0, true);
addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler, false, 0, true);
}
protected function socketDataHandler(e:ProgressEvent):void{
}
protected function ioErrorHandler(e:IOErrorEvent):void{
dataTracer.noMoreProgress();
dataTracer.update("IO Error: Could not connect. This could be because: A: The server is broken. B: The internet is broken. C: Evil aliens.");
trace("Could not connect. This could be because: A: The server is broken. B: The internet is broken. C: Evil aliens.");
}
override public function connect(url:String, port:int):void{
trace(((("connect: " + url) + " ") + port));
dataTracer.update("Connecting to Server...");
addListeners();
super.connect(url, port);
}
protected function write(string:String):void{
var string = string;
writeUTFBytes(string);
flush();
//unresolved jump
var _slot1 = e;
dataTracer.update("Error writing to socket!");
trace(("Error writing to socket: " + _slot1));
}
}
}//package com.jiggmin.blossomSocket
Section 23
//BlossomEvent (com.jiggmin.blossomSocket.BlossomEvent)
package com.jiggmin.blossomSocket {
import flash.events.*;
public class BlossomEvent extends Event {
private var _moderator:Boolean;
private var _data;
private var _vars:Object;
private var _error:String;
private var _version:Number;
private var _time:int;
private var _socketID:int;
private var _userID:int;
private var _iv:String;
private var _userName:String;
private var _roomName:String;
private var _raw:Object;
private var _userList:Array;
private var _fromUser:BlossomUser;
private var _roomList:Array;
public static var PING:String = "ping";
public static var READY:String = "ready";
public static var RECEIVE_STATS:String = "receiveStats";
public static var RECEIVE_GLOBAL_VARS:String = "receiveGdlobalVars";
public static var REGISTER_SUCCESS:String = "registerSuccess";
public static var REGISTER_ERROR:String = "registerError";
public static var RECEIVE_ROOM_VARS:String = "receiveRoomVars";
public static var RECEIVE_ROOMS:String = "receiveRooms";
public static var USER_JOIN_ROOM:String = "userJoinRoom";
public static var RECEIVE_USER_VARS:String = "receiveUserVars";
public static var ERROR:String = "error";
public static var RECEIVE_IV:String = "receiveIV";
public static var RECEIVE_SOCKET_ID:String = "receiveSocketID";
public static var RECEIVE_USERS:String = "receiveUsers";
public static var LOGIN_SUCCESS:String = "loginSuccess";
public static var RECEIVE_MESSAGE:String = "receiveMessage";
public static var USER_LEAVE_ROOM:String = "userLeaveRoom";
public static var LOGIN_ERROR:String = "loginError";
public static var RECEIVE_VERSION:String = "receiveVersion";
public function BlossomEvent(type:String, raw:Object, fromUser:BlossomUser=null, bubbles:Boolean=false, cancelable:Boolean=false):void{
_raw = raw;
_fromUser = fromUser;
_socketID = raw.socketID;
_roomName = raw.roomName;
_data = raw.data;
_vars = raw.vars;
_error = raw.error;
_roomList = raw.roomList;
_userList = raw.userList;
_userName = raw.userName;
_userID = raw.userID;
_moderator = raw.moderator;
_iv = raw.iv;
_version = raw.version;
_time = raw.time;
super(type, bubbles, cancelable);
}
public function get moderator():Boolean{
return (_moderator);
}
public function get roomName():String{
return (_roomName);
}
public function get fromUser():BlossomUser{
return (_fromUser);
}
public function get error():String{
return (_error);
}
public function get roomList():Array{
return (_roomList);
}
public function get userID():int{
return (_userID);
}
public function get raw():Object{
return (_raw);
}
public function get userList():Array{
return (_userList);
}
public function get data(){
return (_data);
}
public function get iv():String{
return (_iv);
}
public function get vars():Object{
return (_vars);
}
public function get time():int{
return (_time);
}
public function get socketID():int{
return (_socketID);
}
public function get version():Number{
return (_version);
}
public function get userName():String{
return (_userName);
}
}
}//package com.jiggmin.blossomSocket
Section 24
//BlossomRoom (com.jiggmin.blossomSocket.BlossomRoom)
package com.jiggmin.blossomSocket {
import flash.display.*;
public class BlossomRoom extends Sprite {
private var _vars:Object;
private var _roomName:String;
private var socket:BlossomSocket;
private var _userArray:Array;
public function BlossomRoom(socket:BlossomSocket, roomName:String, pass:String=""):void{
_userArray = new Array();
super();
this.socket = socket;
_roomName = roomName;
socket.addEventListener((BlossomEvent.ERROR + _roomName), errorHandler, false, 0, true);
socket.addEventListener((BlossomEvent.RECEIVE_ROOM_VARS + _roomName), receiveRoomVarsHandler, false, 0, true);
socket.addEventListener((BlossomEvent.USER_JOIN_ROOM + _roomName), userJoinRoomHandler, false, 0, true);
socket.addEventListener((BlossomEvent.USER_LEAVE_ROOM + _roomName), userLeaveRoomHandler, false, 0, true);
socket.addEventListener((BlossomEvent.RECEIVE_MESSAGE + _roomName), receiveMessageHandler, false, 0, true);
socket.joinRoom(_roomName, pass);
}
public function get roomName():String{
return (_roomName);
}
private function receiveMessageHandler(be:BlossomEvent):void{
var raw:Object;
var socketID:int;
var user:BlossomUser;
var type:String;
raw = be.data;
socketID = be.socketID;
user = _userArray[socketID];
raw.socketID = socketID;
if ((((raw.type == null)) || ((raw.type == "")))){
type = BlossomEvent.RECEIVE_MESSAGE;
} else {
type = raw.type;
};
dispatchEvent(new BlossomEvent(type, raw, user));
}
private function userJoinRoomHandler(be:BlossomEvent):void{
var user:BlossomUser;
user = new BlossomUser(socket, be.socketID, be.userID, be.userName, be.moderator, be.vars);
_userArray[be.socketID] = user;
dispatchEvent(new BlossomEvent(BlossomEvent.USER_JOIN_ROOM, be.raw, user));
}
private function errorHandler(be:BlossomEvent):void{
var error:String;
error = be.error;
dispatchEvent(new BlossomEvent(BlossomEvent.ERROR, be.raw));
}
public function get vars():Object{
return (_vars);
}
public function leaveRoom():void{
remove();
}
public function socketIDToUser(socketID:int):BlossomUser{
var user:BlossomUser;
user = _userArray[socketID];
return (user);
}
public function get userArray():Object{
var array:Array;
var user:BlossomUser;
array = new Array();
for each (user in _userArray) {
if (user != null){
array.push(user);
};
};
return (array);
}
private function receiveRoomVarsHandler(be:BlossomEvent):void{
_vars = be.vars;
dispatchEvent(new BlossomEvent(BlossomEvent.RECEIVE_ROOM_VARS, be.raw));
}
public function deleteVars(varList):void{
socket.deleteRoomVars(varList, _roomName);
}
public function remove():void{
socket.leaveRoom(_roomName);
socket.removeEventListener((BlossomEvent.ERROR + _roomName), errorHandler);
socket.removeEventListener((BlossomEvent.RECEIVE_ROOM_VARS + _roomName), receiveRoomVarsHandler);
socket.removeEventListener((BlossomEvent.USER_JOIN_ROOM + _roomName), userJoinRoomHandler);
socket.removeEventListener((BlossomEvent.USER_LEAVE_ROOM + _roomName), userLeaveRoomHandler);
socket.removeEventListener((BlossomEvent.RECEIVE_MESSAGE + _roomName), receiveMessageHandler);
socket = null;
_userArray = null;
}
public function unlockVars():void{
socket.unlockRoomVars(_roomName);
}
public function setPass(pass:String):void{
socket.setRoomPass(_roomName, pass);
}
public function getVars(varList):void{
socket.getRoomVars(varList, _roomName);
}
public function setVars(vars:Object){
socket.setRoomVars(vars, _roomName);
}
private function userLeaveRoomHandler(be:BlossomEvent):void{
var socketID:int;
var user:BlossomUser;
socketID = be.socketID;
user = _userArray[socketID];
_userArray[socketID] = null;
if (user != null){
dispatchEvent(new BlossomEvent(BlossomEvent.USER_LEAVE_ROOM, be.raw, user));
user.remove();
};
if (socketID == socket.socketID){
remove();
};
}
public function sendToRoom(data, sendToSelf:Boolean=true, type:String=null):void{
var raw:Object;
raw = new Object();
if (type != null){
raw.type = type;
};
raw.data = data;
socket.sendToRoom(_roomName, raw, sendToSelf);
}
public function lockVars():void{
socket.lockRoomVars(_roomName);
}
}
}//package com.jiggmin.blossomSocket
Section 25
//BlossomSocket (com.jiggmin.blossomSocket.BlossomSocket)
package com.jiggmin.blossomSocket {
import flash.events.*;
import flash.utils.*;
public class BlossomSocket extends CommandSocket {
private var _socketID:int;
private var _me:BlossomUser;
private var pingInterval:uint;
private var _pingTime:int;
private var version:Number;// = 1.1
public function BlossomSocket(address:String, port:int, key:String):void{
version = 1.1;
super();
initListeners();
setKey(key);
connect(address, port);
_me = new BlossomUser(this, 0, 0, null, false, new Object());
}
override protected function connectHandler(e:Event):void{
clearInterval(pingInterval);
pingInterval = setInterval(sendPing, 30000);
super.connectHandler(e);
}
public function unlockUserVars():void{
manageVars("", "user", "unlock", "");
}
private function receiveMessageHandler(be:BlossomEvent):void{
if (be.roomName != null){
dispatchEvent(new BlossomEvent((BlossomEvent.RECEIVE_MESSAGE + be.roomName), be.raw));
};
if (be.socketID != 0){
dispatchEvent(new BlossomEvent((BlossomEvent.RECEIVE_MESSAGE + be.socketID), be.raw));
};
}
public function unlockRoomVars(roomName:String):void{
manageVars("", "room", "unlock", roomName);
}
public function getUserVars(varList, socketID:int):void{
manageVars(varList, "user", "get", socketID.toString());
}
public function setRoomPass(roomName:String, pass:String):void{
var obj:Object;
obj = new Object();
obj.type = "set_room_pass";
obj.room_name = roomName;
obj.pass = pass;
send(obj);
}
public function setUserVars(variables:Object):void{
_me.addVars(variables);
manageVars(variables, "user", "set", "");
}
public function sendPing():void{
var obj:Object;
obj = new Object();
obj.type = "ping";
obj.time = new Date().time;
send(obj);
}
private function receiveVersionHandler(be:BlossomEvent):void{
if (be.version > version){
remove();
throw (new Error("Please update your client code. The Blossom Socket code you are using is no longer compatable with the remote server."));
};
}
public function getRoomVars(varList, roomName:String):void{
manageVars(varList, "room", "get", roomName);
}
private function initListeners():void{
addEventListener(BlossomEvent.RECEIVE_SOCKET_ID, receiveSocketIDHandler, false, 0, true);
addEventListener(BlossomEvent.RECEIVE_MESSAGE, receiveMessageHandler, false, 0, true);
addEventListener(BlossomEvent.RECEIVE_USER_VARS, receiveUserVarsHandler, false, 0, true);
addEventListener(BlossomEvent.RECEIVE_ROOM_VARS, receiveRoomVarsHandler, false, 0, true);
addEventListener(BlossomEvent.RECEIVE_VERSION, receiveVersionHandler, false, 0, true);
addEventListener(BlossomEvent.RECEIVE_USERS, receiveUsersHandler, false, 0, true);
addEventListener(BlossomEvent.USER_JOIN_ROOM, userJoinRoomHandler, false, 0, true);
addEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeaveRoomHandler, false, 0, true);
addEventListener(BlossomEvent.LOGIN_SUCCESS, loginSuccessHandler, false, 0, true);
addEventListener(BlossomEvent.PING, receivePing, false, 0, true);
}
private function userJoinRoomHandler(be:BlossomEvent):void{
dispatchEvent(new BlossomEvent((BlossomEvent.USER_JOIN_ROOM + be.roomName), be.raw));
}
private function errorHandler(be:BlossomEvent):void{
trace(("Error: " + be.error));
if (be.roomName != null){
dispatchEvent(new BlossomEvent((BlossomEvent.ERROR + be.roomName), be.raw));
};
}
public function joinRoom(roomName:String, pass:String=""):void{
var obj:Object;
obj = new Object();
obj.type = "join_room";
obj.room_name = roomName;
obj.pass = pass;
send(obj);
}
public function setRoomVars(variables:Object, roomName:String):void{
manageVars(variables, "room", "set", roomName);
}
override protected function closeHandler(e:Event):void{
clearInterval(pingInterval);
super.closeHandler(e);
}
public function leaveRoom(roomName:String):void{
var obj:Object;
obj = new Object();
obj.type = "leave_room";
obj.room_name = roomName;
send(obj);
}
public function getRooms():void{
var obj:Object;
obj = new Object();
obj.type = "get_rooms";
send(obj);
}
private function receiveRoomVarsHandler(be:BlossomEvent):void{
dispatchEvent(new BlossomEvent((BlossomEvent.RECEIVE_ROOM_VARS + be.roomName), be.raw));
}
private function manageVars(variables, location:String, action:String, id:String):void{
var obj:Object;
obj = new Object();
obj.type = "manage_vars";
obj.user_vars = variables;
obj.location = location;
obj.action = action;
obj.id = id;
send(obj);
}
public function get pingTime():int{
return (_pingTime);
}
public function getGlobalVars(varList):void{
manageVars(varList, "global", "get", "");
}
public function login(userName:String, pass:String):void{
var obj:Object;
obj = new Object();
obj.type = "login";
obj.name = userName;
obj.pass = pass;
send(obj);
}
public function setGlobalVars(variables:Object):void{
manageVars(variables, "global", "set", "");
}
public function deleteRoomVars(varList, roomName:String):void{
manageVars(varList, "room", "delete", roomName);
}
public function deleteUserVars(varList):void{
manageVars(varList, "user", "delete", "");
}
private function receiveUserVarsHandler(be:BlossomEvent):void{
dispatchEvent(new BlossomEvent((BlossomEvent.RECEIVE_USER_VARS + be.socketID), be.raw));
}
private function receiveSocketIDHandler(be:BlossomEvent):void{
var blossomEvent:BlossomEvent;
_me = new BlossomUser(this, be.socketID, 0, null, false, new Object());
this._socketID = be.socketID;
blossomEvent = new BlossomEvent(BlossomEvent.READY, be.raw);
dispatchEvent(blossomEvent);
}
override public function remove():void{
removeEventListener(BlossomEvent.RECEIVE_SOCKET_ID, receiveSocketIDHandler);
removeEventListener(BlossomEvent.RECEIVE_MESSAGE, receiveMessageHandler);
removeEventListener(BlossomEvent.RECEIVE_USER_VARS, receiveUserVarsHandler);
removeEventListener(BlossomEvent.RECEIVE_ROOM_VARS, receiveRoomVarsHandler);
removeEventListener(BlossomEvent.RECEIVE_VERSION, receiveVersionHandler);
removeEventListener(BlossomEvent.RECEIVE_USERS, receiveUsersHandler);
removeEventListener(BlossomEvent.USER_JOIN_ROOM, userJoinRoomHandler);
removeEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeaveRoomHandler);
removeEventListener(BlossomEvent.PING, receivePing);
removeEventListener(BlossomEvent.LOGIN_SUCCESS, loginSuccessHandler);
if (_me != null){
_me.remove();
_me = null;
};
clearInterval(pingInterval);
super.remove();
}
public function deleteGlobalVars(varList):void{
manageVars(varList, "global", "delete", "");
}
public function register(userName:String, pass:String, email:String=""):void{
var obj:Object;
obj = new Object();
obj.type = "register";
obj.name = userName;
obj.pass = pass;
obj.email = email;
send(obj);
}
public function sendToUser(socketID:int, data):void{
var obj:Object;
obj = new Object();
obj.type = "send_to_user";
obj.to_id = socketID;
obj.data = data;
send(obj);
}
public function get me():BlossomUser{
return (_me);
}
private function receiveUsersHandler(be:BlossomEvent):void{
var users:Array;
var i:int;
var len:int;
var userObj:Object;
var userRaw:Object;
users = be.userList;
len = users.length;
i = 0;
while (i < len) {
userObj = users[i];
userRaw = new Object();
userRaw.type = BlossomEvent.USER_JOIN_ROOM;
userRaw.socketID = userObj.socketID;
userRaw.userID = userObj.userID;
userRaw.moderator = userObj.moderator;
userRaw.userName = userObj.userName;
userRaw.vars = userObj.vars;
userRaw.roomName = be.roomName;
dispatchEvent(new BlossomEvent(BlossomEvent.USER_JOIN_ROOM, userRaw));
i++;
};
}
public function sendToRoom(roomName:String, data, sendToSelf:Boolean=false):void{
var obj:Object;
obj = new Object();
obj.type = "send_to_room";
obj.room_name = roomName;
obj.send_to_self = sendToSelf;
obj.data = data;
send(obj);
}
public function get socketID():int{
return (_socketID);
}
private function userLeaveRoomHandler(be:BlossomEvent):void{
dispatchEvent(new BlossomEvent((BlossomEvent.USER_LEAVE_ROOM + be.roomName), be.raw));
}
public function unlockGlobalVars():void{
manageVars("", "global", "unlock", "");
}
public function lockUserVars():void{
manageVars("", "user", "lock", "");
}
public function getStats():void{
var obj:Object;
obj = new Object();
obj.type = "get_stats";
send(obj);
}
private function loginSuccessHandler(be:BlossomEvent):void{
_me = new BlossomUser(this, socketID, be.userID, be.userName, be.moderator, be.vars);
}
private function receivePing(be:BlossomEvent):void{
_pingTime = (new Date().time - be.time);
}
public function lockRoomVars(roomName:String):void{
manageVars("", "room", "lock", roomName);
}
public function lockGlobalVars():void{
manageVars("", "global", "lock", "");
}
}
}//package com.jiggmin.blossomSocket
Section 26
//BlossomUser (com.jiggmin.blossomSocket.BlossomUser)
package com.jiggmin.blossomSocket {
import flash.display.*;
public class BlossomUser extends Sprite {
private var _vars:Object;
private var id:String;
private var _socketID:int;
private var _userID:int;
private var _userName:String;
private var socket:BlossomSocket;
private var _moderator:Boolean;
public function BlossomUser(socket:BlossomSocket, socketID:int, userID:int=0, userName:String=null, moderator:Boolean=false, vars:Object=null):void{
super();
this.socket = socket;
_socketID = socketID;
_userID = userID;
_userName = userName;
_moderator = moderator;
_vars = vars;
id = socketID.toString();
socket.addEventListener((BlossomEvent.RECEIVE_USER_VARS + id), receiveUserVarsHandler, false, 0, true);
socket.addEventListener((BlossomEvent.RECEIVE_MESSAGE + id), receiveMessageHandler, false, 0, true);
}
public function set userName(userName:String):void{
}
public function get moderator():Boolean{
return (_moderator);
}
private function receiveMessageHandler(be:BlossomEvent):void{
var raw:Object;
raw = be.data;
dispatchEvent(new BlossomEvent(BlossomEvent.RECEIVE_MESSAGE, raw));
}
public function set moderator(moderator:Boolean):void{
_moderator = moderator;
}
public function get userID():int{
return (_userID);
}
public function get vars():Object{
return (_vars);
}
public function set userID(userID:int):void{
_userID = userID;
}
private function receiveUserVarsHandler(be:BlossomEvent):void{
addVars(be.vars);
dispatchEvent(new BlossomEvent(BlossomEvent.RECEIVE_USER_VARS, be.vars));
}
public function set vars(vars:Object):void{
_vars = vars;
}
function addVars(vars:Object):void{
var variable:String;
for (variable in vars) {
_vars[variable] = vars[variable];
};
}
public function remove():void{
socket.removeEventListener((BlossomEvent.RECEIVE_USER_VARS + id), receiveUserVarsHandler);
socket.removeEventListener((BlossomEvent.RECEIVE_MESSAGE + id), receiveMessageHandler);
socket = null;
id = null;
_userName = null;
_vars = null;
}
public function send(data):void{
socket.sendToUser(socketID, data);
}
public function getVars(varList):void{
socket.getUserVars(socketID, varList);
}
public function set socketID(socketID:int):void{
_socketID = socketID;
}
public function get socketID():int{
return (_socketID);
}
public function get userName():String{
return (_userName);
}
}
}//package com.jiggmin.blossomSocket
Section 27
//CommandSocket (com.jiggmin.blossomSocket.CommandSocket)
package com.jiggmin.blossomSocket {
import flash.events.*;
import com.adobe.serialization.json.*;
public class CommandSocket extends BasicSocket {
private var encryptor:Encryptor;
private var readNum:int;// = 0
public var traceTraffic:Boolean;// = false
private var writeNum:int;// = 0
private var encrypt:Boolean;// = false
private var readBuffer:String;// = ""
private var EOL:String;
private var sendBuffer:Array;
public function CommandSocket():void{
sendBuffer = new Array();
encrypt = false;
readNum = 0;
writeNum = 0;
readBuffer = "";
EOL = String.fromCharCode(4);
traceTraffic = false;
super();
encryptor = new Encryptor();
addEventListener(BlossomEvent.RECEIVE_IV, receiveIVHandler, false, 0, true);
addEventListener(BlossomEvent.READY, readyHandler, false, 0, true);
}
private function readyHandler(be:BlossomEvent):void{
var obj:Object;
for each (obj in sendBuffer) {
send(obj);
};
sendBuffer = new Array();
}
override public function remove():void{
removeEventListener(BlossomEvent.RECEIVE_IV, receiveIVHandler);
removeEventListener(BlossomEvent.READY, readyHandler);
if (encryptor != null){
encryptor.remove();
encryptor = null;
};
super.remove();
}
protected function send(obj:Object):void{
var strObj:String;
var sendStr:String;
if (connected){
writeNum++;
obj.write_num = writeNum;
strObj = JSON.encode(obj);
if (encrypt){
sendStr = encryptor.encrypt(strObj);
} else {
sendStr = strObj;
};
sendStr = (sendStr + EOL);
write(sendStr);
if (traceTraffic){
trace(("write: " + strObj));
dataTracer.update(("write: " + strObj));
};
} else {
sendBuffer.push(obj);
};
}
public function setKey(stringKey:String):void{
encryptor.setKey(stringKey);
}
protected function handleMessage(obj:Object):void{
var type:String;
var blossomEvent:BlossomEvent;
if ((((obj.type == null)) || ((obj.type == "")))){
type = BlossomEvent.RECEIVE_MESSAGE;
} else {
type = obj.type;
};
blossomEvent = new BlossomEvent(type, obj, null);
dispatchEvent(blossomEvent);
}
override protected function socketDataHandler(e:ProgressEvent):void{
readBytesAvailable();
super.socketDataHandler(e);
}
private function receiveIVHandler(be:BlossomEvent):void{
var iv:String;
var obj:Object;
if (encrypt == true){
obj = new Object();
obj.type = "confirm_iv";
send(obj);
};
iv = be.iv;
encryptor.setIV(iv);
encrypt = true;
}
protected function readBytesAvailable():void{
var str:String;
var index:int;
var command:String;
str = readUTFBytes(bytesAvailable);
if (str != null){
readBuffer = (readBuffer + str);
while (true) {
index = readBuffer.indexOf(EOL);
if (index == -1){
break;
};
command = readBuffer.substring(0, index);
readBuffer = readBuffer.substr((index + 1));
receiveCommand(command);
};
};
}
protected function receiveCommand(command:String):void{
var spaceIndex:int;
var remoteSendNum:int;
var stringVars:String;
var obj:Object;
readNum++;
spaceIndex = command.indexOf(" ");
remoteSendNum = int(command.substr(0, spaceIndex));
command = command.substr((spaceIndex + 1));
if (remoteSendNum != readNum){
throw (new Error(((("readCount does not match messageNum. readNum: " + readNum) + ", remoteSendNum: ") + remoteSendNum)));
};
if (encrypt){
stringVars = encryptor.decrypt(command);
} else {
stringVars = command;
};
if (traceTraffic){
dataTracer.update(("received: " + stringVars));
trace(("received: " + stringVars));
};
obj = JSON.decode(stringVars);
handleMessage(obj);
}
}
}//package com.jiggmin.blossomSocket
Section 28
//Encryptor (com.jiggmin.blossomSocket.Encryptor)
package com.jiggmin.blossomSocket {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
import com.hurlant.util.*;
public class Encryptor {
private var mode:CBCMode;
public function Encryptor(){
super();
}
public function remove():void{
mode = null;
}
public function encrypt(string:String):String{
var binary:ByteArray;
var encrypted:String;
binary = new ByteArray();
binary.writeUTFBytes(string);
mode.encrypt(binary);
encrypted = binaryToString(binary);
return (encrypted);
}
public function decrypt(string:String):String{
var binary:ByteArray;
var decrypted:String;
binary = stringToBinary(string);
mode.decrypt(binary);
binary.position = 0;
decrypted = binary.readUTFBytes(binary.bytesAvailable);
return (decrypted);
}
public function setIV(stringIV:String):void{
var binaryIV:ByteArray;
binaryIV = stringToBinary(stringIV);
IVMode(mode).IV = binaryIV;
}
private function stringToBinary(string:String):ByteArray{
var binary:ByteArray;
binary = Base64.decodeToByteArray(string);
return (binary);
}
private function binaryToString(binary:ByteArray):String{
var string:String;
string = Base64.encodeByteArray(binary);
return (string);
}
public function setKey(stringKey:String):void{
var binaryKey:ByteArray;
var padding:ZeroPad;
var key:AESKey;
binaryKey = stringToBinary(stringKey);
padding = new ZeroPad();
key = new AESKey(binaryKey);
mode = new CBCMode(key, padding);
}
}
}//package com.jiggmin.blossomSocket
Section 29
//ZeroPad (com.jiggmin.blossomSocket.ZeroPad)
package com.jiggmin.blossomSocket {
import flash.utils.*;
import com.hurlant.crypto.symmetric.*;
public class ZeroPad implements IPad {
private var blockSize:uint;
private var char:String;
public function ZeroPad(blockSize:uint=0){
char = String.fromCharCode(0);
super();
this.blockSize = blockSize;
}
public function unpad(a:ByteArray):void{
var string:String;
a.position = 0;
string = a.readUTFBytes(a.bytesAvailable);
string.split(char).join("");
a.writeUTFBytes(string);
}
public function pad(a:ByteArray):void{
while ((a.length % blockSize) != 0) {
a.writeUTFBytes(char);
};
}
public function setBlockSize(bs:uint):void{
blockSize = bs;
}
}
}//package com.jiggmin.blossomSocket
Section 30
//Data (com.jiggmin.data.Data)
package com.jiggmin.data {
import flash.display.*;
import flash.utils.*;
public class Data {
private static var stage:Stage;
public function Data(){
super();
}
public static function formatNumber(num:Number):String{
var a:*;
a = [];
while (num > 0) {
a.push((num % 1000));
num = Math.floor((num / 1000));
};
return (a.reverse().join(","));
}
public static function filterSwearing(str:String):String{
var fuckArray:Array;
var niggerArray:Array;
fuckArray = new Array("****");
niggerArray = new Array("cool cat", "ladies magnet");
if (str != null){
str = str.replace(/fuck/gi, Data.randIndex(fuckArray));
str = str.replace(/nigg(a|er)/gi, Data.randIndex(niggerArray));
};
return (str);
}
public static function stringToObject(string:String){
var ClassReference:Class;
var ret:*;
ClassReference = (getDefinitionByName(string) as Class);
ret = new (ClassReference);
return (ret);
}
public static function getMS():int{
var date:Date;
var ms:int;
date = new Date();
ms = date.time;
return (ms);
}
public static function randIndex(array:Array){
var val:*;
val = array[Math.floor((Math.random() * array.length))];
return (val);
}
}
}//package com.jiggmin.data
Section 31
//SocketManager (com.jiggmin.SocketManager)
package com.jiggmin {
import flash.events.*;
import com.jiggmin.blossomSocket.*;
public class SocketManager {
public static var errorMessage:String = "";
protected static var disp:EventDispatcher;
public static var _socket:BlossomSocket;
public static var SOCKET_ERROR:String = "socketError";
public function SocketManager(){
super();
}
public static function dispatchEvent(p_event:Event):void{
if (disp == null){
return;
};
disp.dispatchEvent(p_event);
}
private static function socketCloseHandler(e:Event):void{
close();
errorMessage = "Your connection to the server was lost.";
dispatchEvent(new Event(SocketManager.SOCKET_ERROR));
}
public static function connect(a:String="colony1.armorgames.com"):BlossomSocket{
close();
_socket = new BlossomSocket(a, 1276, "JGtkSTBCK0tnLVhhdCF2Xw==");
_socket.addEventListener(Event.CLOSE, socketCloseHandler, false, 0, true);
_socket.addEventListener(BlossomEvent.ERROR, socketErrorHandler, false, 0, true);
return (_socket);
}
public static function addEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean=false, p_priority:int=0, p_useWeakReference:Boolean=false):void{
if (disp == null){
disp = new EventDispatcher();
};
disp.addEventListener(p_type, p_listener, p_useCapture, p_priority, p_useWeakReference);
}
public static function removeEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean=false):void{
if (disp == null){
return;
};
disp.removeEventListener(p_type, p_listener, p_useCapture);
}
public static function get socket():BlossomSocket{
return (_socket);
}
private static function socketErrorHandler(be:BlossomEvent):void{
close();
errorMessage = be.error;
dispatchEvent(new Event(SocketManager.SOCKET_ERROR));
}
public static function close():void{
if (socket != null){
_socket.removeEventListener(Event.CLOSE, socketCloseHandler);
_socket.removeEventListener(BlossomEvent.ERROR, socketErrorHandler);
trace("close socket");
_socket.remove();
_socket = null;
};
}
}
}//package com.jiggmin
Section 32
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.events.*;
import flash.geom.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 33
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import fl.controls.*;
import flash.events.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 34
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 35
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 36
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 37
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 38
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 39
//CheckBox (fl.controls.CheckBox)
package fl.controls {
import flash.display.*;
public class CheckBox extends LabelButton {
private static var defaultStyles:Object = {icon:null, upIcon:"CheckBox_upIcon", downIcon:"CheckBox_downIcon", overIcon:"CheckBox_overIcon", disabledIcon:"CheckBox_disabledIcon", selectedDisabledIcon:"CheckBox_selectedDisabledIcon", focusRectSkin:null, focusRectPadding:null, selectedUpIcon:"CheckBox_selectedUpIcon", selectedDownIcon:"CheckBox_selectedDownIcon", selectedOverIcon:"CheckBox_selectedOverIcon", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 << 1));
uiFocusRect.height = (background.height + (_local2 << 1));
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a CheckBox's toggle."));
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (CheckBox.createAccessibilityImplementation != null){
CheckBox.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 40
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
import flash.geom.*;
public class ComboBox extends UIComponent implements IFocusManagerComponent {
protected var _dropdownWidth:Number;
protected var highlightedCell:int;// = -1
protected var _prompt:String;
protected var isOpen:Boolean;// = false
protected var list:List;
protected var _rowCount:uint;// = 5
protected var currentIndex:int;
protected var isKeyDown:Boolean;// = false
protected var _labels:Array;
protected var background:BaseButton;
protected var inputField:TextInput;
protected var listOverIndex:uint;
protected var editableValue:String;
protected var _editable:Boolean;// = false
private var collectionItemImport:SimpleCollectionItem;
protected static const BACKGROUND_STYLES:Object = {overSkin:"overSkin", downSkin:"downSkin", upSkin:"upSkin", disabledSkin:"disabledSkin", repeatInterval:"repeatInterval"};
protected static const LIST_STYLES:Object = {upSkin:"comboListUpSkin", overSkin:"comboListOverSkin", downSkin:"comobListDownSkin", disabledSkin:"comboListDisabledSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval", textFormat:"textFormat", disabledAlpha:"disabledAlpha", skin:"listSkin"};
private static var defaultStyles:Object = {upSkin:"ComboBox_upSkin", downSkin:"ComboBox_downSkin", overSkin:"ComboBox_overSkin", disabledSkin:"ComboBox_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, buttonWidth:24, disabledAlpha:null, listSkin:null};
public static var createAccessibilityImplementation:Function;
public function ComboBox(){
_rowCount = 5;
_editable = false;
isOpen = false;
highlightedCell = -1;
isKeyDown = false;
super();
}
protected function drawList():void{
list.rowCount = Math.max(0, Math.min(_rowCount, list.dataProvider.length));
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function get dropdown():List{
return (list);
}
public function get dropdownWidth():Number{
return (list.width);
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (list.sortItemsOn(_arg1, _arg2));
}
protected function onEnter(_arg1:ComponentEvent):void{
_arg1.stopPropagation();
}
public function removeItemAt(_arg1:uint):void{
list.removeItemAt(_arg1);
invalidate(InvalidationType.DATA);
}
public function open():void{
currentIndex = selectedIndex;
if (((isOpen) || ((length == 0)))){
return;
};
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
public function get selectedItem():Object{
return (list.selectedItem);
}
public function set text(_arg1:String):void{
if (!editable){
return;
};
inputField.text = _arg1;
}
public function get labelField():String{
return (list.labelField);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:uint;
var _local4:Number;
var _local5:int;
isKeyDown = true;
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.UP:
if (highlightedCell > -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
break;
case Keyboard.DOWN:
open();
break;
};
return;
};
_arg1.stopPropagation();
_local2 = Math.max(((calculateAvailableHeight() / list.rowHeight) << 0), 1);
_local3 = selectedIndex;
_local4 = ((highlightedCell)==-1) ? selectedIndex : highlightedCell;
_local5 = -1;
switch (_arg1.keyCode){
case Keyboard.SPACE:
if (isOpen){
close();
} else {
open();
};
return;
case Keyboard.ESCAPE:
if (isOpen){
if (highlightedCell > -1){
selectedIndex = selectedIndex;
};
close();
};
return;
case Keyboard.UP:
_local5 = Math.max(0, (_local4 - 1));
break;
case Keyboard.DOWN:
_local5 = Math.min((length - 1), (_local4 + 1));
break;
case Keyboard.PAGE_UP:
_local5 = Math.max((_local4 - _local2), 0);
break;
case Keyboard.PAGE_DOWN:
_local5 = Math.min((_local4 + _local2), (length - 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.ENTER:
if (((_editable) && ((highlightedCell == -1)))){
editableValue = inputField.text;
selectedIndex = -1;
} else {
if (((isOpen) && ((highlightedCell > -1)))){
editableValue = null;
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
};
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER));
close();
return;
default:
if (editable){
break;
};
_local5 = list.getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), _local4);
break;
};
if (_local5 > -1){
if (isOpen){
highlightCell(_local5);
inputField.text = list.itemToLabel(getItemAt(_local5));
} else {
highlightCell();
selectedIndex = _local5;
dispatchEvent(new Event(Event.CHANGE));
};
};
}
public function set dropdownWidth(_arg1:Number):void{
_dropdownWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
if (editable){
stage.focus = inputField.textField;
};
}
protected function onStageClick(_arg1:MouseEvent):void{
if (!isOpen){
return;
};
if (((!(contains((_arg1.target as DisplayObject)))) && (!(list.contains((_arg1.target as DisplayObject)))))){
if (highlightedCell != -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
invalidate(InvalidationType.DATA);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
isKeyDown = false;
}
protected function onListItemUp(_arg1:MouseEvent):void{
var _local2:*;
stage.removeEventListener(MouseEvent.MOUSE_UP, onListItemUp);
if (((!((_arg1.target is ICellRenderer))) || (!(list.contains((_arg1.target as DisplayObject)))))){
return;
};
editableValue = null;
_local2 = selectedIndex;
selectedIndex = _arg1.target.listData.index;
if (_local2 != selectedIndex){
dispatchEvent(new Event(Event.CHANGE));
};
close();
}
public function removeAll():void{
list.removeAll();
inputField.text = "";
invalidate(InvalidationType.DATA);
}
public function set selectedItem(_arg1:Object):void{
list.selectedItem = _arg1;
invalidate(InvalidationType.SELECTED);
}
protected function highlightCell(_arg1:int=-1):void{
var _local2:ICellRenderer;
if (highlightedCell > -1){
_local2 = list.itemToCellRenderer(getItemAt(highlightedCell));
if (_local2 != null){
_local2.setMouseState("up");
};
};
if (_arg1 == -1){
return;
};
list.scrollToIndex(_arg1);
list.drawNow();
_local2 = list.itemToCellRenderer(getItemAt(_arg1));
if (_local2 != null){
_local2.setMouseState("over");
highlightedCell = _arg1;
};
}
public function itemToLabel(_arg1:Object):String{
if (_arg1 == null){
return ("");
};
return (list.itemToLabel(_arg1));
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
list.addItemAt(_arg1, _arg2);
invalidate(InvalidationType.DATA);
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (list.replaceItemAt(_arg1, _arg2));
}
protected function showPrompt():void{
inputField.text = _prompt;
}
public function set rowCount(_arg1:uint):void{
_rowCount = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get restrict():String{
return (inputField.restrict);
}
protected function setEmbedFonts():void{
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
inputField.textField.embedFonts = _local1;
};
}
public function sortItems(... _args){
return (list.sortItems.apply(list, _args));
}
public function set labelField(_arg1:String):void{
list.labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
drawTextField();
}
public function set prompt(_arg1:String):void{
if (_arg1 == ""){
_prompt = null;
} else {
_prompt = _arg1;
};
invalidate(InvalidationType.STATE);
}
public function get length():int{
return (list.length);
}
protected function drawTextField():void{
inputField.setStyle("upSkin", "");
inputField.setStyle("disabledSkin", "");
inputField.enabled = enabled;
inputField.editable = _editable;
inputField.textField.selectable = ((enabled) && (_editable));
inputField.mouseEnabled = (inputField.mouseChildren = ((enabled) && (_editable)));
inputField.focusEnabled = false;
if (_editable){
inputField.addEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus, false, 0, true);
inputField.addEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut, false, 0, true);
} else {
inputField.removeEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus);
inputField.removeEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut);
};
}
protected function onInputFieldFocusOut(_arg1:FocusEvent):void{
inputField.removeEventListener(ComponentEvent.ENTER, onEnter);
selectedIndex = selectedIndex;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
public function get labelFunction():Function{
return (list.labelFunction);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return ((list.height - (_local1 * 2)));
}
public function get selectedIndex():int{
return (list.selectedIndex);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
isKeyDown = false;
if (isOpen){
if (((!(_arg1.relatedObject)) || (!(list.contains(_arg1.relatedObject))))){
if (((!((highlightedCell == -1))) && (!((highlightedCell == selectedIndex))))){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
};
super.focusOutHandler(_arg1);
}
public function get selectedLabel():String{
if (editableValue != null){
return (editableValue);
};
if (selectedIndex == -1){
return (null);
};
return (itemToLabel(selectedItem));
}
public function get text():String{
return (inputField.text);
}
protected function onListChange(_arg1:Event):void{
editableValue = null;
dispatchEvent(_arg1);
invalidate(InvalidationType.SELECTED);
if (isKeyDown){
return;
};
close();
}
protected function onToggleListVisibility(_arg1:MouseEvent):void{
_arg1.stopPropagation();
dispatchEvent(_arg1);
if (isOpen){
close();
} else {
open();
stage.addEventListener(MouseEvent.MOUSE_UP, onListItemUp, false, 0, true);
};
}
override protected function draw():void{
var _local1:*;
_local1 = selectedIndex;
if ((((_local1 == -1)) && (((((!((prompt == null))) || (editable))) || ((length == 0)))))){
_local1 = Math.max(-1, Math.min(_local1, (length - 1)));
} else {
editableValue = null;
_local1 = Math.max(0, Math.min(_local1, (length - 1)));
};
if (list.selectedIndex != _local1){
list.selectedIndex = _local1;
invalidate(InvalidationType.SELECTED, false);
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFonts();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.STATE)){
drawTextFormat();
drawLayout();
invalidate(InvalidationType.DATA);
};
if (isInvalid(InvalidationType.DATA)){
drawList();
invalidate(InvalidationType.SELECTED, true);
};
if (isInvalid(InvalidationType.SELECTED)){
if ((((_local1 == -1)) && (!((editableValue == null))))){
inputField.text = editableValue;
} else {
if (_local1 > -1){
if (length > 0){
inputField.horizontalScrollPosition = 0;
inputField.text = itemToLabel(list.selectedItem);
};
} else {
if ((((_local1 == -1)) && (!((_prompt == null))))){
showPrompt();
} else {
inputField.text = "";
};
};
};
if (((((editable) && ((selectedIndex > -1)))) && ((stage.focus == inputField.textField)))){
inputField.setSelection(0, inputField.length);
};
};
drawTextField();
super.draw();
}
public function addItem(_arg1:Object):void{
list.addItem(_arg1);
invalidate(InvalidationType.DATA);
}
public function get rowCount():uint{
return (_rowCount);
}
override protected function configUI():void{
super.configUI();
background = new BaseButton();
background.focusEnabled = false;
copyStylesToChild(background, BACKGROUND_STYLES);
background.addEventListener(MouseEvent.MOUSE_DOWN, onToggleListVisibility, false, 0, true);
addChild(background);
inputField = new TextInput();
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(Event.CHANGE, onTextInput, false, 0, true);
addChild(inputField);
list = new List();
list.focusEnabled = false;
copyStylesToChild(list, LIST_STYLES);
list.addEventListener(Event.CHANGE, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_CLICK, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OUT, passEvent, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OVER, passEvent, false, 0, true);
list.verticalScrollBar.addEventListener(Event.SCROLL, passEvent, false, 0, true);
}
protected function positionList():void{
var _local1:Point;
_local1 = localToGlobal(new Point(0, 0));
list.x = _local1.x;
if (((_local1.y + height) + list.height) > stage.stageHeight){
list.y = (_local1.y - list.height);
} else {
list.y = (_local1.y + height);
};
}
public function get value():String{
var _local1:Object;
if (editableValue != null){
return (editableValue);
};
_local1 = selectedItem;
if (((!(_editable)) && (!((_local1.data == null))))){
return (_local1.data);
};
return (itemToLabel(_local1));
}
public function get prompt():String{
return (_prompt);
}
public function set dataProvider(_arg1:DataProvider):void{
_arg1.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
list.dataProvider = _arg1;
invalidate(InvalidationType.DATA);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
if (!_editable){
return;
};
inputField.restrict = _arg1;
}
protected function onTextInput(_arg1:Event):void{
_arg1.stopPropagation();
if (!_editable){
return;
};
editableValue = inputField.text;
selectedIndex = -1;
dispatchEvent(new Event(Event.CHANGE));
}
protected function onInputFieldFocus(_arg1:FocusEvent):void{
inputField.addEventListener(ComponentEvent.ENTER, onEnter, false, 0, true);
close();
}
public function getItemAt(_arg1:uint):Object{
return (list.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (ComboBox.createAccessibilityImplementation != null){
ComboBox.createAccessibilityImplementation(this);
};
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (getStyleValue("buttonWidth") as Number);
_local2 = (getStyleValue("textPadding") as Number);
background.setSize(width, height);
inputField.x = (inputField.y = _local2);
inputField.setSize(((width - _local1) - _local2), (height - _local2));
list.width = (isNaN(_dropdownWidth)) ? width : _dropdownWidth;
background.enabled = enabled;
background.drawNow();
}
public function removeItem(_arg1:Object):Object{
return (list.removeItem(_arg1));
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
public function get dataProvider():DataProvider{
return (list.dataProvider);
}
public function get textField():TextInput{
return (inputField);
}
protected function setStyles():void{
copyStylesToChild(background, BACKGROUND_STYLES);
copyStylesToChild(list, LIST_STYLES);
}
public function set labelFunction(_arg1:Function):void{
list.labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
protected function drawTextFormat():void{
var _local1:TextFormat;
_local1 = (getStyleValue((_enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local1 == null){
_local1 = new TextFormat();
};
inputField.textField.defaultTextFormat = _local1;
inputField.textField.setTextFormat(_local1);
setEmbedFonts();
}
public function set selectedIndex(_arg1:int):void{
list.selectedIndex = _arg1;
highlightCell();
invalidate(InvalidationType.SELECTED);
}
public function close():void{
highlightCell();
highlightedCell = -1;
if (!isOpen){
return;
};
dispatchEvent(new Event(Event.CLOSE));
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick);
isOpen = false;
stage.removeChild(list);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, List.getStyleDefinition()));
}
}
}//package fl.controls
Section 41
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 42
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import flash.ui.*;
import flash.geom.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _iconField:String;// = "icon"
protected var _labelFunction:Function;
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function List(){
_rowHeight = 20;
_labelField = "label";
_iconField = "icon";
super();
}
public function get iconField():String{
return (_iconField);
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override protected function drawList():void{
var _local1:Rectangle;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local7:Dictionary;
var _local8:Dictionary;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
_local1 = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local2 = Math.floor((_verticalScrollPosition / rowHeight));
_local3 = Math.min(length, ((_local2 + rowCount) + 1));
_local7 = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
_local8 = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local6 = (activeCellRenderers.pop() as ICellRenderer);
_local5 = _local6.data;
if ((((_local7[_local5] == null)) || ((invalidItems[_local5] == true)))){
availableCellRenderers.push(_local6);
} else {
_local8[_local5] = _local6;
invalidItems[_local5] = true;
};
list.removeChild((_local6 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local4 = _local2;
while (_local4 < _local3) {
_local9 = false;
_local5 = _dataProvider.getItemAt(_local4);
if (_local8[_local5] != null){
_local9 = true;
_local6 = _local8[_local5];
delete _local8[_local5];
} else {
if (availableCellRenderers.length > 0){
_local6 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local6 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local12 = (_local6 as Sprite);
if (_local12 != null){
_local12.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local12.doubleClickEnabled = true;
_local12.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local12["setStyle"] != null){
for (_local13 in rendererStyles) {
var _local16 = _local12;
_local16["setStyle"](_local13, rendererStyles[_local13]);
};
};
};
};
};
list.addChild((_local6 as Sprite));
activeCellRenderers.push(_local6);
_local6.y = (rowHeight * (_local4 - _local2));
_local6.setSize((availableWidth + _maxHorizontalScrollPosition), rowHeight);
_local10 = itemToLabel(_local5);
_local11 = null;
if (_iconFunction != null){
_local11 = _iconFunction(_local5);
} else {
if (_iconField != null){
_local11 = _local5[_iconField];
};
};
if (!_local9){
_local6.data = _local5;
};
_local6.listData = new ListData(_local10, _local11, this, _local4, _local4, 0);
_local6.selected = !((_selectedIndices.indexOf(_local4) == -1));
if ((_local6 is UIComponent)){
(_local6 as UIComponent).drawNow();
};
_local4++;
};
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
scrollToSelected();
break;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
_arg1.stopPropagation();
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function draw():void{
var _local1:Boolean;
_local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (_cellRenderer != getStyleValue("cellRenderer")){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
};
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:uint;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 43
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 44
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 45
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 46
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
import fl.containers.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 47
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 48
//UIScrollBar (fl.controls.UIScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
import flash.text.*;
public class UIScrollBar extends ScrollBar {
protected var inScroll:Boolean;// = false
protected var _scrollTarget:TextField;
protected var inEdit:Boolean;// = false
private static var defaultStyles:Object = {};
public function UIScrollBar(){
inEdit = false;
inScroll = false;
super();
}
protected function handleTargetScroll(_arg1:Event):void{
if (inDrag){
return;
};
if (!enabled){
return;
};
inEdit = true;
updateScrollTargetProperties();
scrollPosition = ((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
inEdit = false;
}
override public function set minScrollPosition(_arg1:Number):void{
super.minScrollPosition = ((_arg1)<0) ? 0 : _arg1;
}
override public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
super.setScrollPosition(_arg1, _arg2);
if (!_scrollTarget){
inScroll = false;
return;
};
updateTargetScroll();
}
override public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
var _local5:Number;
var _local6:Number;
_local5 = _arg3;
_local6 = ((_arg2)<0) ? 0 : _arg2;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local5 = ((_arg3)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local5;
} else {
_local5 = ((_arg3)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local5;
};
};
super.setScrollProperties(_arg1, _local6, _local5, _arg4);
}
public function get scrollTargetName():String{
return (_scrollTarget.name);
}
public function get scrollTarget():TextField{
return (_scrollTarget);
}
protected function updateScrollTargetProperties():void{
var _local1:Boolean;
var _local2:Number;
if (_scrollTarget == null){
setScrollProperties(pageSize, minScrollPosition, maxScrollPosition, pageScrollSize);
scrollPosition = 0;
} else {
_local1 = (direction == ScrollBarDirection.HORIZONTAL);
_local2 = (_local1) ? _scrollTarget.width : 10;
setScrollProperties(_local2, (_local1) ? 0 : 1, (_local1) ? _scrollTarget.maxScrollH : _scrollTarget.maxScrollV, pageScrollSize);
scrollPosition = (_local1) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
};
}
public function update():void{
inEdit = true;
updateScrollTargetProperties();
inEdit = false;
}
public function set scrollTargetName(_arg1:String):void{
var target = _arg1;
try {
scrollTarget = (parent.getChildByName(target) as TextField);
} catch(error:Error) {
throw (new Error("ScrollTarget not found, or is not a TextField"));
};
}
override public function set direction(_arg1:String):void{
if (isLivePreview){
return;
};
super.direction = _arg1;
updateScrollTargetProperties();
}
protected function handleTargetChange(_arg1:Event):void{
inEdit = true;
setScrollPosition(((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV, true);
updateScrollTargetProperties();
inEdit = false;
}
override public function set maxScrollPosition(_arg1:Number):void{
var _local2:Number;
_local2 = _arg1;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local2 = ((_local2)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local2;
} else {
_local2 = ((_local2)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local2;
};
};
super.maxScrollPosition = _local2;
}
protected function updateTargetScroll(_arg1:ScrollEvent=null):void{
if (inEdit){
return;
};
if (direction == ScrollBarDirection.HORIZONTAL){
_scrollTarget.scrollH = scrollPosition;
} else {
_scrollTarget.scrollV = scrollPosition;
};
}
override protected function draw():void{
if (isInvalid(InvalidationType.DATA)){
updateScrollTargetProperties();
};
super.draw();
}
public function set scrollTarget(_arg1:TextField):void{
if (_scrollTarget != null){
_scrollTarget.removeEventListener(Event.CHANGE, handleTargetChange, false);
_scrollTarget.removeEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false);
_scrollTarget.removeEventListener(Event.SCROLL, handleTargetScroll, false);
removeEventListener(ScrollEvent.SCROLL, updateTargetScroll, false);
};
_scrollTarget = _arg1;
if (_scrollTarget != null){
_scrollTarget.addEventListener(Event.CHANGE, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(Event.SCROLL, handleTargetScroll, false, 0, true);
addEventListener(ScrollEvent.SCROLL, updateTargetScroll, false, 0, true);
};
invalidate(InvalidationType.DATA);
}
override public function get direction():String{
return (super.direction);
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 49
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 50
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 51
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 52
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
//unresolved jump
};
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
throw (new TypeError((("Error: Type Coercion failed: cannot convert " + _arg1) + " to Array or DataProvider.")));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (data.length);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 53
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 54
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 55
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 56
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 57
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 58
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 59
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 60
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 61
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 62
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 63
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 64
//ag_intro_mc_151 (Giraffe_fla.ag_intro_mc_151)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class ag_intro_mc_151 extends MovieClip {
public var main:Object;
public function ag_intro_mc_151(){
super();
addFrameScript(0, frame1, 217, frame218);
}
function frame218(){
main.play();
}
function frame1(){
main.stop();
gotoAndPlay(2);
}
}
}//package Giraffe_fla
Section 65
//ArmorGamesLogo_18 (Giraffe_fla.ArmorGamesLogo_18)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class ArmorGamesLogo_18 extends MovieClip {
public var b:SimpleButton;
public function ArmorGamesLogo_18(){
super();
addFrameScript(0, frame1);
}
function frame1(){
b.addEventListener(MouseEvent.CLICK, getAGURL);
}
public function getAGURL(me:MouseEvent):void{
var url:String;
var req:URLRequest;
var me = me;
url = "http://ArmorGames.com";
req = new URLRequest(url);
navigateToURL(req, "_blank");
//unresolved jump
var _slot1 = e;
}
}
}//package Giraffe_fla
Section 66
//baseGraphicsHolder_291 (Giraffe_fla.baseGraphicsHolder_291)
package Giraffe_fla {
import flash.display.*;
public dynamic class baseGraphicsHolder_291 extends MovieClip {
public var bgi:MovieClip;
public function baseGraphicsHolder_291(){
super();
addFrameScript(0, frame1, 1, frame2, 10, frame11, 26, frame27, 43, frame44);
}
function frame1(){
visible = false;
stop();
}
function frame2(){
stop();
}
function frame27(){
gotoAndStop("Built");
}
function frame11(){
visible = true;
}
function frame44(){
visible = false;
gotoAndStop("Built");
}
}
}//package Giraffe_fla
Section 67
//buildBar_234 (Giraffe_fla.buildBar_234)
package Giraffe_fla {
import flash.display.*;
public dynamic class buildBar_234 extends MovieClip {
public function buildBar_234(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Giraffe_fla
Section 68
//buildingCover_289 (Giraffe_fla.buildingCover_289)
package Giraffe_fla {
import flash.display.*;
public dynamic class buildingCover_289 extends MovieClip {
public function buildingCover_289(){
super();
addFrameScript(0, frame1, 15, frame16);
}
function frame16(){
stop();
stop();
}
function frame1(){
stop();
}
}
}//package Giraffe_fla
Section 69
//chatBox_236 (Giraffe_fla.chatBox_236)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class chatBox_236 extends MovieClip {
public var moveDir:int;
public var viewLength:Number;
public var sb_G:Number;
public var minY:Number;
public var sb_B:Number;
public var sb_T:Number;
public var sb:MovieClip;
public var maxY:Number;
public var innerBox:MovieClip;
public var scrollSpeed:Number;
public var ind:Number;
public function chatBox_236(){
super();
addFrameScript(0, frame1);
}
public function addScrollUp(e:MouseEvent):void{
moveDir = 1;
addEventListener(Event.ENTER_FRAME, moveText, false, 0, true);
}
public function updateNavBar():void{
if (maxY > (viewLength + 15)){
sb.bob.height = ((viewLength / maxY) * 84.5);
sb.bob.visible = true;
sb.visible = true;
ind = ((innerBox.y - minY) / (maxY - minY));
sb_G = ((sb_B - sb_T) - sb.bob.height);
sb.bob.y = ((sb_B - sb.bob.height) - (ind * sb_G));
} else {
sb.bob.visible = false;
sb.visible = false;
};
}
function frame1(){
viewLength = 103;
minY = innerBox.y;
scrollSpeed = 6;
sb_T = 12;
sb_B = 93.5;
sb.visible = false;
trace(parent);
trace(stage);
sb.butUp.addEventListener(MouseEvent.MOUSE_DOWN, addScrollUp, false, 0, true);
sb.butDown.addEventListener(MouseEvent.MOUSE_DOWN, addScrollDown, false, 0, true);
sb.butUp.addEventListener(MouseEvent.MOUSE_UP, removeScroll, false, 0, true);
sb.butDown.addEventListener(MouseEvent.MOUSE_UP, removeScroll, false, 0, true);
sb.bob.addEventListener(MouseEvent.MOUSE_DOWN, scrollDragS, false, 0, true);
parent.stage.addEventListener(MouseEvent.MOUSE_UP, scrollDragE, false, 0, true);
}
public function addScrollDown(e:MouseEvent):void{
moveDir = -1;
addEventListener(Event.ENTER_FRAME, moveText, false, 0, true);
}
public function removeScroll(e:MouseEvent):void{
removeEventListener(Event.ENTER_FRAME, moveText);
}
public function scrollDragS(me:MouseEvent):void{
sb.addEventListener(Event.ENTER_FRAME, mouserMove, false, 0, true);
}
public function scrollDragE(me:MouseEvent):void{
sb.removeEventListener(Event.ENTER_FRAME, mouserMove);
}
public function moveText(e:Event):void{
if ((((((innerBox.y < maxY)) && ((moveDir == 1)))) || ((((innerBox.y > minY)) && ((moveDir == -1)))))){
innerBox.y = (innerBox.y + (scrollSpeed * moveDir));
updateNavBar();
};
}
public function mouserMove(e:Event):void{
sb.bob.y = (sb.mouseY - (sb.bob.height / 2));
if (sb.bob.y < sb_T){
sb.bob.y = sb_T;
};
if ((sb.bob.y + sb.bob.height) > sb_B){
sb.bob.y = (sb_B - sb.bob.height);
};
ind = (((sb_B - sb.bob.height) - sb.bob.y) / sb_G);
innerBox.y = ((ind * (maxY - minY)) + minY);
}
}
}//package Giraffe_fla
Section 70
//chatScrollBar_238 (Giraffe_fla.chatScrollBar_238)
package Giraffe_fla {
import flash.display.*;
public dynamic class chatScrollBar_238 extends MovieClip {
public var butUp:SimpleButton;
public var bob:MovieClip;
public var butDown:SimpleButton;
public function chatScrollBar_238(){
super();
}
}
}//package Giraffe_fla
Section 71
//d_mc1_7 (Giraffe_fla.d_mc1_7)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc1_7 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc1_7(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2115";
tSay = "First manned vessel is sent beyond the Earth's Solar System.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 72
//d_mc2_10 (Giraffe_fla.d_mc2_10)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc2_10 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc2_10(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2132";
tSay = "A habitable planet, Minerva, has finally been indentified by the Planck-IV telescope.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 73
//d_mc3_13 (Giraffe_fla.d_mc3_13)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc3_13 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc3_13(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2141";
tSay = "The United Space Coalition is formed by Russia and the European nations. Mankind's first attempt of planetary colonization begins.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 74
//d_mc4_14 (Giraffe_fla.d_mc4_14)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc4_14 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc4_14(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2185";
tSay = "Athenia, the first extraterrestrial state in history, has been established.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 75
//d_mc5_15 (Giraffe_fla.d_mc5_15)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc5_15 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc5_15(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2207";
tSay = "Athenia falls into economic hardship from not having enough manual labour.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 76
//d_mc6_16 (Giraffe_fla.d_mc6_16)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc6_16 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc6_16(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2252";
tSay = "USC Ambassador proposes a special operation to supplement Athenia's labour force with life sentenced convicts and POWs. This was kept secret, and there was little protest.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 77
//d_mc7_17 (Giraffe_fla.d_mc7_17)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
public dynamic class d_mc7_17 extends MovieClip {
public var inBut:SimpleButton;
public var tDate:String;
public var tSay:String;
public function d_mc7_17(){
super();
addFrameScript(0, frame1);
}
function frame1(){
inBut.addEventListener(MouseEvent.MOUSE_OVER, doFunction, false, 0, true);
inBut.addEventListener(MouseEvent.MOUSE_OUT, outFunction, false, 0, true);
tDate = "2265";
tSay = "The operation begins. Tens of thousands of prisoners are transported from Earth against their will to start a new life on Minerva.";
inBut.useHandCursor = false;
}
public function outFunction(me:MouseEvent):void{
toolTip.unTip();
}
public function doFunction(me:MouseEvent):void{
toolTip.tip(new tipObject(tDate, 0, 0, 0, tSay), 0);
}
}
}//package Giraffe_fla
Section 78
//dateMc_6 (Giraffe_fla.dateMc_6)
package Giraffe_fla {
import flash.display.*;
import flash.text.*;
public dynamic class dateMc_6 extends MovieClip {
public var t:TextField;
public function dateMc_6(){
super();
}
}
}//package Giraffe_fla
Section 79
//defeatScreen_246 (Giraffe_fla.defeatScreen_246)
package Giraffe_fla {
import flash.display.*;
public dynamic class defeatScreen_246 extends MovieClip {
public function defeatScreen_246(){
super();
addFrameScript(599, frame600);
}
function frame600(){
stop();
}
}
}//package Giraffe_fla
Section 80
//gameSetting_307 (Giraffe_fla.gameSetting_307)
package Giraffe_fla {
import flash.display.*;
public dynamic class gameSetting_307 extends MovieClip {
public function gameSetting_307(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Giraffe_fla
Section 81
//iconCombatButton_224 (Giraffe_fla.iconCombatButton_224)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class iconCombatButton_224 extends MovieClip {
public var theButton:SimpleButton;
public var id:uint;
public var theIcon:MovieClip;
public function iconCombatButton_224(){
super();
addFrameScript(0, frame1);
}
public function doThing(e:MouseEvent):void{
gameKon.theRoot.uiCombatBut(id);
}
public function hideTTui(e:MouseEvent):void{
toolTip.unTip();
}
function frame1(){
theButton.addEventListener(MouseEvent.CLICK, doThing, false, 0, true);
theButton.addEventListener(MouseEvent.MOUSE_OVER, showTTui, false, 0, true);
theButton.addEventListener(MouseEvent.MOUSE_OUT, hideTTui, false, 0, true);
}
public function showTTui(e:MouseEvent):void{
gameKon.theRoot.combatUiTT(id);
}
}
}//package Giraffe_fla
Section 82
//loadingBar_3 (Giraffe_fla.loadingBar_3)
package Giraffe_fla {
import flash.display.*;
public dynamic class loadingBar_3 extends MovieClip {
public var bar:MovieClip;
public function loadingBar_3(){
super();
}
}
}//package Giraffe_fla
Section 83
//MainTimeline (Giraffe_fla.MainTimeline)
package Giraffe_fla {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import com.jiggmin.blossomSocket.*;
import flash.utils.*;
import fl.data.*;
import flash.text.*;
import com.jiggmin.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var setRecty:Number;
public var WeaponData:weaponData;
public var justReg:Boolean;
public var b0:MovieClip;
public var b1:MovieClip;
public var b2:MovieClip;
public var b3:MovieClip;
public var b4:MovieClip;
public var b5:MovieClip;
public var b6:MovieClip;
public var b8:MovieClip;
public var MP_userName:String;
public var button_play:SimpleButton;
public var but_exit:Button;
public var my_cMenu:ContextMenu;
public var but_login:Button;
public var ad:DisplayObject;
public var singleLevel:uint;
public var screenGoRight:Boolean;
public var drawing:Boolean;
public var b7:MovieClip;
public var domEnd:Number;
public var urlStart:Number;
public var DataTracer:dataTracer;
public var missionMax:uint;
public var tfRe:TextFormat;
public var cText:tipObject;
public var be:uint;
public var bh;
public var r_m2:TextField;
public var v_screen:MovieClip;
public var r_m3:TextField;
public var r_m4:TextField;
public var teamWin:Team;
public var __setPropDict:Dictionary;
public var combo1:ComboBox;
public var FONT:MainFont2;
public var aiProfile:uint;
public var i;
public var shower:TextField;
public var friendList:Array;
public var T:MenuFont;
public var j;
public var countTime:MovieClip;
public var jum:String;
public var screenPoint:Number;
public var dif:uint;
public var missionOn:Boolean;
public var allySocket:uint;
public var shakeDecay:Number;
public var b;
public var url2:String;
public var BuildingData:buildingData;
public var d_screen:MovieClip;
public var r_p2:TextField;
public var r_p3:TextField;
public var screenGoLeft:Boolean;
public var r_p4:TextField;
public var screenWidth:Number;
public var mpSTarget:MultiplayerScreen;
public var CPMStarSubPoolID:int;
public var mouseVel:Number;
public var fg;
public var CPMStarPoolID:int;
public var domain:String;
public var allPlayers:Array;
public var mouseMaxVel:Number;
public var boundLimit:Number;
public var gh;
public var button_link:Button;
public var i2;
public var urlEnd:Number;
public var i7:int;
public var DCLINE:String;
public var rememberMe:Boolean;
public var j7;
public var playerName:String;
public var re_name:TextField;
public var xb_back:Button;
public var re_pass2:TextField;
public var gameRun:Boolean;
public var secondLayer:groundDisplay2;
public var dragRect:Rectangle;
public var userRace:uint;
public var loadBar:MovieClip;
public var missionLevel:uint;
public var shakeStr:Number;
public var colorChat:Array;
public var endPoint1:Number;
public var endPoint2:Number;
public var regName:String;
public var in_name:TextField;
public var shakeOsci:Number;
public var DisplayField:Sprite;
public var comicPageMax:uint;
public var gameRunning:Boolean;
public var button_mission:Button;
public var bbLock:SimpleButton;
public var ignoreList:Array;
public var chatPanel:TextField;
public var mW:Number;
public var colorStrings:Array;
public var collProp7:Object;
public var but_register2:Button;
public var uiGlowIn2:GlowFilter;
public var effectsDisplay:Sprite;
public var sav_user:String;
public var serverNames:Array;
public var promptBox:MovieClip;
public var aiSingArray:Array;
public var dateMC:MovieClip;
public var storySetter:uint;
public var MP_r2j:Boolean;
public var oi:MovieClip;
public var OptionData:optionData;
public var comicLoad;
public var agIntro:MovieClip;
public var MP_color:uint;
public var button_multi:Button;
public var winGame:Boolean;
public var button_single:Button;
public var shakeNow:Number;
public var mainPosY:Number;
public var roomName:String;
public var sav_pass:String;
public var mpscreenMode:Boolean;
public var button_res:Button;
public var userData:Object;
public var uiCombatTipOn:Array;
public var userID:int;
public var GameKon:gameKon;
public var vars:Object;
public var gameQuitable:Boolean;
public var uiGlow:GlowFilter;
public var minBound:uint;
public var normalRoom:String;
public var butmis_1:Button;
public var butmis_2:Button;
public var butmis_3:Button;
public var butmis_4:Button;
public var butmis_6:Button;
public var uiLay:MovieClip;
public var tf:TextFormat;
public var butmis_5:Button;
public var TJ:Timer;
public var j_server0:Button;
public var j_server1:Button;
public var v2;
public var clientPlayer:Array;
public var DCTRUE:Boolean;
public var optRestrict:Array;
public var re_email:TextField;
public var xb_back2:Button;
public var xb_back3:Button;
public var realUser:Boolean;
public var singlePlayerMode:Boolean;
public var mis_beg:SimpleButton;
public var re_pass:TextField;
public var unitDisplay:Sprite;
public var hotkeyArray:Array;
public var but_guest:Button;
public var adBox:MovieClip;
public var josefArray:Array;
public var but_register:Button;
public var LastDot:Number;
public var n_l2:TextField;
public var n_l4:TextField;
public var rankedMatch:Boolean;
public var n_l1:TextField;
public var n_l3:TextField;
public var allyChat:Boolean;
public var buildBar:MovieClip;
public var colorForm:Array;
public var chatToWho:TextField;
public var regPass:String;
public var collProps7:Array;
public var maxBound:uint;
public var musicOn:Boolean;
public var completedTheL:Boolean;
public var in_pass:TextField;
public var mouseLasso:Sprite;
public var sxB_1:Button;
public var sxB_2:Button;
public var sxB_3:Button;
public var sxB_4:Button;
public var sxB_5:Button;
public var rankLimit:Array;
public var GD3:groundDisplay3;
public var d_mc0:MovieClip;
public var d_mc1:MovieClip;
public var d_mc2:MovieClip;
public var d_mc3:MovieClip;
public var d_mc4:MovieClip;
public var d_mc5:MovieClip;
public var d_mc6:MovieClip;
public var BaseKon:baseKon;
public var chatHider:MovieClip;
public var tutLev:Boolean;
public var gameSet:uint;
public var saveGame:SharedObject;
public var roomMaster:Boolean;
public var reMe:CheckBox;
public var collObj7:DataProvider;
public var playerControl;
public var uiName:TextField;
public var nameBox:TextField;
public var mouseAccel:Number;
public var uiDesc:TextField;
public var iii;
public var uiGlowIn:GlowFilter;
public var soundOn:Boolean;
public var chatBox:MovieClip;
public var r_e2:TextField;
public var r_e3:TextField;
public var aiSetArray:Array;
public var r_e4:TextField;
public var iWon:Boolean;
public var UnitData:unitData;
public var MP_team:uint;
public var winSave:uint;
public var vars2:Object;
public var comicPage:uint;
public var missionGo:Boolean;
public var DisplayKon:displayKon;
public var allyPosT:uint;
public var but_exit2:Button;
public var onlineServers:Array;
public var ToolTip:toolTip;
public var uiCombatTipOff:Array;
public var remotePlayerArray:Array;
public var itemObj7:SimpleCollectionItem;
public var r_i2:TextField;
public var r_i3:TextField;
public var setRectx:Number;
public var mis_next:SimpleButton;
public var r_i:TextField;
public var hotbutArray:Array;
public var r_i4:TextField;
public var r_m:TextField;
public var r_p:TextField;
public var gameRoom:BlossomRoom;
public var battleWidth:Number;
public var validDomain:Boolean;
public var r_e:TextField;
public function MainTimeline(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 1, frame2, 3, frame4, 4, frame5, 14, frame15, 23, frame24, 33, frame34, 43, frame44, 53, frame54, 63, frame64, 72, frame73, 73, frame74, 74, frame75, 75, frame76, 76, frame77, 77, frame78, 78, frame79, 79, frame80, 81, frame82, 82, frame83, 83, frame84, 84, frame85, 85, frame86, 86, frame87, 87, frame88, 88, frame89);
}
public function endComicMode():void{
removeChild(comicLoad);
mis_beg.visible = false;
if (missionGo){
this.gotoAndStop("Game", "GAME");
} else {
if (missionLevel == 6){
this.gotoAndStop("MISSION", "MENU");
} else {
this.gotoAndStop("MISSION", "MENU");
};
};
}
public function checkNameValid(a:String){
var regEXP:RegExp;
var cahL:int;
var nuller:Boolean;
var nn:*;
var o:Object;
regEXP = /([0-9a-zA-Z])/;
cahL = a.length;
nuller = false;
nn = 0;
while (nn < cahL) {
o = regEXP.exec(a.charAt(nn));
if (o == null){
nuller = true;
};
nn++;
};
if (a.indexOf("Guest") != -1){
nuller = true;
};
if (nuller){
return (false);
};
return (true);
}
public function emptyText(event:MouseEvent):void{
toolTip.unTip();
gameKon.tippingWork = false;
}
function __setProp_butmis_5_MENU_MENU_78(){
butmis_5["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_5.emphasized = false;
butmis_5.enabled = true;
butmis_5.label = "Mission 5";
butmis_5.labelPlacement = "right";
butmis_5.selected = false;
butmis_5.toggle = false;
butmis_5.visible = true;
butmis_5["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function receiveStatsHandler(be:BlossomEvent):void{
var users:int;
if (MP_r2j){
users = be.raw.users;
trace(users);
if (users < 300){
SocketManager.removeEventListener(BlossomEvent.RECEIVE_SOCKET_ID, connected);
dataTracer.progressing = false;
removeChild(DataTracer);
MP_r2j = false;
stage.removeEventListener("CLOSETRACER", stopTheJoin);
gotoAndStop("mpLogin", "MPCONNECT");
} else {
dataTracer.update("This server is full, please try a different one :(");
dataTracer.suppress();
SocketManager.close();
};
};
}
public function completedTheLoad():void{
var pcent:uint;
var iii2:*;
if (!completedTheL){
completedTheL = true;
pcent = 1;
loadBar.bar.width = (mW * pcent);
dateMC.x = (120.6 + loadBar.bar.width);
for (iii2 in josefArray) {
josefArray[iii2].oj.visible = true;
};
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, PL_LOADING);
this.loaderInfo.removeEventListener(Event.COMPLETE, PL_LOADED);
nextFrame();
};
}
public function startSing1(e:MouseEvent):void{
loadGameGo(1);
}
public function startSing2(e:MouseEvent):void{
loadGameGo(2);
}
public function startSing4(e:MouseEvent):void{
loadGameGo(4);
}
public function startSing5(e:MouseEvent):void{
loadGameGo(5);
}
public function startSing3(e:MouseEvent):void{
loadGameGo(3);
}
public function addMPthings():void{
TJ = new Timer(10000);
TJ.start();
TJ.addEventListener(TimerEvent.TIMER, sendResInfo, false, 0, true);
SocketManager.socket.addEventListener(BlossomEvent.RECEIVE_MESSAGE, allyChatHandler, false, 0, true);
gameRoom = new BlossomRoom(SocketManager.socket, roomName);
gameRoom.addEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeftHandler, false, 0, true);
gameRoom.addEventListener("createUnit", createUnitHandler, false, 0, true);
gameRoom.addEventListener("killUnit", killUnitHandler, false, 0, true);
gameRoom.addEventListener("orderUnit", orderHandler, false, 0, true);
gameRoom.addEventListener("createMissile", missileHandler, false, 0, true);
gameRoom.addEventListener("updateBuilding", buildingHandler, false, 0, true);
gameRoom.addEventListener("updateIncome", updateIncomeHandler, false, 0, true);
gameRoom.addEventListener("sendChat", sendChatHandler, false, 0, true);
gameRoom.addEventListener("sendExit", sendChatHandler, false, 0, true);
gameRoom.addEventListener("alignResource", alignResourceHand, false, 0, true);
}
public function killAllEvents():void{
but_login.removeEventListener(MouseEvent.CLICK, b_loginHand);
but_register.removeEventListener(MouseEvent.CLICK, b_registerHand);
but_guest.removeEventListener(MouseEvent.CLICK, b_guestHand);
but_exit.removeEventListener(MouseEvent.CLICK, b_exitHand);
}
function __setProp_sxB_5_MENU_MENU_77(){
sxB_5["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
sxB_5.emphasized = false;
sxB_5.enabled = true;
sxB_5.label = "Hard-Hard!";
sxB_5.labelPlacement = "right";
sxB_5.selected = false;
sxB_5.toggle = false;
sxB_5.visible = true;
sxB_5["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame1(){
CPMStarPoolID = 1052;
CPMStarSubPoolID = 9;
ad = AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID);
adBox.addChild(ad);
stop();
this.stop();
stage.scaleMode = StageScaleMode.EXACT_FIT;
mW = loadBar.bar.width;
completedTheL = false;
T = new MenuFont();
tf = new TextFormat();
tf.font = T.fontName;
tf.color = 0;
tf.size = 15;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, PL_LOADING, false, 0, true);
this.loaderInfo.addEventListener(Event.COMPLETE, PL_LOADED, false, 0, true);
josefArray = new Array();
josefArray.push({oj:d_mc0, D:2115});
josefArray.push({oj:d_mc1, D:2132});
josefArray.push({oj:d_mc2, D:2141});
josefArray.push({oj:d_mc3, D:2185});
josefArray.push({oj:d_mc4, D:2207});
josefArray.push({oj:d_mc5, D:2252});
josefArray.push({oj:d_mc6, D:2265});
for (iii in josefArray) {
josefArray[iii].oj.visible = false;
};
ToolTip = new toolTip(stage, this, -265, 250);
addChild(ToolTip);
ToolTip.x = mouseX;
ToolTip.y = mouseY;
dragRect = new Rectangle(0, 0, 800, 575);
ToolTip.startDrag(false, dragRect);
}
function frame2(){
stop();
soundOn = true;
musicOn = true;
normalRoom = "Lobby";
DataTracer = new dataTracer(this, stage);
url2 = stage.loaderInfo.url;
urlStart = (url2.indexOf("://") + 3);
urlEnd = url2.indexOf("/", urlStart);
domain = url2.substring(urlStart, urlEnd);
LastDot = (domain.lastIndexOf(".") - 1);
domEnd = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
validDomain = ((("armorgames.com" == domain)) || (("" == domain)));
button_play.addEventListener(MouseEvent.MOUSE_UP, playGame);
}
function __setProp_but_login_MPCONNECT_Go_82(){
but_login["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_login.emphasized = false;
but_login.enabled = true;
but_login.label = "Login";
but_login.labelPlacement = "right";
but_login.selected = false;
but_login.toggle = false;
but_login.visible = true;
but_login["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function doDraw(event:Event):void{
mouseLasso.graphics.clear();
mouseLasso.graphics.lineStyle(1, 6750054);
mouseLasso.graphics.drawRect(setRectx, setRecty, (mouseX - setRectx), (mouseY - setRecty));
}
function frame15(){
renderMachine.renderAll(2, colorForm, 0);
}
public function overText2(event:MouseEvent):void{
toolTip.tip(gameKon.cText2, 1);
gameKon.tippingWork = true;
}
public function sendChatHandler(be:BlossomEvent):void{
gogoChat(be.data.i, be.data.t);
}
public function userLeftHandler(be:BlossomEvent):void{
var leaverSocket:*;
var i2:*;
var leaverName:String;
leaverSocket = be.socketID;
for (i2 in allPlayers) {
if (allPlayers[i2].ID == leaverSocket){
leaverName = allPlayers[i2].NAME;
};
};
doChat((leaverName + " has left the game."), "System", 0);
}
function frame5(){
BuildingData = new buildingData();
OptionData = new optionData();
WeaponData = new weaponData();
UnitData = new unitData();
aiTactic.init();
colorStrings = new Array("White", "Red", "Blue", "Yellow", "Green");
colorForm = new Array(0xFFFFFF, 0xFF0000, 39423, 0xFFCC00, 385051);
colorChat = new Array("8C8C8C", "A93434", "306BA5", "BB8711", "327840");
renderMachine.renderAll(0);
}
function frame34(){
renderMachine.renderAll(2, colorForm, 2);
}
public function disconnectedHandler():void{
if (gameRunning){
tg();
gotoAndStop("START", "MENU");
} else {
if (mpscreenMode){
gotoAndStop("START", "MENU");
};
};
}
function __setProp_xb_back2_MENU_MENU_78(){
xb_back2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
xb_back2.emphasized = false;
xb_back2.enabled = true;
xb_back2.label = "Exit to Menu";
xb_back2.labelPlacement = "right";
xb_back2.selected = false;
xb_back2.toggle = false;
xb_back2.visible = true;
xb_back2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function overText(event:MouseEvent):void{
toolTip.tip(cText, 0);
}
function __setProp_button_res_POST_Layer1_88(){
button_res["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
button_res.emphasized = false;
button_res.enabled = true;
button_res.label = "Proceed";
button_res.labelPlacement = "right";
button_res.selected = false;
button_res.toggle = false;
button_res.visible = true;
button_res["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame24(){
renderMachine.renderAll(2, colorForm, 1);
}
function frame4(){
stop();
agIntro.main = this;
soundKon.init();
my_cMenu = new ContextMenu();
my_cMenu.hideBuiltInItems();
contextMenu = my_cMenu;
missionMax = 1;
sav_user = "";
sav_pass = "";
rememberMe = false;
saveGame = SharedObject.getLocal("Colony");
if (saveGame.data.al == null){
saveGame.data.al = 1;
saveGame.data.sav_user = "";
saveGame.data.sav_pass = "";
saveGame.data.rememberMe = false;
saveGame.flush();
} else {
missionMax = saveGame.data.al;
sav_user = saveGame.data.sav_user;
sav_pass = saveGame.data.sav_pass;
rememberMe = saveGame.data.rememberMe;
};
}
function frame44(){
renderMachine.renderAll(2, colorForm, 3);
}
function frame54(){
renderMachine.renderAll(2, colorForm, 4);
}
public function sendResInfo(te:TimerEvent):void{
var vars:Object;
vars = new Object();
vars.resArray = new Array(playerControl.r_m, playerControl.r_p, playerControl.r_e, playerControl.r_i);
vars.pos = playerControl.POS;
gameKon.theRoot.gameRoom.sendToRoom(vars, false, "alignResource");
}
public function endDraw(event:MouseEvent):void{
var selectPool:Array;
var z:*;
if ((((mouseLasso.width > 3)) || ((mouseLasso.height > 3)))){
selectPool = new Array();
for (z in gameKon.playerNow.team.all) {
if (z != 0){
if (mouseLasso.hitTestObject(gameKon.playerNow.team.all[z])){
if (gameKon.playerNow.team.all[z].player == gameKon.playerNow){
selectPool.push(gameKon.playerNow.team.all[z]);
};
};
};
if (selectPool.length > 0){
displayKon.updateUnit(selectPool);
};
};
};
mouseLasso.graphics.clear();
removeEventListener(Event.ENTER_FRAME, doDraw);
}
function __setProp_but_guest_MPCONNECT_Go_82(){
but_guest["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_guest.emphasized = false;
but_guest.enabled = true;
but_guest.label = "Play as Guest";
but_guest.labelPlacement = "right";
but_guest.selected = false;
but_guest.toggle = false;
but_guest.visible = true;
but_guest["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function backToGame(e:MouseEvent):void{
removeChild(promptBox);
gameQuitable = true;
}
function __setProp_sxB_3_MENU_MENU_77(){
sxB_3["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
sxB_3.emphasized = false;
sxB_3.enabled = true;
sxB_3.label = "Normal";
sxB_3.labelPlacement = "right";
sxB_3.selected = false;
sxB_3.toggle = false;
sxB_3.visible = true;
sxB_3["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function resetFocus(e:Event):void{
stage.focus = this;
chatPanel.text = "";
}
function frame64(){
jum = "You have been kicked on suspicion of hacking.";
this.gotoAndPlay("Prestart", "MENU");
}
function __setProp_butmis_3_MENU_MENU_78(){
butmis_3["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_3.emphasized = false;
butmis_3.enabled = true;
butmis_3.label = "Mission 3";
butmis_3.labelPlacement = "right";
butmis_3.selected = false;
butmis_3.toggle = false;
butmis_3.visible = true;
butmis_3["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function loadGameGo(a:uint):void{
singleLevel = a;
if (a == 1){
tutLev = true;
};
playerName = nameBox.text;
clientPlayer[0] = combo1.selectedItem.data;
gotoAndStop("Game", "GAME");
}
function __setProp_reMe_MPCONNECT_Go_82(){
reMe["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
reMe.enabled = true;
reMe.label = "Remember Me";
reMe.labelPlacement = "right";
reMe.selected = false;
reMe.visible = true;
reMe["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame75(){
gotoAndStop("MISSION", "MENU");
}
function frame79(){
if ((((__setPropDict[j_server1] == undefined)) || (!((int(__setPropDict[j_server1]) == 79))))){
__setPropDict[j_server1] = currentFrame;
__setProp_j_server1_MENU_MENU_79();
};
if ((((__setPropDict[j_server0] == undefined)) || (!((int(__setPropDict[j_server0]) == 79))))){
__setPropDict[j_server0] = currentFrame;
__setProp_j_server0_MENU_MENU_79();
};
if ((((__setPropDict[xb_back3] == undefined)) || (!((int(__setPropDict[xb_back3]) == 79))))){
__setPropDict[xb_back3] = currentFrame;
__setProp_xb_back3_MENU_MENU_79();
};
stop();
xb_back3.setStyle("textFormat", tf);
xb_back3.addEventListener(MouseEvent.CLICK, b_exitHand, false, 0, true);
onlineServers = new Array("colony1.armorgames.com", "colony2.armorgames.com");
serverNames = new Array("Glastondale", "Beatrix");
j_server0.setStyle("textFormat", tf);
j_server1.setStyle("textFormat", tf);
j_server0.label = serverNames[0];
j_server1.label = serverNames[1];
MP_r2j = false;
j_server0.addEventListener(MouseEvent.CLICK, s_Con0, false, 0, true);
j_server1.addEventListener(MouseEvent.CLICK, s_Con1, false, 0, true);
}
function frame73(){
musicKon.init(stage);
gotoAndStop("START", "MENU");
}
function __setProp_combo1_MENU_MENU_77(){
combo1["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj7 = new DataProvider();
collProps7 = [{label:"Capitalist", data:2}, {label:"Communist", data:1}, {label:"Fascist", data:0}];
i7 = 0;
while (i7 < collProps7.length) {
itemObj7 = new SimpleCollectionItem();
collProp7 = collProps7[i7];
for (j7 in collProp7) {
itemObj7[j7] = collProp7[j7];
};
collObj7.addItem(itemObj7);
i7++;
};
combo1.dataProvider = collObj7;
combo1.editable = false;
combo1.enabled = true;
combo1.prompt = "";
combo1.restrict = "";
combo1.rowCount = 3;
combo1.visible = true;
combo1["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame77(){
if ((((__setPropDict[sxB_2] == undefined)) || (!((int(__setPropDict[sxB_2]) == 77))))){
__setPropDict[sxB_2] = currentFrame;
__setProp_sxB_2_MENU_MENU_77();
};
if ((((__setPropDict[sxB_5] == undefined)) || (!((int(__setPropDict[sxB_5]) == 77))))){
__setPropDict[sxB_5] = currentFrame;
__setProp_sxB_5_MENU_MENU_77();
};
if ((((__setPropDict[sxB_3] == undefined)) || (!((int(__setPropDict[sxB_3]) == 77))))){
__setPropDict[sxB_3] = currentFrame;
__setProp_sxB_3_MENU_MENU_77();
};
if ((((__setPropDict[xb_back] == undefined)) || (!((int(__setPropDict[xb_back]) == 77))))){
__setPropDict[xb_back] = currentFrame;
__setProp_xb_back_MENU_MENU_77();
};
if ((((__setPropDict[sxB_1] == undefined)) || (!((int(__setPropDict[sxB_1]) == 77))))){
__setPropDict[sxB_1] = currentFrame;
__setProp_sxB_1_MENU_MENU_77();
};
if ((((__setPropDict[combo1] == undefined)) || (!((int(__setPropDict[combo1]) == 77))))){
__setPropDict[combo1] = currentFrame;
__setProp_combo1_MENU_MENU_77();
};
if ((((__setPropDict[sxB_4] == undefined)) || (!((int(__setPropDict[sxB_4]) == 77))))){
__setPropDict[sxB_4] = currentFrame;
__setProp_sxB_4_MENU_MENU_77();
};
clientPlayer = [2, 1, 1];
singleLevel = 0;
tutLev = false;
if (playerName != null){
nameBox.text = playerName;
};
sxB_1.addEventListener(MouseEvent.CLICK, startSing1, false, 0, true);
sxB_2.addEventListener(MouseEvent.CLICK, startSing2, false, 0, true);
sxB_3.addEventListener(MouseEvent.CLICK, startSing3, false, 0, true);
sxB_4.addEventListener(MouseEvent.CLICK, startSing4, false, 0, true);
sxB_5.addEventListener(MouseEvent.CLICK, startSing5, false, 0, true);
sxB_1.setStyle("textFormat", tf);
sxB_2.setStyle("textFormat", tf);
sxB_3.setStyle("textFormat", tf);
sxB_4.setStyle("textFormat", tf);
sxB_5.setStyle("textFormat", tf);
xb_back.setStyle("textFormat", tf);
xb_back.addEventListener(MouseEvent.CLICK, b_exitHand, false, 0, true);
}
function frame74(){
gotoAndStop("START", "MENU");
}
public function orderHandler(be:BlossomEvent):void{
gameKon.doUnitOption(be.data.id, be.data.orderArray);
}
public function updateUI(event:Event):void{
upUIHand();
}
function frame78(){
if ((((__setPropDict[butmis_3] == undefined)) || (!((int(__setPropDict[butmis_3]) == 78))))){
__setPropDict[butmis_3] = currentFrame;
__setProp_butmis_3_MENU_MENU_78();
};
if ((((__setPropDict[butmis_2] == undefined)) || (!((int(__setPropDict[butmis_2]) == 78))))){
__setPropDict[butmis_2] = currentFrame;
__setProp_butmis_2_MENU_MENU_78();
};
if ((((__setPropDict[butmis_6] == undefined)) || (!((int(__setPropDict[butmis_6]) == 78))))){
__setPropDict[butmis_6] = currentFrame;
__setProp_butmis_6_MENU_MENU_78();
};
if ((((__setPropDict[butmis_1] == undefined)) || (!((int(__setPropDict[butmis_1]) == 78))))){
__setPropDict[butmis_1] = currentFrame;
__setProp_butmis_1_MENU_MENU_78();
};
if ((((__setPropDict[butmis_5] == undefined)) || (!((int(__setPropDict[butmis_5]) == 78))))){
__setPropDict[butmis_5] = currentFrame;
__setProp_butmis_5_MENU_MENU_78();
};
if ((((__setPropDict[butmis_4] == undefined)) || (!((int(__setPropDict[butmis_4]) == 78))))){
__setPropDict[butmis_4] = currentFrame;
__setProp_butmis_4_MENU_MENU_78();
};
if ((((__setPropDict[xb_back2] == undefined)) || (!((int(__setPropDict[xb_back2]) == 78))))){
__setPropDict[xb_back2] = currentFrame;
__setProp_xb_back2_MENU_MENU_78();
};
xb_back2.setStyle("textFormat", tf);
xb_back2.addEventListener(MouseEvent.CLICK, b_exitHand, false, 0, true);
tutLev = false;
butmis_1.setStyle("textFormat", tf);
butmis_2.setStyle("textFormat", tf);
butmis_3.setStyle("textFormat", tf);
butmis_4.setStyle("textFormat", tf);
butmis_5.setStyle("textFormat", tf);
butmis_6.setStyle("textFormat", tf);
butmis_1.addEventListener(MouseEvent.CLICK, gotoMission1);
butmis_2.addEventListener(MouseEvent.CLICK, gotoMission2);
butmis_3.addEventListener(MouseEvent.CLICK, gotoMission3);
butmis_4.addEventListener(MouseEvent.CLICK, gotoMission4);
butmis_5.addEventListener(MouseEvent.CLICK, gotoMission5);
butmis_6.addEventListener(MouseEvent.CLICK, gotoMission6);
trace(missionMax);
gh = 1;
while (gh < 7) {
if (missionMax < gh){
this[("butmis_" + gh)].enabled = false;
this[("butmis_" + gh)].setStyle("textFormat", tf);
this[("butmis_" + gh)].label = "Locked";
};
gh++;
};
}
public function combatUiTT(id:uint):void{
switch (id){
case 0:
if (gameKon.shiftToggle){
toolTip.tip(uiCombatTipOn[0], 0);
} else {
toolTip.tip(uiCombatTipOff[0], 0);
};
break;
case 1:
if (gameKon.rallyOn){
toolTip.tip(uiCombatTipOn[1], 0);
} else {
toolTip.tip(uiCombatTipOff[1], 0);
};
break;
case 2:
if (allyChat){
toolTip.tip(uiCombatTipOn[2], 0);
} else {
toolTip.tip(uiCombatTipOff[2], 0);
};
break;
case 3:
if (soundOn){
toolTip.tip(uiCombatTipOn[3], 0);
} else {
toolTip.tip(uiCombatTipOff[3], 0);
};
break;
case 4:
if (musicOn){
toolTip.tip(uiCombatTipOn[4], 0);
} else {
toolTip.tip(uiCombatTipOff[4], 0);
};
break;
case 5:
toolTip.tip(uiCombatTipOn[5], 0);
break;
default:
break;
};
}
function frame84(){
roomMaster = false;
rankedMatch = false;
mpscreenMode = true;
optRestrict = new Array();
gameSet = 0;
mpSTarget = new MultiplayerScreen(MP_userName, MP_team, MP_color, userData, stage, normalRoom, userRace);
addChildAt(mpSTarget, 0);
}
function frame85(){
gotoAndStop("Game", "GAME");
}
public function mission2StartAi():void{
gameKon.theRoot.GameKon.player1.AI.AiStrategy.forceTech = 4;
gameKon.theRoot.GameKon.player2.AI.AiStrategy.forceTech = 4;
gameKon.theRoot.GameKon.player4.AI.AiStrategy.forceTech = 5;
}
function frame83(){
if ((((__setPropDict[but_exit2] == undefined)) || (!((int(__setPropDict[but_exit2]) == 83))))){
__setPropDict[but_exit2] = currentFrame;
__setProp_but_exit2_MPCONNECT_Go_83();
};
if ((((__setPropDict[but_register2] == undefined)) || (!((int(__setPropDict[but_register2]) == 83))))){
__setPropDict[but_register2] = currentFrame;
__setProp_but_register2_MPCONNECT_Go_83();
};
but_register2.addEventListener(MouseEvent.CLICK, b_registerHand2, false, 0, true);
but_exit2.addEventListener(MouseEvent.CLICK, b_exitHand, false, 0, true);
but_register2.setStyle("textFormat", tf);
but_exit2.setStyle("textFormat", tf);
justReg = false;
}
function frame86(){
switch (clientPlayer[1]){
case 1:
allyPosT = 2;
break;
case 2:
allyPosT = 1;
break;
case 3:
allyPosT = 4;
break;
case 4:
allyPosT = 3;
break;
};
i = 1;
while (i < 5) {
for (i2 in allPlayers) {
if (allPlayers[i2].POS == i){
allPlayers[i2].NAME = adjustName(allPlayers[i2].NAME);
this[("n_l" + i)].text = allPlayers[i2].NAME;
if (allPlayers[i2].POS == allyPosT){
allySocket = allPlayers[i2].ID;
};
};
};
i++;
};
if (allySocket != 0){
allyChat = true;
} else {
allyChat = false;
};
countTime.basic = this;
}
public function removeMPthings():void{
SocketManager.socket.removeEventListener(BlossomEvent.RECEIVE_MESSAGE, allyChatHandler);
gameRoom.addEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeftHandler);
TJ.removeEventListener(TimerEvent.TIMER, sendResInfo);
gameRoom.removeEventListener("createUnit", createUnitHandler);
gameRoom.removeEventListener("killUnit", killUnitHandler);
gameRoom.removeEventListener("orderUnit", orderHandler);
gameRoom.removeEventListener("createMissile", missileHandler);
gameRoom.removeEventListener("updateBuilding", buildingHandler);
gameRoom.removeEventListener("updateIncome", updateIncomeHandler);
gameRoom.removeEventListener("sendChat", sendChatHandler);
gameRoom.removeEventListener("sendExit", userExitHand);
gameRoom.removeEventListener("alignResource", alignResourceHand);
}
function frame87(){
removeChild(promptBox);
trace(stage.frameRate);
stage.frameRate = 30;
stage.addEventListener(Event.ACTIVATE, resetFocus);
stage.focus = this;
checkDom();
gameRunning = true;
iWon = false;
gameQuitable = true;
FONT = new MainFont2();
winSave = 0;
rankedMatch = true;
if (!singlePlayerMode){
addMPthings();
if (realUser){
if (rankedMatch){
userData.gamesPlayed++;
winSave = userData.gamesConsecutiveWins;
userData.gamesConsecutiveWins = 0;
vars2 = new Object();
vars2.userData = userData;
SocketManager.socket.setUserVars(vars2);
};
};
};
GameKon = new gameKon();
gameRun = true;
GameKon.setData(stage, this);
GameKon.runData();
buildBar.visible = false;
displayKon.liftRestri();
DisplayKon = new displayKon();
DisplayField = new Sprite();
addChildAt(DisplayField, 0);
GD3 = new groundDisplay3();
addChildAt(GD3, 0);
DisplayField.x = 0;
mainPosY = (DisplayField.y = 120);
unitDisplay = new Sprite();
DisplayField.addChild(unitDisplay);
effectsDisplay = new Sprite();
DisplayField.addChild(effectsDisplay);
screenWidth = stage.stageWidth;
battleWidth = (stage.stageWidth * 2);
screenPoint = 0;
endPoint1 = 0;
endPoint2 = (battleWidth - screenWidth);
BaseKon = new baseKon();
secondLayer = new groundDisplay2();
DisplayField.addChildAt(new _groundDisplay(), 0);
DisplayField.addChildAt(secondLayer, 0);
DisplayField.addChildAt(BaseKon.BaseHolder, 2);
BaseKon.BaseHolder.x = (50 + (BaseKon.BaseHolder.width / 2));
BaseKon.BaseHolder.y = 140;
DisplayField.addChildAt(BaseKon.BaseHolder2, 2);
BaseKon.BaseHolder2.x = (battleWidth - (50 + (BaseKon.BaseHolder2.width / 2)));
BaseKon.BaseHolder2.y = 140;
DisplayField.x = -(screenPoint);
GameKon.player1 = new playerKon(0);
GameKon.player2 = new playerKon(0);
GameKon.player3 = new playerKon(0);
GameKon.player4 = new playerKon(0);
GameKon.player1.idTag = "p1_";
GameKon.player2.idTag = "p2_";
GameKon.player3.idTag = "p3_";
GameKon.player4.idTag = "p4_";
if (!singlePlayerMode){
GameKon.player1.cityColor = 1;
GameKon.player2.cityColor = 2;
GameKon.player3.cityColor = 3;
GameKon.player4.cityColor = 4;
vars = new Object();
vars.race = clientPlayer[0];
vars.pos = clientPlayer[1];
gameRoom.sendToRoom(vars, false, "updateIncome");
} else {
GameKon.player1.cityColor = 1;
GameKon.player2.cityColor = 2;
GameKon.player3.cityColor = 3;
GameKon.player4.cityColor = 4;
};
GameKon.player1.POS = 1;
GameKon.player2.POS = 2;
GameKon.player3.POS = 3;
GameKon.player4.POS = 4;
if (musicOn){
musicKon.setTheme(clientPlayer[0]);
musicKon.startFader(0, 1);
};
playerControl = GameKon[("player" + clientPlayer[1])];
gameKon.playerNow = playerControl;
playerControl.setIncome(clientPlayer[0]);
if (singlePlayerMode){
playerControl.cityColor = clientPlayer[2];
};
if ((((playerControl == GameKon.player3)) || ((playerControl == GameKon.player4)))){
screenPoint = endPoint2;
DisplayField.x = -(screenPoint);
};
GameKon.assignBase();
GameKon.player1.team = (GameKon.player2.team = (GameKon.player3.eteam = (GameKon.player4.eteam = unitKon.Team1)));
GameKon.player1.eteam = (GameKon.player2.eteam = (GameKon.player3.team = (GameKon.player4.team = unitKon.Team2)));
unitKon.createBase(GameKon.player1, GameKon.player3);
addEventListener(Event.ENTER_FRAME, updateUI);
addEventListener(Event.ENTER_FRAME, screenScroll);
j = 0;
while (j < 9) {
this[("b" + j)].id = j;
this[("b" + j)].btn.visible = false;
j++;
};
b8.visible = false;
b8.btn.visible = true;
oi.visible = false;
boundLimit = 0.1;
minBound = Math.round((stage.stageWidth * boundLimit));
maxBound = Math.round((stage.stageWidth * (1 - boundLimit)));
mouseAccel = 1;
mouseMaxVel = 35;
mouseVel = 0;
winGame = false;
aiSetArray = new Array(GameKon.player1, GameKon.player2, GameKon.player3, GameKon.player4);
if (!singlePlayerMode){
switch (gameSet){
case 1:
optRestrict = new Array([8]);
break;
case 2:
optRestrict = new Array(8, 23);
break;
case 3:
optRestrict = new Array(13, 14, 16, 17, 18, 20, 21, 22, 24, 8, 38, 39, 43, 45, 46);
break;
case 4:
optRestrict = new Array(15, 47, 8, 23, 19);
break;
case 5:
optRestrict = new Array(33, 34, 8);
break;
default:
optRestrict = new Array();
break;
};
};
aiSingArray = new Array();
chatBody.chatOn = false;
trace("OK");
if (optRestrict.length > 0){
displayKon.restricted = true;
for (bh in optRestrict) {
displayKon.restrictArray.push(optRestrict[bh]);
};
};
if (singlePlayerMode){
switch (singleLevel){
case 1:
aiSingArray.push({isON:false, dif:0, be:0});
aiSingArray.push({isON:true, dif:2, be:0});
aiSingArray.push({isON:true, dif:1, be:1});
aiSingArray.push({isON:true, dif:1, be:0});
chatBody.init(1);
break;
case 2:
aiSingArray.push({isON:true, dif:1, be:99});
aiSingArray.push({isON:true, dif:1, be:99});
aiSingArray.push({isON:true, dif:1, be:99});
aiSingArray.push({isON:true, dif:1, be:99});
chatBody.init(0);
break;
case 3:
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
chatBody.init(0);
break;
case 4:
aiSingArray.push({isON:true, dif:3, be:99});
aiSingArray.push({isON:true, dif:3, be:99});
aiSingArray.push({isON:true, dif:3, be:99});
aiSingArray.push({isON:true, dif:3, be:99});
chatBody.init(0);
break;
case 5:
aiSingArray.push({isON:true, dif:4, be:99});
aiSingArray.push({isON:true, dif:4, be:99});
aiSingArray.push({isON:true, dif:4, be:99});
aiSingArray.push({isON:true, dif:4, be:99});
chatBody.init(0);
break;
case 6:
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:false, dif:1, be:1});
displayKon.restricted = true;
displayKon.restrictArray.push(3, 6, 7, 8, 9);
chatBody.init(2);
break;
case 7:
aiSingArray.push({isON:true, dif:1, be:5});
aiSingArray.push({isON:true, dif:1, be:0});
aiSingArray.push({isON:false, dif:0, be:0});
aiSingArray.push({isON:true, dif:1, be:3});
displayKon.restricted = true;
displayKon.restrictArray.push(2, 8, 34, 4, 46);
chatBody.init(3);
break;
case 8:
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:false, dif:2, be:0});
aiSingArray.push({isON:true, dif:1, be:5});
aiSingArray.push({isON:true, dif:1, be:3});
displayKon.restricted = true;
displayKon.restrictArray.push(3, 8);
chatBody.init(4);
break;
case 9:
aiSingArray.push({isON:true, dif:3, be:0});
aiSingArray.push({isON:true, dif:2, be:1});
aiSingArray.push({isON:false, dif:0, be:0});
aiSingArray.push({isON:true, dif:2, be:3});
displayKon.restricted = true;
displayKon.restrictArray.push(8);
chatBody.init(5);
break;
case 10:
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:true, dif:3, be:1});
aiSingArray.push({isON:true, dif:2, be:0});
aiSingArray.push({isON:true, dif:3, be:3});
displayKon.restricted = true;
displayKon.restrictArray.push(3, 4, 33);
chatBody.init(6);
break;
case 11:
aiSingArray.push({isON:false, dif:1, be:0});
aiSingArray.push({isON:true, dif:3, be:1});
aiSingArray.push({isON:true, dif:2, be:3});
aiSingArray.push({isON:true, dif:3, be:0});
displayKon.restricted = false;
chatBody.init(7);
break;
default:
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
aiSingArray.push({isON:true, dif:2, be:99});
chatBody.init(0);
break;
};
};
for (b in aiSetArray) {
if (singlePlayerMode){
if (aiSetArray[b] != playerControl){
if (aiSingArray[b].isON){
dif = aiSingArray[b].dif;
be = aiSingArray[b].be;
aiSetArray[b].startAi(0, dif, be);
};
};
} else {
if (roomMaster){
for (v2 in allPlayers) {
aiProfile = 0;
if (allPlayers[v2].NAME == "Easy CPU"){
aiProfile = 1;
};
if (allPlayers[v2].NAME == "Normal CPU"){
aiProfile = 2;
};
if (allPlayers[v2].NAME == "Hard CPU"){
aiProfile = 4;
};
if (((!((aiProfile == 0))) && ((allPlayers[v2].POS == (b + 1))))){
aiSetArray[b].startAi(allPlayers[v2].POS, aiProfile);
};
};
};
};
};
if (singlePlayerMode){
switch (singleLevel){
case 7:
mission2StartAi();
break;
default:
break;
};
};
addEventListener(MouseEvent.MOUSE_DOWN, beginDraw);
addEventListener(MouseEvent.MOUSE_UP, endDraw);
mouseLasso = new Sprite();
drawing = false;
addChild(mouseLasso);
ToolTip = new toolTip(stage, this);
addChild(ToolTip);
ToolTip.x = mouseX;
ToolTip.y = mouseY;
dragRect = new Rectangle(0, 0, 550, 530);
ToolTip.startDrag(false, dragRect);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyD);
stage.addEventListener(KeyboardEvent.KEY_UP, keyU);
stage.addEventListener(Event.DEACTIVATE, keyC);
screenGoLeft = false;
screenGoRight = false;
hotkeyArray = new Array(49, 50, 51, 52, 81, 87, 69, 82);
hotbutArray = new Array(b0, b1, b2, b3, b4, b5, b6, b7);
chatPanel.text = "";
uiGlow = new GlowFilter(2744852, 1, 7, 7, 0.62, 1, false, false);
uiGlowIn = new GlowFilter(14483141, 1, 15, 15, 10, 1, true, false);
uiGlowIn2 = new GlowFilter(8911994, 1, 4, 4, 1, 1, true, false);
updateUIOptions();
fg = 0;
while (fg < 6) {
uiLay[("bg_" + fg)].id = fg;
uiLay[("bg_" + fg)].theIcon.gotoAndStop((fg + 1));
fg++;
};
uiCombatTipOn = new Array();
uiCombatTipOn.push(new tipObject("Auto-Build: ON", 0, 0, 0, "If this is on, any option from a building that you click will try to repeat itself after it finishes. You can also toggle this by holding Shift."));
uiCombatTipOn.push(new tipObject("Rally Point: ON", 0, 0, 0, "Units will mobilize in front of the base after they have been deployed."));
uiCombatTipOn.push(new tipObject("Allied Chat: ON", 0, 0, 0, "Chat messages will only be sent to your ally."));
uiCombatTipOn.push(new tipObject("Sound: ON", 0, 0, 0, "Sound effects are on."));
uiCombatTipOn.push(new tipObject("Music: ON", 0, 0, 0, "Music is on."));
uiCombatTipOn.push(new tipObject("Quit", 0, 0, 0, "Exit the game."));
uiCombatTipOff = new Array();
uiCombatTipOff.push(new tipObject("Auto-Build: OFF", 0, 0, 0, "Any options you build from a building will not repeat itself. You can also toggle this by holding Shift."));
uiCombatTipOff.push(new tipObject("Rally Point: OFF", 0, 0, 0, "Units will attack as soon as they are deployed."));
uiCombatTipOff.push(new tipObject("Allied Chat: OFF", 0, 0, 0, "Chat messages will be sent to all players in the game."));
uiCombatTipOff.push(new tipObject("Sound: OFF", 0, 0, 0, "Sound effects are off."));
uiCombatTipOff.push(new tipObject("Music: OFF", 0, 0, 0, "Music is off."));
uiCombatTipOff.push(new tipObject("Quit", 0, 0, 0, "Exit the game."));
b8.addEventListener(MouseEvent.MOUSE_OVER, overText);
b8.addEventListener(MouseEvent.MOUSE_OUT, emptyText);
oi.addEventListener(MouseEvent.MOUSE_OVER, overText2);
oi.addEventListener(MouseEvent.MOUSE_OUT, emptyText);
cText = new tipObject("Cancel", 0, 0, 0, "Click to cancel this action. You will receive a full refund.");
}
function frame76(){
if ((((__setPropDict[button_mission] == undefined)) || (!((int(__setPropDict[button_mission]) == 76))))){
__setPropDict[button_mission] = currentFrame;
__setProp_button_mission_MENU_MENU_76();
};
if ((((__setPropDict[button_link] == undefined)) || (!((int(__setPropDict[button_link]) == 76))))){
__setPropDict[button_link] = currentFrame;
__setProp_button_link_MENU_MENU_76();
};
if ((((__setPropDict[button_multi] == undefined)) || (!((int(__setPropDict[button_multi]) == 76))))){
__setPropDict[button_multi] = currentFrame;
__setProp_button_multi_MENU_MENU_76();
};
if ((((__setPropDict[button_single] == undefined)) || (!((int(__setPropDict[button_single]) == 76))))){
__setPropDict[button_single] = currentFrame;
__setProp_button_single_MENU_MENU_76();
};
stop();
optRestrict = new Array();
if (DCTRUE == true){
dataTracer.showTracer();
dataTracer.update(DCLINE);
};
missionLevel = 1;
storySetter = 0;
missionOn = false;
missionGo = true;
button_single.setStyle("textFormat", tf);
button_multi.setStyle("textFormat", tf);
button_mission.setStyle("textFormat", tf);
button_link.setStyle("textFormat", tf);
button_link.addEventListener(MouseEvent.CLICK, getAGURL, false, 0, true);
button_single.addEventListener(MouseEvent.MOUSE_UP, startSinglePlayer, false, 0, true);
button_multi.addEventListener(MouseEvent.MOUSE_UP, startMultiPlayer, false, 0, true);
button_mission.addEventListener(MouseEvent.MOUSE_UP, startMissionPlayer, false, 0, true);
DCTRUE = false;
remotePlayerArray = new Array(false, false, false, false);
allPlayers = new Array();
singleLevel = 0;
tutLev = false;
}
function frame80(){
switch (storySetter){
case 0:
comicLoad = new comic_0();
break;
case 1:
comicLoad = new comic_1();
break;
case 2:
comicLoad = new comic_2();
break;
case 3:
comicLoad = new comic_3();
break;
case 4:
comicLoad = new comic_4();
break;
case 5:
comicLoad = new comic_5();
break;
case 6:
comicLoad = new comic_6();
break;
case 7:
comicLoad = new comic_7();
break;
case 8:
comicLoad = new comic_8();
break;
case 9:
comicLoad = new comic_9();
break;
case 10:
comicLoad = new comic_10();
break;
case 11:
comicLoad = new comic_11();
break;
};
addChild(comicLoad);
comicLoad.y = 180;
comicLoad.gotoAndStop(1);
comicPage = 1;
comicPageMax = comicLoad.totalFrames;
mis_beg.visible = false;
mis_next.visible = true;
mis_next.addEventListener(MouseEvent.CLICK, nextComic);
}
public function alignResourceHand(be:BlossomEvent):void{
var player:*;
var pRA:Array;
var gj:*;
player = GameKon[("player" + be.data.pos)];
pRA = new Array(player.r_m, player.r_p, player.r_e, player.r_i);
for (gj in be.data.resArray) {
if (pRA[gj] < be.data.resArray[gj]){
player.addRes(pRA, 1);
};
};
}
public function gotoStory(a:uint, b:uint):void{
storySetter = a;
missionLevel = b;
singlePlayerMode = true;
singleLevel = (b + 5);
missionGo = true;
missionOn = true;
gotoAndStop("Story", "STORY");
}
public function playGame(Event:MouseEvent):void{
if (validDomain){
button_play.removeEventListener(MouseEvent.MOUSE_UP, playGame);
removeChild(adBox);
stage.frameRate = 30;
play();
} else {
gotoAndStop("Lock", "LOCK");
};
}
public function receiveUserVarsHandler(be:BlossomEvent):void{
var vars:Object;
dataTracer.hideTracer();
if (be.vars.userData == null){
vars = new Object();
vars.userData = userData;
SocketManager.socket.setUserVars(vars);
} else {
userData = be.vars.userData;
};
if (be.vars.ignoreList == null){
vars = new Object();
vars.ignoreList = ignoreList;
SocketManager.socket.setUserVars(vars);
} else {
ignoreList = be.vars.ignoreList;
};
if (be.vars.userRace == null){
vars = new Object();
vars.userRace = userRace;
SocketManager.socket.setUserVars(vars);
} else {
userRace = be.vars.userRace;
};
trace(("Race: " + userRace));
if (be.vars.friendList == null){
vars = new Object();
vars.friendList = friendList;
SocketManager.socket.setUserVars(vars);
} else {
friendList = be.vars.friendList;
};
dataTracer.progressing = false;
killAllEvents();
gotoAndStop("mpLobby", "MPLOBBY");
}
function __setProp_j_server1_MENU_MENU_79(){
j_server1["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
j_server1.emphasized = false;
j_server1.enabled = true;
j_server1.label = "";
j_server1.labelPlacement = "right";
j_server1.selected = false;
j_server1.toggle = false;
j_server1.visible = true;
j_server1["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame88(){
if ((((__setPropDict[button_res] == undefined)) || (!((int(__setPropDict[button_res]) == 88))))){
__setPropDict[button_res] = currentFrame;
__setProp_button_res_POST_Layer1_88();
};
if (winGame){
if ((((missionMax == missionLevel)) && ((missionMax < 6)))){
missionMax++;
saveGame.data.al = missionMax;
saveGame.flush();
};
shower.text = "VICTORY";
removeChild(d_screen);
d_screen.stop();
d_screen.visible = false;
d_screen = null;
} else {
shower.text = "DEFEAT";
removeChild(v_screen);
v_screen.stop();
v_screen.visible = false;
v_screen = null;
};
button_res.addEventListener(MouseEvent.MOUSE_UP, restart, false, 0, true);
}
public function loginSuccessHandler(be:BlossomEvent):void{
var moderator:Boolean;
var varList:Array;
userID = be.userID;
MP_userName = be.userName;
moderator = be.moderator;
realUser = true;
dataTracer.update("Success! Retrieving data...");
varList = new Array("userData", "userRace");
SocketManager.socket.getUserVars(varList, SocketManager.socket.socketID);
SocketManager.socket.addEventListener(BlossomEvent.RECEIVE_USER_VARS, receiveUserVarsHandler, false, 0, true);
}
function __setProp_button_multi_MENU_MENU_76(){
button_multi["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
button_multi.emphasized = false;
button_multi.enabled = true;
button_multi.label = "Multi Player";
button_multi.labelPlacement = "right";
button_multi.selected = false;
button_multi.toggle = false;
button_multi.visible = true;
button_multi["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame82(){
if ((((__setPropDict[reMe] == undefined)) || (!((int(__setPropDict[reMe]) == 82))))){
__setPropDict[reMe] = currentFrame;
__setProp_reMe_MPCONNECT_Go_82();
};
if ((((__setPropDict[but_register] == undefined)) || (!((int(__setPropDict[but_register]) == 82))))){
__setPropDict[but_register] = currentFrame;
__setProp_but_register_MPCONNECT_Go_82();
};
if ((((__setPropDict[but_exit] == undefined)) || (!((int(__setPropDict[but_exit]) == 82))))){
__setPropDict[but_exit] = currentFrame;
__setProp_but_exit_MPCONNECT_Go_82();
};
if ((((__setPropDict[but_guest] == undefined)) || (!((int(__setPropDict[but_guest]) == 82))))){
__setPropDict[but_guest] = currentFrame;
__setProp_but_guest_MPCONNECT_Go_82();
};
if ((((__setPropDict[but_login] == undefined)) || (!((int(__setPropDict[but_login]) == 82))))){
__setPropDict[but_login] = currentFrame;
__setProp_but_login_MPCONNECT_Go_82();
};
if (justReg){
in_name.text = regName;
in_pass.text = regPass;
justReg = false;
addChild(DataTracer);
dataTracer.update("The account registration was a grand success! Now you may log in to play.");
};
tfRe = new TextFormat();
tfRe.font = T.fontName;
tfRe.color = 0x999999;
tfRe.size = 12;
reMe.setStyle("textFormat", tfRe);
reMe.addEventListener(MouseEvent.CLICK, remMeHand, false, 0, true);
but_login.addEventListener(MouseEvent.CLICK, b_loginHand, false, 0, true);
but_register.addEventListener(MouseEvent.CLICK, b_registerHand, false, 0, true);
but_guest.addEventListener(MouseEvent.CLICK, b_guestHand, false, 0, true);
but_exit.addEventListener(MouseEvent.CLICK, b_exitHand, false, 0, true);
but_login.setStyle("textFormat", tf);
but_register.setStyle("textFormat", tf);
but_guest.setStyle("textFormat", tf);
but_exit.setStyle("textFormat", tf);
if (rememberMe){
in_name.text = sav_user;
in_pass.text = sav_pass;
reMe.selected = true;
};
userData = new Object();
friendList = new Array();
ignoreList = new Array();
userRace = 2;
userData.gamesPlayed = 0;
userData.gamesWon = 0;
userData.gamesConsecutiveWins = 0;
userData.rank = 1;
userData.pts = 0;
userData.awards = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
realUser = false;
rankLimit = new Array(100, 500, 1500, 3000);
}
public function beginDraw(event:MouseEvent):void{
if (mouseY <= 400){
setRectx = mouseX;
setRecty = mouseY;
addEventListener(Event.ENTER_FRAME, doDraw);
};
}
function __setProp_butmis_1_MENU_MENU_78(){
butmis_1["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_1.emphasized = false;
butmis_1.enabled = true;
butmis_1.label = "Mission 1";
butmis_1.labelPlacement = "right";
butmis_1.selected = false;
butmis_1.toggle = false;
butmis_1.visible = true;
butmis_1["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame89(){
stop();
bbLock.addEventListener(MouseEvent.CLICK, getAGURL);
}
function __setProp_but_exit2_MPCONNECT_Go_83(){
but_exit2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_exit2.emphasized = false;
but_exit2.enabled = true;
but_exit2.label = "Exit to Menu";
but_exit2.labelPlacement = "right";
but_exit2.selected = false;
but_exit2.toggle = false;
but_exit2.visible = true;
but_exit2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_sxB_1_MENU_MENU_77(){
sxB_1["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
sxB_1.emphasized = false;
sxB_1.enabled = true;
sxB_1.label = "Tutorial Level";
sxB_1.labelPlacement = "right";
sxB_1.selected = false;
sxB_1.toggle = false;
sxB_1.visible = true;
sxB_1["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_butmis_6_MENU_MENU_78(){
butmis_6["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_6.emphasized = false;
butmis_6.enabled = true;
butmis_6.label = "Mission 6";
butmis_6.labelPlacement = "right";
butmis_6.selected = false;
butmis_6.toggle = false;
butmis_6.visible = true;
butmis_6["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_xb_back3_MENU_MENU_79(){
xb_back3["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
xb_back3.emphasized = false;
xb_back3.enabled = true;
xb_back3.label = "Exit to Menu";
xb_back3.labelPlacement = "right";
xb_back3.selected = false;
xb_back3.toggle = false;
xb_back3.visible = true;
xb_back3["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function PL_LOADING(event:ProgressEvent):void{
var pcent:Number;
var loadPer:Number;
var iii2:*;
pcent = (event.bytesLoaded / event.bytesTotal);
loadPer = Math.round((2009 + (pcent * 264)));
dateMC.t.text = loadPer;
for (iii2 in josefArray) {
if (josefArray[iii2].D < loadPer){
josefArray[iii2].oj.visible = true;
};
};
loadBar.bar.width = (mW * pcent);
dateMC.x = (120.6 + loadBar.bar.width);
if (pcent >= 0.99){
completedTheLoad();
};
}
public function keyD(event:KeyboardEvent):void{
var juh:*;
var vars:Object;
if (event.keyCode == 27){
stage.focus = this;
chatHider.visible = true;
chatPanel.text = "";
};
if (event.keyCode == 16){
gameKon.shiftToggle = true;
updateUIOptions();
};
if (stage.focus == this){
if (event.keyCode == 88){
if (gameKon.rallyOn){
gameKon.rallyOn = false;
} else {
gameKon.rallyOn = true;
};
updateUIOptions();
};
if (event.keyCode == 67){
if (allyChat){
allyChat = false;
chatToWho.text = "To All:";
} else {
allyChat = true;
chatToWho.text = "To Ally:";
};
updateUIOptions();
};
for (juh in hotkeyArray) {
if (event.keyCode == hotkeyArray[juh]){
if (gameKon.selectedBuilding.ownBy == gameKon.playerNow){
hotbutArray[juh].doReal();
};
};
};
if ((((event.keyCode == 37)) || ((event.keyCode == 65)))){
screenGoLeft = true;
};
if ((((event.keyCode == 39)) || ((event.keyCode == 68)))){
screenGoRight = true;
};
};
if (event.keyCode == 13){
if (stage.focus == chatPanel){
stage.focus = this;
chatHider.visible = true;
if (((!((chatPanel.text == ""))) && (!((chatPanel.text == "< Type here or press Enter to chat >"))))){
chatBody.dealWith(chatPanel.text);
if (singlePlayerMode){
doChat(chatPanel.text, playerName, clientPlayer[2]);
chatPanel.text = "";
} else {
vars = new Object();
vars.i = clientPlayer[1];
vars.t = chatPanel.text;
if (!allyChat){
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "sendChat");
} else {
SocketManager.socket.sendToUser(SocketManager.socket.socketID, vars);
if (allySocket != 0){
SocketManager.socket.sendToUser(allySocket, vars);
};
};
chatPanel.text = "";
};
} else {
chatPanel.text = "";
};
} else {
stage.focus = chatPanel;
if (allyChat){
chatToWho.text = "To Ally:";
} else {
chatToWho.text = "To All:";
};
chatHider.visible = false;
};
};
}
public function b_exitHand(e:MouseEvent):void{
dataTracer.suppress();
SocketManager.close();
gotoAndStop("START", "MENU");
}
public function getAGURL(me:MouseEvent):void{
var urlAGL:String;
var reqAGL:URLRequest;
var me = me;
urlAGL = "http://ArmorGames.com";
reqAGL = new URLRequest(urlAGL);
navigateToURL(reqAGL, "_blank");
//unresolved jump
var _slot1 = e;
}
public function keyC(event:Event):void{
gameKon.shiftToggle = false;
screenGoRight = false;
screenGoLeft = false;
}
public function buildingHandler(be:BlossomEvent):void{
var player:*;
var traceBuild:*;
player = GameKon[("player" + be.data.pos)];
traceBuild = gameKon.buildingArray[be.data.building];
gameKon.doOption(optionData.LIST[be.data.buildId], be.data.cancelOrder, be.data.auto, player, traceBuild, true);
}
public function keyU(event:KeyboardEvent):void{
if (event.keyCode == 16){
gameKon.shiftToggle = false;
updateUIOptions();
};
if ((((event.keyCode == 37)) || ((event.keyCode == 65)))){
screenGoLeft = false;
};
if ((((event.keyCode == 39)) || ((event.keyCode == 68)))){
screenGoRight = false;
};
}
public function terminateGame(event:MouseEvent):void{
removeChild(promptBox);
promptBox.b3.removeEventListener(MouseEvent.CLICK, terminateGame);
tg();
gotoAndStop("END", "POST");
}
public function restart(Event:MouseEvent):void{
if (singlePlayerMode){
if (missionOn){
gotoAndPlay("OutOf2", "MENU");
} else {
gotoAndPlay("OutOf", "MENU");
};
} else {
gotoAndStop("mpLobby", "MPLOBBY");
};
}
function __setProp_xb_back_MENU_MENU_77(){
xb_back["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
xb_back.emphasized = false;
xb_back.enabled = true;
xb_back.label = "Exit to Menu";
xb_back.labelPlacement = "right";
xb_back.selected = false;
xb_back.toggle = false;
xb_back.visible = true;
xb_back["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function loginErrorHandler(be:BlossomEvent):void{
dataTracer.update(("Error logging in: " + be.error));
dataTracer.progressing = false;
}
public function startMissionPlayer(Event:MouseEvent):void{
singlePlayerMode = true;
gotoAndStop("MISSION", "MENU");
}
public function endComic(me:MouseEvent):void{
mis_beg.removeEventListener(MouseEvent.CLICK, endComic);
endComicMode();
}
public function screenScroll(event:Event):void{
var screenSurrond:Number;
if ((((((mouseY <= 400)) && ((mouseX < minBound)))) || (screenGoLeft))){
if (screenPoint > endPoint1){
mouseVel = (mouseVel - mouseAccel);
if (mouseVel < -(mouseMaxVel)){
mouseVel = -(mouseMaxVel);
};
} else {
mouseVel = 0;
};
} else {
if ((((((mouseY <= 400)) && ((mouseX > maxBound)))) || (screenGoRight))){
if (screenPoint < endPoint2){
mouseVel = (mouseVel + mouseAccel);
if (mouseVel > mouseMaxVel){
mouseVel = mouseMaxVel;
};
} else {
mouseVel = 0;
};
} else {
if (mouseVel !== 0){
mouseVel = (mouseVel - (mouseAccel * (mouseVel / Math.abs(mouseVel))));
};
};
};
screenPoint = (screenPoint + mouseVel);
if (screenPoint > endPoint2){
screenPoint = endPoint2;
};
if (screenPoint < endPoint1){
screenPoint = endPoint1;
};
DisplayField.x = -(screenPoint);
screenSurrond = ((2 * (screenPoint / (endPoint2 - endPoint1))) - 1);
soundKon.surround(screenSurrond);
secondLayer.x = (screenPoint / 2);
GD3.x = (-(screenPoint) / 4);
}
function __setProp_button_single_MENU_MENU_76(){
button_single["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
button_single.emphasized = false;
button_single.enabled = true;
button_single.label = "Quick Play";
button_single.labelPlacement = "right";
button_single.selected = false;
button_single.toggle = false;
button_single.visible = true;
button_single["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function registerErrorHandler(be:BlossomEvent):void{
dataTracer.progressing = false;
SocketManager.socket.removeEventListener(BlossomEvent.REGISTER_SUCCESS, registerSuccessHandler);
SocketManager.socket.removeEventListener(BlossomEvent.REGISTER_ERROR, registerErrorHandler);
dataTracer.update(("Error registering: " + be.error));
}
public function b_registerHand(e:MouseEvent):void{
killAllEvents();
gotoAndStop("mpRegister", "MPCONNECT");
}
function __setProp_but_register_MPCONNECT_Go_82(){
but_register["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_register.emphasized = false;
but_register.enabled = true;
but_register.label = "Register";
but_register.labelPlacement = "right";
but_register.selected = false;
but_register.toggle = false;
but_register.visible = true;
but_register["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function tg():void{
if (musicOn == true){
musicKon.startFader(0, 2);
};
if (gameKon.playerNow.team == teamWin){
winGame = true;
} else {
winGame = false;
};
chatBody.killAll();
removeEventListener(Event.ENTER_FRAME, updateUI);
removeEventListener(Event.ENTER_FRAME, screenScroll);
removeEventListener(MouseEvent.MOUSE_DOWN, beginDraw);
removeEventListener(MouseEvent.MOUSE_UP, endDraw);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyD);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyU);
stage.removeEventListener(Event.DEACTIVATE, keyC);
stage.removeEventListener(Event.ACTIVATE, resetFocus);
if (!singlePlayerMode){
removeMPthings();
SocketManager.socket.leaveRoom(gameRoom.roomName);
};
gameQuitable = true;
GameKon.killAll();
GameKon.stopData();
removeChild(GD3);
DisplayField.removeChild(secondLayer);
DisplayField.removeChild(unitDisplay);
DisplayField.removeChild(effectsDisplay);
removeChild(DisplayField);
DisplayField = null;
unitDisplay = null;
effectsDisplay = null;
GameKon = null;
}
function __setProp_butmis_4_MENU_MENU_78(){
butmis_4["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_4.emphasized = false;
butmis_4.enabled = true;
butmis_4.label = "Mission 4";
butmis_4.labelPlacement = "right";
butmis_4.selected = false;
butmis_4.toggle = false;
butmis_4.visible = true;
butmis_4["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function doChat(t:String, n:String, c:uint){
var chatText:TextField;
var chatFormat:TextFormat;
var i:*;
soundKon.playSound(3, 3, true);
soundKon.playSound(3, 3, false);
chatText = new TextField();
chatText.htmlText = ((((((("<font color='#FFFFFF'>" + n) + ": </font> ") + "<font color='#") + colorChat[c]) + "'>") + t) + "</font>");
chatFormat = new TextFormat();
chatText.width = 0x0100;
chatText.embedFonts = true;
chatText.autoSize = TextFieldAutoSize.LEFT;
chatText.multiline = true;
chatText.wordWrap = true;
chatFormat.font = FONT.fontName;
chatFormat.size = 14;
chatText.setTextFormat(chatFormat);
chatBox.innerBox.addChildAt(chatText, 0);
chatText.y = 0;
i = 0;
while (i < chatBox.innerBox.numChildren) {
chatBox.innerBox.getChildAt(i).y = (chatBox.innerBox.getChildAt(i).y - chatText.height);
i++;
};
if (chatBox.innerBox.numChildren > 25){
chatBox.innerBox.removeChildAt(25);
};
chatBox.maxY = chatBox.innerBox.height;
chatBox.innerBox.y = chatBox.minY;
chatBox.updateNavBar();
}
public function createUnitHandler(be:BlossomEvent):void{
var player:*;
var def:Number;
var cArDef:Array;
var nhj:*;
var ayt:Boolean;
var vars:Object;
var i2:*;
var i3:*;
player = GameKon[("player" + be.data.pos)];
player.createGap++;
def = 0;
trace(("CREATE GAP " + player.createGap));
cArDef = new Array(player.r_m, player.r_p, player.r_e, player.r_i);
for (nhj in cArDef) {
trace(cArDef[nhj]);
if (cArDef[nhj] < 0){
def = (def - cArDef[nhj]);
};
};
if (player.createGap < 15){
ayt = true;
if ((((def < 50)) || (ayt))){
unitKon.addUnit(player, be.data.id, false, be.data.unitId, be.data.rand1, be.data.rand2, be.data.rand3);
} else {
vars = new Object();
vars.def = true;
for (i2 in allPlayers) {
if (allPlayers[i2].POS == player.POS){
for (i3 in player.team.all) {
if (((!((i3 == 0))) && ((player.team.all[i3].player == player)))){
unitKon.killOffUnit(player.team.all[i3].unitId, null);
};
};
SocketManager.socket.sendToUser(allPlayers[i2].ID, vars);
if (player.hackSend){
doChat((allPlayers[i2].NAME + " has been detected hacking."), "System", 0);
player.hackSend = false;
};
};
};
};
} else {
vars = new Object();
vars.def = true;
for (i2 in allPlayers) {
if (allPlayers[i2].POS == player.POS){
for (i3 in player.team.all) {
if (((!((i3 == 0))) && ((player.team.all[i3].player == player)))){
unitKon.killOffUnit(player.team.all[i3].unitId, null);
};
};
SocketManager.socket.sendToUser(allPlayers[i2].ID, vars);
if (player.hackSend){
doChat((allPlayers[i2].NAME + " has been detected hacking."), "System", 0);
player.hackSend = false;
};
};
};
};
}
public function gotoMission2(me:MouseEvent):void{
playerName = "Jetzul";
clientPlayer = new Array(0, 3, 3);
gotoStory(1, 2);
}
public function gotoMission4(me:MouseEvent):void{
playerName = "Jetzul";
clientPlayer = new Array(0, 3, 3);
gotoStory(3, 4);
}
public function gotoMission5(me:MouseEvent):void{
playerName = "Cpt. Baylet";
clientPlayer = new Array(2, 1, 1);
gotoStory(4, 5);
}
public function gotoMission6(me:MouseEvent):void{
playerName = "Moston";
clientPlayer = new Array(1, 1, 1);
gotoStory(5, 6);
}
public function gotoMission1(me:MouseEvent):void{
playerName = "Cpt. Baylet";
clientPlayer = new Array(2, 1, 1);
gotoStory(0, 1);
}
public function gotoMission3(me:MouseEvent):void{
playerName = "Cpt. Baylet";
clientPlayer = new Array(2, 1, 1);
gotoStory(2, 3);
}
public function quitTheGame():void{
if (((gameRunning) && (gameQuitable))){
promptBox.p.text = "Are you sure you want to quit?";
gameQuitable = false;
addChild(promptBox);
promptBox.b3.visible = false;
promptBox.b1.visible = true;
promptBox.b2.visible = true;
promptBox.b1.p.text = "YES";
promptBox.b2.p.text = "NO";
promptBox.b1.addEventListener(MouseEvent.CLICK, terminateGame);
promptBox.b2.addEventListener(MouseEvent.CLICK, backToGame);
};
}
public function adjustName(a:String){
if (a == "NONE"){
return ("None");
};
if (a == "COMPUTER1"){
return ("Easy CPU");
};
if (a == "COMPUTER2"){
return ("Normal CPU");
};
if (a == "COMPUTER3"){
return ("Hard CPU");
};
return (a);
}
public function allyChatHandler(be:BlossomEvent):void{
if (be.data.t != null){
gogoChat(be.data.i, be.data.t);
};
if (be.data.def){
dataTracer.DC(jum);
};
}
function __setProp_sxB_4_MENU_MENU_77(){
sxB_4["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
sxB_4.emphasized = false;
sxB_4.enabled = true;
sxB_4.label = "Hard";
sxB_4.labelPlacement = "right";
sxB_4.selected = false;
sxB_4.toggle = false;
sxB_4.visible = true;
sxB_4["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function b_guestHand(e:MouseEvent):void{
var letterArr:Array;
var bah:String;
killAllEvents();
letterArr = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
bah = letterArr[Math.round((Math.random() * (letterArr.length - 1)))];
MP_userName = (("Guest_" + bah) + Math.round((Math.random() * 9999)));
gotoAndStop("mpLobby", "MPLOBBY");
}
public function endTheGame():void{
var vars2:Object;
if (gameRunning){
if (realUser){
if (!singlePlayerMode){
if (rankedMatch){
userData.pts = (userData.pts + 10);
if (iWon){
userData.pts = (userData.pts + 20);
userData.gamesWon++;
userData.gamesConsecutiveWins = (winSave + 1);
if (userData.gamesConsecutiveWins > 3){
userData.pts = (userData.pts + ((userData.gamesConsecutiveWins - 3) * 15));
};
if (userData.rank < 5){
if (userData.pts >= rankLimit[(userData.rank - 1)]){
userData.rank++;
};
};
};
vars2 = new Object();
vars2.userData = userData;
SocketManager.socket.setUserVars(vars2);
};
};
};
promptBox.p.text = "The game has ended.";
removeChild(promptBox);
//unresolved jump
var _slot1 = e;
addChild(promptBox);
promptBox.b3.visible = true;
promptBox.b1.visible = false;
promptBox.b2.visible = false;
promptBox.b3.p.text = "CONTINUE";
promptBox.b3.addEventListener(MouseEvent.CLICK, terminateGame);
gameRunning = false;
};
}
public function stopTheJoin(e:chatEvent):void{
MP_r2j = false;
stage.removeEventListener("CLOSETRACER", stopTheJoin);
}
public function startSinglePlayer(Event:MouseEvent):void{
singlePlayerMode = true;
nextFrame();
}
public function uiCombatBut(id:uint):void{
switch (id){
case 0:
if (gameKon.shiftToggle){
gameKon.shiftToggle = false;
} else {
gameKon.shiftToggle = true;
};
break;
case 1:
if (gameKon.rallyOn){
gameKon.rallyOn = false;
} else {
gameKon.rallyOn = true;
};
break;
case 2:
if (allyChat){
allyChat = false;
chatToWho.text = "To All:";
} else {
allyChat = true;
chatToWho.text = "To Ally:";
};
break;
case 3:
if (soundOn){
soundOn = false;
soundKon.soundOn = false;
} else {
soundOn = true;
soundKon.soundOn = true;
};
break;
case 4:
if (musicOn){
musicOn = false;
musicKon.startFader(0.02, 2);
} else {
musicOn = true;
musicKon.startFader(0, 1);
};
break;
case 5:
quitTheGame();
break;
default:
break;
};
updateUIOptions();
toolTip.unTip();
combatUiTT(id);
}
public function killUnitHandler(be:BlossomEvent):void{
var pKiller:playerKon;
var be = be;
if (be.data.p > 0){
pKiller = GameKon[("player" + be.data.p)];
trace(("Kill Random " + be.data.ran));
unitKon.killOffUnit(be.data.id, pKiller, be.data.ran);
} else {
unitKon.killOffUnit(be.data.id, null);
};
//unresolved jump
var _slot1 = e;
}
function __setProp_but_register2_MPCONNECT_Go_83(){
but_register2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_register2.emphasized = false;
but_register2.enabled = true;
but_register2.label = "Register";
but_register2.labelPlacement = "right";
but_register2.selected = false;
but_register2.toggle = false;
but_register2.visible = true;
but_register2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function updateUIOptions():void{
var fg:*;
var butOn:Boolean;
fg = 0;
while (fg < 6) {
butOn = false;
switch (fg){
case 0:
if (gameKon.shiftToggle){
butOn = true;
};
break;
case 1:
if (gameKon.rallyOn){
butOn = true;
};
break;
case 2:
if (allyChat){
butOn = true;
};
break;
case 3:
if (soundOn){
butOn = true;
};
break;
case 4:
if (musicOn){
butOn = true;
};
break;
case 5:
break;
default:
break;
};
if (butOn){
uiLay[("bg_" + fg)].theIcon.filters = new Array(uiGlowIn, uiGlowIn2, uiGlow);
} else {
uiLay[("bg_" + fg)].theIcon.filters = [];
};
fg++;
};
}
function __setProp_but_exit_MPCONNECT_Go_82(){
but_exit["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
but_exit.emphasized = false;
but_exit.enabled = true;
but_exit.label = "Exit to Menu";
but_exit.labelPlacement = "right";
but_exit.selected = false;
but_exit.toggle = false;
but_exit.visible = true;
but_exit["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function connected(be:BlossomEvent):void{
if (MP_r2j){
SocketManager.socket.getStats();
dataTracer.update("Getting Server Status...");
SocketManager.socket.addEventListener(BlossomEvent.RECEIVE_STATS, receiveStatsHandler);
};
}
public function checkDom():void{
url2 = stage.loaderInfo.url;
urlStart = (url2.indexOf("://") + 3);
urlEnd = url2.indexOf("/", urlStart);
domain = url2.substring(urlStart, urlEnd);
LastDot = (domain.lastIndexOf(".") - 1);
domEnd = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
validDomain = ((("armorgames.com" == domain)) || (("" == domain)));
if (!validDomain){
gotoAndStop("Lock", "LOCK");
};
}
function __setProp_button_link_MENU_MENU_76(){
button_link["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
button_link.emphasized = false;
button_link.enabled = true;
button_link.label = "Play More Games";
button_link.labelPlacement = "right";
button_link.selected = false;
button_link.toggle = false;
button_link.visible = true;
button_link["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function nextComic(me:MouseEvent):void{
comicPage++;
comicLoad.nextFrame();
if (comicPage == comicPageMax){
mis_next.visible = false;
mis_beg.visible = true;
mis_next.removeEventListener(MouseEvent.CLICK, nextComic);
mis_beg.addEventListener(MouseEvent.CLICK, endComic);
};
}
public function updateIncomeHandler(be:BlossomEvent):void{
var player:*;
player = GameKon[("player" + be.data.pos)];
player.setIncome(be.data.race);
gameRoom.removeEventListener("updateIncome", updateIncomeHandler);
}
public function runShake(e:Event):void{
shakeNow = (shakeNow + shakeOsci);
shakeStr = (shakeStr / shakeDecay);
if (shakeStr < 0.5){
shakeStr = 0;
stage.removeEventListener(Event.ENTER_FRAME, runShake);
DisplayField.y = mainPosY;
} else {
DisplayField.y = (mainPosY + (shakeStr * Math.sin(shakeNow)));
};
}
function __setProp_butmis_2_MENU_MENU_78(){
butmis_2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
butmis_2.emphasized = false;
butmis_2.enabled = true;
butmis_2.label = "Mission 2";
butmis_2.labelPlacement = "right";
butmis_2.selected = false;
butmis_2.toggle = false;
butmis_2.visible = true;
butmis_2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function missileHandler(be:BlossomEvent):void{
unitKon.addMissile(be.data.tar, be.data.px, be.data.py);
}
public function gogoChat(id:uint, it:String):void{
var i:*;
var chat_pColor:*;
var chat_pName:*;
for (i in allPlayers) {
if (allPlayers[i].POS == id){
chat_pName = allPlayers[i].NAME;
};
};
chat_pColor = id;
doChat(it, chat_pName, chat_pColor);
}
public function registerSuccessHandler(be:BlossomEvent):void{
dataTracer.progressing = false;
SocketManager.socket.removeEventListener(BlossomEvent.REGISTER_SUCCESS, registerSuccessHandler);
SocketManager.socket.removeEventListener(BlossomEvent.REGISTER_ERROR, registerErrorHandler);
removeChild(DataTracer);
justReg = true;
regName = re_name.text;
regPass = re_pass.text;
gotoAndStop("mpLogin", "MPCONNECT");
}
function __setProp_button_mission_MENU_MENU_76(){
button_mission["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
button_mission.emphasized = false;
button_mission.enabled = true;
button_mission.label = "Campaign Mode";
button_mission.labelPlacement = "right";
button_mission.selected = false;
button_mission.toggle = false;
button_mission.visible = true;
button_mission["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function remMeHand(me:MouseEvent):void{
if (reMe.selected){
rememberMe = true;
sav_user = in_name.text;
sav_pass = in_pass.text;
} else {
rememberMe = false;
};
saveGame.data.sav_user = sav_user;
saveGame.data.sav_pass = sav_pass;
saveGame.data.rememberMe = rememberMe;
saveGame.flush();
}
public function s_Con0(me:MouseEvent):void{
startMpConnect(0);
}
public function s_Con1(me:MouseEvent):void{
startMpConnect(1);
}
function __setProp_sxB_2_MENU_MENU_77(){
sxB_2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
sxB_2.emphasized = false;
sxB_2.enabled = true;
sxB_2.label = "Easy";
sxB_2.labelPlacement = "right";
sxB_2.selected = false;
sxB_2.toggle = false;
sxB_2.visible = true;
sxB_2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function startMpConnect(a:uint):void{
var serverGo:String;
serverGo = onlineServers[a];
SocketManager.connect(serverGo);
SocketManager.socket.addEventListener(BlossomEvent.RECEIVE_SOCKET_ID, connected, false, 0, true);
dataTracer.progressing = false;
stage.addEventListener("CLOSETRACER", stopTheJoin, false, 0, true);
addChild(DataTracer);
MP_r2j = true;
}
public function userExitHand(be:BlossomEvent):void{
tg();
}
public function upUIHand():void{
r_p.text = playerControl.r_p;
r_m.text = playerControl.r_m;
r_e.text = playerControl.r_e;
r_i.text = playerControl.r_i;
r_p2.text = ("" + GameKon.player2.r_p);
r_m2.text = ("" + GameKon.player2.r_m);
r_e2.text = ("" + GameKon.player2.r_e);
r_i2.text = ("" + GameKon.player2.r_i);
r_p3.text = ("" + GameKon.player3.r_p);
r_m3.text = ("" + GameKon.player3.r_m);
r_e3.text = ("" + GameKon.player3.r_e);
r_i3.text = ("" + GameKon.player3.r_i);
r_p4.text = ("" + GameKon.player4.r_p);
r_m4.text = ("" + GameKon.player4.r_m);
r_e4.text = ("" + GameKon.player4.r_e);
r_i4.text = ("" + GameKon.player4.r_i);
}
public function b_registerHand2(e:MouseEvent):void{
if (re_pass.text == re_pass2.text){
if (checkNameValid(re_name.text)){
SocketManager.socket.register(re_name.text, re_pass.text, re_email.text);
SocketManager.socket.addEventListener(BlossomEvent.REGISTER_SUCCESS, registerSuccessHandler, false, 0, true);
SocketManager.socket.addEventListener(BlossomEvent.REGISTER_ERROR, registerErrorHandler, false, 0, true);
dataTracer.clearTracer();
dataTracer.update("Registering new account...");
addChild(DataTracer);
} else {
dataTracer.throwError("Names can only contain letters and numbers. It cannot contain spaces or any special characters.");
};
} else {
dataTracer.throwError("The passwords you entered do not match.");
};
}
public function PL_LOADED(event:Event):void{
completedTheLoad();
}
public function startShake(a:Number, b:Number, c:Number):void{
shakeStr = a;
shakeDecay = b;
shakeOsci = c;
shakeNow = (Math.random() * 10);
stage.addEventListener(Event.ENTER_FRAME, runShake, false, 0, true);
}
function __setProp_j_server0_MENU_MENU_79(){
j_server0["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
j_server0.emphasized = false;
j_server0.enabled = true;
j_server0.label = "";
j_server0.labelPlacement = "right";
j_server0.selected = false;
j_server0.toggle = false;
j_server0.visible = true;
j_server0["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
public function startMultiPlayer(Event:MouseEvent):void{
singlePlayerMode = false;
MP_userName = (playerName = "Player");
MP_team = 2;
MP_color = 0;
dataTracer.clearTracer();
gotoAndStop("SERVER", "MENU");
}
public function b_loginHand(e:MouseEvent):void{
dataTracer.clearTracer();
dataTracer.update("Logging in...");
addChild(DataTracer);
SocketManager.socket.login(in_name.text, in_pass.text);
SocketManager.socket.addEventListener(BlossomEvent.LOGIN_SUCCESS, loginSuccessHandler, false, 0, true);
SocketManager.socket.addEventListener(BlossomEvent.LOGIN_ERROR, loginErrorHandler, false, 0, true);
}
}
}//package Giraffe_fla
Section 84
//MPScreenCounter_220 (Giraffe_fla.MPScreenCounter_220)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MPScreenCounter_220 extends MovieClip {
public var basic:Object;
public function MPScreenCounter_220(){
super();
addFrameScript(149, frame150);
}
function frame150(){
basic.gotoAndStop("Game", "GAME");
}
}
}//package Giraffe_fla
Section 85
//optionIcon_233 (Giraffe_fla.optionIcon_233)
package Giraffe_fla {
import flash.display.*;
public dynamic class optionIcon_233 extends MovieClip {
public var iconGF;
public function optionIcon_233(){
super();
addFrameScript(0, frame1);
}
function frame1(){
iconGF = null;
}
}
}//package Giraffe_fla
Section 86
//promptBox_242 (Giraffe_fla.promptBox_242)
package Giraffe_fla {
import flash.display.*;
import flash.text.*;
public dynamic class promptBox_242 extends MovieClip {
public var b2:MovieClip;
public var b1:MovieClip;
public var b3:MovieClip;
public var p:TextField;
public function promptBox_242(){
super();
}
}
}//package Giraffe_fla
Section 87
//promptBoxButton_244 (Giraffe_fla.promptBoxButton_244)
package Giraffe_fla {
import flash.display.*;
import flash.text.*;
public dynamic class promptBoxButton_244 extends MovieClip {
public var p:TextField;
public function promptBoxButton_244(){
super();
}
}
}//package Giraffe_fla
Section 88
//S_272 (Giraffe_fla.S_272)
package Giraffe_fla {
import flash.display.*;
public dynamic class S_272 extends MovieClip {
public function S_272(){
super();
addFrameScript(499, frame500);
}
function frame500(){
stop();
}
}
}//package Giraffe_fla
Section 89
//soundLoader_150 (Giraffe_fla.soundLoader_150)
package Giraffe_fla {
import flash.display.*;
public dynamic class soundLoader_150 extends MovieClip {
public function soundLoader_150(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Giraffe_fla
Section 90
//teamDisplay_310 (Giraffe_fla.teamDisplay_310)
package Giraffe_fla {
import flash.display.*;
import flash.text.*;
public dynamic class teamDisplay_310 extends MovieClip {
public var n:TextField;
public function teamDisplay_310(){
super();
}
}
}//package Giraffe_fla
Section 91
//UI_Layout_222 (Giraffe_fla.UI_Layout_222)
package Giraffe_fla {
import flash.display.*;
public dynamic class UI_Layout_222 extends MovieClip {
public var bg_1:MovieClip;
public var bg_3:MovieClip;
public var bg_4:MovieClip;
public var bg_5:MovieClip;
public var bg_0:MovieClip;
public var bg_2:MovieClip;
public function UI_Layout_222(){
super();
}
}
}//package Giraffe_fla
Section 92
//uiButtonIcon_232 (Giraffe_fla.uiButtonIcon_232)
package Giraffe_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.geom.*;
import flash.filters.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class uiButtonIcon_232 extends MovieClip {
public var id:Number;
public var btn:SimpleButton;
public var gfx:MovieClip;
public function uiButtonIcon_232(){
super();
addFrameScript(0, frame1);
}
public function doTip(Event:MouseEvent):void{
if (toolTip.errorTip != true){
gameKon.doTip(id, true);
};
}
function frame1(){
btn.addEventListener(MouseEvent.CLICK, doOption);
btn.addEventListener(MouseEvent.MOUSE_OVER, doTip);
btn.addEventListener(MouseEvent.MOUSE_OUT, unTip);
}
public function unTip(Event:MouseEvent):void{
gameKon.doTip(0, false);
}
public function doReal():void{
var vars:Object;
var hjy:*;
var n:*;
if (gameKon.selectedBuilding != null){
vars = new Object();
vars.auto = false;
vars.cancelOrder = false;
vars.pos = gameKon.theRoot.clientPlayer[1];
vars.buildId = gameKon.selectedBuilding.INFO.options[id];
vars.building = gameKon.selectedBuilding.baseId;
};
if (id == 8){
gameKon.doOption(null, true, false, gameKon.playerNow, gameKon.selectedBuilding);
if (!gameKon.theRoot.singlePlayerMode){
vars.cancelOrder = true;
gameKon.theRoot.gameRoom.sendToRoom(vars, false, "updateBuilding");
};
} else {
if (gameKon.selectedBuilding != null){
if (gameKon.shiftToggle){
vars.auto = true;
gameKon.doOption(optionData.LIST[gameKon.selectedBuilding.INFO.options[id]], false, true, gameKon.playerNow, gameKon.selectedBuilding, false, false, vars, true);
} else {
gameKon.doOption(optionData.LIST[gameKon.selectedBuilding.INFO.options[id]], false, false, gameKon.playerNow, gameKon.selectedBuilding, false, false, vars, true);
};
} else {
for (hjy in gameKon.selectedUnit) {
if (gameKon.selectedUnit[hjy].rallyMode){
gameKon.selectedUnit[hjy].rallyMode = false;
gameKon.selectedUnit[hjy].aiPosition = false;
};
};
if (gameKon.theRoot.singlePlayerMode){
gameKon.doUnitOption(id);
} else {
vars = new Object();
vars.id = id;
vars.orderArray = new Array();
for (n in gameKon.selectedUnit) {
vars.orderArray.push(gameKon.selectedUnit[n].unitId);
};
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "orderUnit");
};
};
};
}
public function doOption(Event:MouseEvent):void{
doReal();
}
}
}//package Giraffe_fla
Section 93
//VictoryScreen_259 (Giraffe_fla.VictoryScreen_259)
package Giraffe_fla {
import flash.display.*;
public dynamic class VictoryScreen_259 extends MovieClip {
public function VictoryScreen_259(){
super();
addFrameScript(599, frame600);
}
function frame600(){
stop();
}
}
}//package Giraffe_fla
Section 94
//_base (_base)
package {
import flash.display.*;
public dynamic class _base extends MovieClip {
public var bc:MovieClip;
public var innerFrame:baseFrame;
public var bgh:MovieClip;
public function _base(){
super();
}
}
}//package
Section 95
//_ex (_ex)
package {
import flash.display.*;
public dynamic class _ex extends MovieClip {
public function _ex(){
super();
}
}
}//package
Section 96
//_groundDisplay (_groundDisplay)
package {
import flash.display.*;
public dynamic class _groundDisplay extends MovieClip {
public function _groundDisplay(){
super();
}
}
}//package
Section 97
//_hitter (_hitter)
package {
import flash.display.*;
public dynamic class _hitter extends MovieClip {
public function _hitter(){
super();
}
}
}//package
Section 98
//_icon (_icon)
package {
import flash.display.*;
public dynamic class _icon extends MovieClip {
public function _icon(){
super();
}
}
}//package
Section 99
//_trail (_trail)
package {
import flash.display.*;
public dynamic class _trail extends MovieClip {
public function _trail(){
super();
}
}
}//package
Section 100
//_unit (_unit)
package {
import flash.display.*;
public dynamic class _unit extends MovieClip {
public function _unit(){
super();
}
}
}//package
Section 101
//_weapon (_weapon)
package {
import flash.display.*;
public dynamic class _weapon extends MovieClip {
public function _weapon(){
super();
}
}
}//package
Section 102
//adjuster (adjuster)
package {
import flash.display.*;
public dynamic class adjuster extends MovieClip {
public function adjuster(){
super();
}
}
}//package
Section 103
//AdLoader (AdLoader)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public function AdLoader(){
super();
}
public static function LoadAd(poolid:int, subpoolid:int):DisplayObject{
var cpmstarViewSWFUrl:String;
Security.allowDomain("server.cpmstar.com");
cpmstarViewSWFUrl = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((cpmstarViewSWFUrl + "?poolid=") + poolid) + "&subpoolid=") + subpoolid)));
return (cpmstarLoader);
}
}
}//package
Section 104
//aiBody (aiBody)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class aiBody extends Sprite {
public var buildList:Array;
private var be:uint;
public var p:playerKon;
private var stratTimer:Timer;
private var canDoBuild:Array;
public var AiStrategy:aiStrategy;
private var timerObject:Timer;
private var orderDone:Boolean;// = false
public function aiBody(player:playerKon, be:uint){
orderDone = false;
super();
p = player;
this.be = be;
buildList = new Array();
if (gameKon.theRoot.singlePlayerMode){
startAiFunctions();
} else {
timerObject = new Timer(6000);
timerObject.addEventListener(TimerEvent.TIMER, beginAiMover, false, 0, true);
timerObject.start();
};
}
private function executeStrategy(event:TimerEvent):void{
buildList = new Array();
AiStrategy.work(p.eteam.all, buildList, p);
}
public function killAi():void{
timerObject.removeEventListener(TimerEvent.TIMER, executeAi);
stratTimer.removeEventListener(TimerEvent.TIMER, executeStrategy);
AiStrategy = null;
}
function checkResource(a:uint){
if ((((((optionData.LIST[a][0] <= p.r_m)) && ((optionData.LIST[a][1] <= p.r_p)))) && ((optionData.LIST[a][2] <= p.r_e)))){
if (optionData.LIST[a][4] <= p.r_i){
return (true);
};
};
}
function checkAval(a:uint){
var i:*;
var j:*;
canDoBuild = new Array();
for (i in p.builds) {
for (j in p.builds[i].INFO.options) {
if (p.builds[i].INFO.options[j] == a){
canDoBuild.push(p.builds[i]);
};
};
};
}
function checkBuild(b:baseBuilding){
if (b.working == false){
return (true);
};
}
function executeAi(event:TimerEvent):void{
var i2:*;
var notDone:*;
var j2:*;
var oB:Object;
var vars:Object;
var sen:Boolean;
for (i2 in buildList) {
if (buildList[i2] == null){
} else {
if (buildList[i2].onHold == false){
orderDone = false;
while (orderDone == false) {
checkAval(buildList[i2].array[0]);
if (canDoBuild.length > 0){
orderDone = true;
notDone = true;
for (j2 in canDoBuild) {
if (notDone){
if (checkBuild(canDoBuild[j2])){
notDone = false;
if (checkResource(buildList[i2].array[0])){
oB = optionData.LIST[buildList[i2].array[0]];
canDoBuild[j2].aiCheck = buildList[i2];
if (((!((oB.buildOrder == null))) && (!(gameKon.theRoot.singlePlayerMode)))){
vars = new Object();
vars.auto = false;
vars.cancelOrder = false;
vars.pos = p.POS;
vars.buildId = buildList[i2].array[0];
vars.building = canDoBuild[j2].baseId;
sen = true;
} else {
vars = new Object();
sen = false;
};
if (buildList[i2].tech){
canDoBuild[j2].techSend = AiStrategy;
};
gameKon.doOption(oB, false, false, p, canDoBuild[j2], false, false, vars, sen);
buildList[i2].onHold = true;
if (buildList[i2].array.length == 1){
buildList[i2].limit = (buildList[i2].limit - 1);
if (buildList[i2].limit == 0){
buildList.splice(i2, 1);
};
} else {
buildList[i2].array.splice(0, 1);
};
};
};
};
};
} else {
buildList.splice(i2, 1);
orderDone = true;
};
};
};
};
};
}
private function startAiFunctions():void{
var vars2:Object;
timerObject = new Timer(600);
timerObject.addEventListener(TimerEvent.TIMER, executeAi, false, 0, true);
timerObject.start();
stratTimer = new Timer(5000);
stratTimer.addEventListener(TimerEvent.TIMER, executeStrategy, false, 0, true);
stratTimer.start();
AiStrategy = new aiStrategy(buildList, this.be, p);
p.setIncome(aiTactic.income[AiStrategy.randomNum]);
if (!gameKon.theRoot.singlePlayerMode){
vars2 = new Object();
vars2.race = aiTactic.income[AiStrategy.randomNum];
vars2.pos = p.POS;
gameKon.theRoot.gameRoom.sendToRoom(vars2, false, "updateIncome");
};
}
function findPath(A:aiOrder, spliceNum:uint){
var a:*;
var goSearch:Boolean;
var i:*;
var j:*;
var k:*;
a = A.array[0];
goSearch = true;
for (i in buildingData.LIST) {
if (goSearch){
for (j in buildingData.LIST[i].options) {
if (buildingData.LIST[i].options[j] == a){
if (i == 0){
goSearch = false;
} else {
for (k in optionData.LIST) {
if (optionData.LIST[k].buildOrder == i){
goSearch = false;
A.array.reverse();
A.array.push(k);
A.array.reverse();
};
};
};
};
};
};
};
}
private function beginAiMover(e:TimerEvent):void{
timerObject.removeEventListener(TimerEvent.TIMER, beginAiMover);
startAiFunctions();
}
}
}//package
Section 105
//aiOrder (aiOrder)
package {
public class aiOrder {
public var array:Array;
public var limit:uint;
public var tech:Boolean;
public var onHold:Boolean;
public function aiOrder(w:uint, l:uint, t:Boolean=false):void{
super();
limit = l;
tech = t;
onHold = false;
array = new Array();
array.push(w);
}
}
}//package
Section 106
//aiStrategy (aiStrategy)
package {
public class aiStrategy {
private var aiNames:Array;
public var grouping:Boolean;// = false
public var currentStrategy:uint;// = 0
public var techLevel:uint;// = 0
private var resOrder:uint;
public var aiSet:Array;
private var onPlayerTeam:Boolean;
public var mindSetO:uint;// = 0
public var roundCount:uint;// = 0
public var mindSetR:uint;// = 0
public var forceTech:uint;
public var techingNow:Boolean;// = false
private var c_greet:Array;
private var aiNames2:Array;
public var aiGroup:Array;
private var techCostPass:Boolean;
public var techLevelOffense:uint;// = 0
private var useTech:uint;
public var mustTech:Boolean;
public var randomNum:uint;
private var c_age:Array;
private var c_make:Array;
private var lastPush:uint;
private var varName:String;
private var pushGap:uint;// = 9
private var c_name:Array;
private var resOrder2:uint;
private var c_like:Array;
private var c_do:Array;
public function aiStrategy(a:Array, be:uint, p:playerKon):void{
var okPass:Boolean;
mindSetR = 0;
mindSetO = 0;
aiSet = new Array();
currentStrategy = 0;
techLevel = 0;
techLevelOffense = 0;
roundCount = 0;
grouping = false;
aiGroup = new Array();
pushGap = 9;
techingNow = false;
aiNames = ["Traditional", "Gladiator", "TechnoRush", "Spider", "Nuker", "SniperRush", "Joker", "FirePower", "HeavyMetal"];
aiNames2 = ["Gen. Glastondale", "Gen. Mortfang", "Cpt. Keeley", "Cpt. Beatrix", "Cpt. Bjorn", "Cpt. Jetzul", "Cpt. Haley", "FirePower", "HeavyMetal"];
c_greet = ["Good evening. General Glastondale reporting in for duty.", "This is General Mortfang reporting in.", "Hello! Captain Keeley at your service.", "Hello, this is Captain Beatrix.", "Cpt. Bjorn", "Alright, thumbs up... Let's do this!", "Captain Haley reporting in!", "FirePower", "HeavyMetal"];
c_name = ["I am Sir Miles Glastondale.", "The name's Lux Mortfang.", "Keeley Baker", "I'm Erika Beatrix.", "Cpt. Bjorn", "I am Shinkai Jetzul.", "Haley Cornwall", "FirePower", "HeavyMetal"];
c_age = ["62... or 63... I don't remember.", "43.", "26.", "34.", "Cpt. Bjorn", "32.", "24.", "FirePower", "HeavyMetal"];
c_like = ["Retirement... One day...", "Winning. What did you expect?", "Please Commander, focus on the battle!", "What kind of question is that? Are you a spy?", "Cpt. Bjorn", "Collecting people's ears, obviously...", "Is that really relevant now, Commander?", "FirePower", "HeavyMetal"];
c_make = ["I'm going for an Arsenal and a Hospital.", "I will try to tech towards Gladiators.", "Uh... I don't really know, I'm kind of new at this...", "Going for Sataka technology with meditec back-up.", "Cpt. Bjorn", "Opening with sniper rush. Then I'll tech to Arsenal.", "I'll try and have both an Arsenal and a MechTerm so we'll be ready for anything.", "FirePower", "HeavyMetal"];
c_do = ["It's a free world, Commander. But I wouldn't mind having you back me up Phantoms and Spiders.", "Support my forces with infantry and meditecs.", "I don't think I'm qualified to answer that.", "Tanks, marines, Snipers! It all depends on what they are doing.", "Cpt. Bjorn", "You'll need to take care of enemy air units. Sakata Mk-II, marines, and Black Queens are good for that.", "I need you to keep them away while I tech.", "FirePower", "HeavyMetal"];
super();
aiSet.push(new Array(1, 0));
aiSet.push(new Array(2, 1));
aiSet.push(new Array(3, 1));
aiSet.push(new Array(4, 1));
aiSet.push(new Array(0, 2));
aiSet.push(new Array(1, 0));
aiSet.push(new Array(5, 3));
mustTech = false;
techingNow = false;
techLevel = 0;
techLevelOffense = 0;
aiGroup = new Array();
grouping = false;
if (be == 99){
okPass = false;
while (!(okPass)) {
randomNum = Math.floor((Math.random() * (aiSet.length - 0.1)));
if (((((!((randomNum == 4))) && (!((randomNum == 2))))) && (!((randomNum == 6))))){
okPass = true;
};
};
} else {
randomNum = be;
};
p.playerName = aiNames2[randomNum];
if (gameKon.playerNow.team == p.team){
chatBody.pCol = p.cityColor;
onPlayerTeam = true;
if (!gameKon.theRoot.missionOn){
chatBody.pName = p.playerName;
chatBody.C_GREET = c_greet[randomNum];
chatBody.C_NAME = c_name[randomNum];
chatBody.C_AGE = c_age[randomNum];
chatBody.C_LIKE = c_like[randomNum];
chatBody.C_MAKE = c_make[randomNum];
chatBody.C_DO = c_do[randomNum];
if (!gameKon.theRoot.tutLev){
if (chatBody.chatOn){
chatBody.delaySay(chatBody.C_GREET, 5);
};
};
};
} else {
onPlayerTeam = false;
};
currentStrategy = 0;
mindSetR = aiSet[randomNum][0];
mindSetO = aiSet[randomNum][1];
roundCount = 0;
lastPush = 0;
techCostPass = false;
trace(("AI Activated: " + aiNames[randomNum]));
varName = aiNames[randomNum];
forceTech = aiTactic.techTreeArray[randomNum].length;
switch (randomNum){
case 2:
a.push(new aiOrder(7, 100));
break;
case 3:
break;
case 5:
a.push(new aiOrder(2, 1));
a.push(new aiOrder(44, 100));
break;
default:
a.push(new aiOrder(5, 100));
break;
};
}
public function work(u:Array, a:Array, p:playerKon):void{
var numOn:uint;
var takeNum:uint;
var stillChoose:Boolean;
var moveObject:Object;
var goMove:uint;
var anal:uint;
var danger:uint;
var takeAction:uint;
var uj:*;
trace((aiNames[randomNum] + "-------------------------------"));
roundCount++;
techCostPass = false;
mustTech = false;
useTech = techLevel;
if ((((techLevel < forceTech)) && (!(techingNow)))){
if (checkTechCost(p, aiTactic.techTreeArray[randomNum][techLevel], aiTactic.techTimeArray[randomNum][techLevel])){
trace("Must Tech!");
if (techCostPass){
a.push(new aiOrder(aiTactic.techTreeArray[randomNum][techLevel], 1, true));
techingNow = true;
mustTech = false;
};
};
} else {
if (techLevel == aiTactic.techTreeArray[randomNum].length){
useTech = (techLevel - 1);
};
};
if (mustTech){
anal = 12;
if (onPlayerTeam){
chatBody.sendEv("A_SAVE");
};
} else {
numOn = 0;
stillChoose = true;
while (stillChoose) {
moveObject = analyzeEnemy(p)[numOn];
takeAction = moveObject.ID;
goMove = aiTactic.counterArray[takeAction][randomNum][useTech];
if (goMove > 0){
stillChoose = false;
takeNum = numOn;
} else {
if (numOn < 11){
numOn++;
} else {
stillChoose = false;
takeNum = numOn;
};
};
};
anal = analyzeEnemy(p)[takeNum].ID;
danger = analyzeEnemy(p)[takeNum].DANGER;
if (danger < 9){
if (((p.r_m + p.r_p) + p.r_e) > (25 * techLevel)){
if (onPlayerTeam){
chatBody.sendEv("A_RESUME");
};
anal = 0;
} else {
if (onPlayerTeam){
chatBody.sendEv("A_SAVE2");
};
anal = 12;
};
};
};
if ((roundCount - lastPush) >= pushGap){
if (((onPlayerTeam) && (!(grouping)))){
chatBody.sendEv("A_GROUP");
};
grouping = true;
};
if (grouping){
if (analyzeGroup() > 12){
if (onPlayerTeam){
chatBody.sendEv("A_ATTACK");
};
grouping = false;
lastPush = roundCount;
for (uj in aiGroup) {
aiGroup[uj].aiPosition = false;
aiGroup[uj].makeOption(0);
};
aiGroup = new Array();
};
};
if (anal != 12){
aiTactic.work(a, goMove);
trace(goMove);
};
if ((((anal == 0)) && ((p.r_i >= 100)))){
aiTactic.work(a, 60);
aiTactic.work(a, 61);
aiTactic.work(a, 62);
};
if (onPlayerTeam){
trace("BOO_2");
switch (anal){
case 1:
chatBody.sendEv("A_C1");
break;
case 2:
chatBody.sendEv("A_C2");
break;
case 3:
chatBody.sendEv("A_C3");
break;
case 4:
chatBody.sendEv("A_C4");
break;
case 5:
chatBody.sendEv("A_C5");
break;
case 6:
chatBody.sendEv("A_C6");
break;
case 7:
chatBody.sendEv("A_C7");
break;
case 8:
chatBody.sendEv("A_C8");
break;
case 9:
chatBody.sendEv("A_C9");
break;
case 11:
chatBody.sendEv("A_C11");
break;
default:
break;
};
};
resOrder = 0;
resOrder2 = 0;
switch (randomNum){
case 0:
getOrder(0, 58);
getOrder2(5, 56);
getOrder(5, 59);
break;
case 1:
getOrder(0, 58);
getOrder2(3, 57);
break;
case 2:
getOrder(0, 58);
getOrder2(6, 57);
break;
case 3:
getOrder(0, 58);
getOrder2(6, 57);
getOrder(6, 59);
break;
case 4:
getOrder(0, 58);
break;
case 5:
getOrder(0, 58);
getOrder(5, 59);
getOrder2(4, 56);
break;
case 6:
getOrder(0, 58);
getOrder2(5, 56);
break;
};
aiTactic.work(a, resOrder2);
aiTactic.work(a, resOrder);
}
private function analyzeGroup(aType:Boolean=false):uint{
var potency:uint;
var i:*;
potency = 0;
for (i in aiGroup) {
switch (aiGroup[i].ID){
case 0:
potency = (potency + 0);
break;
case 1:
potency = (potency + 1);
break;
case 2:
potency = (potency + 3);
break;
case 3:
potency = (potency + 2);
break;
case 4:
potency = (potency + 1);
break;
case 5:
potency = (potency + 1);
break;
case 6:
potency = (potency + 3);
break;
case 7:
potency = (potency + 4);
break;
case 8:
potency = (potency + 4);
break;
case 9:
potency = (potency + 2);
break;
case 10:
potency = (potency + 4);
break;
case 11:
potency = (potency + 20);
break;
case 12:
potency = (potency + 3);
break;
case 13:
potency = (potency + 20);
break;
default:
break;
};
};
return (potency);
}
private function getOrder(t:uint, r:uint){
if (techLevel >= t){
resOrder = r;
};
}
private function getOrder2(t:uint, r:uint){
if (techLevel >= t){
resOrder2 = r;
};
}
private function checkTechCost(p:playerKon, b:uint, t:uint){
var o:Object;
o = optionData.LIST[b];
if ((((((p.r_m >= o[0])) && ((p.r_p >= o[1])))) && ((p.r_e >= o[2])))){
techCostPass = true;
return (true);
};
if ((t * 2) <= roundCount){
mustTech = true;
return (true);
};
}
private function analyzeEnemy(p:playerKon){
var dangerArray:*;
var i:*;
dangerArray = new Array();
i = 0;
while (i < 12) {
dangerArray.push({DANGER:0, ID:i});
i++;
};
for (i in p.eteam.all) {
switch (p.eteam.all[i].ID){
case 0:
dangerArray[0].DANGER = (dangerArray[0].DANGER + 1);
break;
case 1:
dangerArray[1].DANGER = (dangerArray[1].DANGER + 1);
dangerArray[3].DANGER = (dangerArray[3].DANGER + 1);
break;
case 2:
dangerArray[2].DANGER = (dangerArray[2].DANGER + 10);
dangerArray[3].DANGER = (dangerArray[3].DANGER + 10);
dangerArray[11].DANGER = (dangerArray[11].DANGER + 8);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 3);
break;
case 3:
dangerArray[7].DANGER = (dangerArray[7].DANGER + 6);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 3);
break;
case 4:
dangerArray[1].DANGER = (dangerArray[1].DANGER + 2);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 1);
break;
case 5:
dangerArray[10].DANGER = (dangerArray[10].DANGER + 1);
break;
case 6:
dangerArray[5].DANGER = (dangerArray[5].DANGER + 11);
dangerArray[11].DANGER = (dangerArray[11].DANGER + 11);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 8);
break;
case 7:
dangerArray[7].DANGER = (dangerArray[7].DANGER + 16);
break;
case 8:
dangerArray[2].DANGER = (dangerArray[2].DANGER + 16);
dangerArray[3].DANGER = (dangerArray[3].DANGER + 16);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 16);
dangerArray[11].DANGER = (dangerArray[11].DANGER + 16);
break;
case 9:
dangerArray[6].DANGER = (dangerArray[6].DANGER + 16);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 8);
break;
case 10:
dangerArray[5].DANGER = (dangerArray[5].DANGER + 12);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 15);
break;
case 11:
dangerArray[8].DANGER = (dangerArray[8].DANGER + 50);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 20);
break;
case 12:
dangerArray[4].DANGER = (dangerArray[4].DANGER + 8);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 3);
break;
case 13:
dangerArray[9].DANGER = (dangerArray[9].DANGER + 50);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 8);
break;
case 14:
dangerArray[2].DANGER = (dangerArray[2].DANGER + 20);
dangerArray[3].DANGER = (dangerArray[3].DANGER + 20);
dangerArray[10].DANGER = (dangerArray[10].DANGER + 20);
dangerArray[11].DANGER = (dangerArray[11].DANGER + 20);
break;
case 15:
dangerArray[7].DANGER = (dangerArray[7].DANGER + 20);
break;
case 16:
dangerArray[1].DANGER = (dangerArray[1].DANGER + 6);
dangerArray[3].DANGER = (dangerArray[3].DANGER + 6);
break;
default:
break;
};
};
for (i in p.team.all) {
switch (p.team.all[i].ID){
case 0:
break;
case 1:
dangerArray[6].DANGER = (dangerArray[6].DANGER - 1);
dangerArray[7].DANGER = (dangerArray[7].DANGER - 2);
break;
case 2:
dangerArray[1].DANGER = (dangerArray[1].DANGER - 6);
break;
case 3:
dangerArray[2].DANGER = (dangerArray[2].DANGER - 5);
dangerArray[7].DANGER = (dangerArray[7].DANGER - 6);
break;
case 4:
dangerArray[1].DANGER = (dangerArray[1].DANGER - 2);
dangerArray[5].DANGER = (dangerArray[5].DANGER - 1);
break;
case 5:
break;
case 6:
dangerArray[7].DANGER = (dangerArray[7].DANGER - 7);
dangerArray[4].DANGER = (dangerArray[4].DANGER - 4);
break;
case 7:
dangerArray[1].DANGER = (dangerArray[1].DANGER - 10);
dangerArray[4].DANGER = (dangerArray[4].DANGER - 20);
break;
case 8:
dangerArray[1].DANGER = (dangerArray[1].DANGER - 16);
break;
case 9:
dangerArray[7].DANGER = (dangerArray[7].DANGER - 16);
break;
case 10:
dangerArray[11].DANGER = (dangerArray[11].DANGER - 8);
break;
case 11:
break;
case 12:
break;
case 13:
break;
default:
break;
};
};
dangerArray.sortOn(["DANGER", "ID"], (Array.DESCENDING | Array.NUMERIC));
return (dangerArray);
}
}
}//package
Section 107
//aiTactic (aiTactic)
package {
public class aiTactic {
public static var techTreeArray:Array = new Array();
public static var techTimeArray:Array = new Array();
public static var income:Array = new Array(2, 0, 0, 0, 2, 1, 2);
public static var counterArray:Array = new Array();
public function aiTactic(){
super();
}
public static function init():void{
counterArray[0] = new Array();
counterArray[0].push(new Array(0, 37, 25, 25, 46, 40, 40));
counterArray[0].push(new Array(0, 26, 26, 29, 31, 31, 31));
counterArray[0].push(new Array(0, 26, 26, 43, 47, 47, 47, 48));
counterArray[0].push(new Array(0, 0, 26, 26, 27, 27, 30, 30));
counterArray[0].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[0].push(new Array(0, 33, 33, 33, 49, 50, 50));
counterArray[0].push(new Array(0, 37, 37, 28, 45, 39, 50, 51, 51));
counterArray[1] = new Array();
counterArray[1].push(new Array(0, 25, 25, 25, 25, 25, 25));
counterArray[1].push(new Array(0, 26, 26, 26, 27, 27, 27));
counterArray[1].push(new Array(0, 35, 35, 35, 35, 27, 27, 27));
counterArray[1].push(new Array(0, 0, 26, 26, 26, 27, 27, 27));
counterArray[1].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[1].push(new Array(0, 25, 25, 25, 25, 25, 25));
counterArray[1].push(new Array(0, 25, 25, 25, 25, 25, 25, 25, 25));
counterArray[2] = new Array();
counterArray[2].push(new Array(0, 25, 25, 25, 25, 25, 32));
counterArray[2].push(new Array(0, 28, 28, 29, 29, 29, 29));
counterArray[2].push(new Array(0, 28, 29, 29, 29, 29, 29, 29));
counterArray[2].push(new Array(0, 0, 28, 28, 29, 29, 29, 29));
counterArray[2].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[2].push(new Array(0, 0, 0, 0, 0, 0, 32));
counterArray[2].push(new Array(0, 0, 0, 28, 28, 28, 29, 29, 29));
counterArray[3] = new Array();
counterArray[3].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[3].push(new Array(0, 0, 0, 29, 29, 29, 29));
counterArray[3].push(new Array(0, 0, 29, 29, 29, 29, 29, 29));
counterArray[3].push(new Array(0, 0, 0, 0, 29, 29, 29, 29));
counterArray[3].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[3].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[3].push(new Array(0, 0, 0, 0, 0, 0, 29, 29, 29));
counterArray[4] = new Array();
counterArray[4].push(new Array(0, 0, 0, 0, 33, 32, 32));
counterArray[4].push(new Array(0, 0, 0, 29, 31, 31, 31));
counterArray[4].push(new Array(0, 35, 35, 35, 35, 29, 29, 29));
counterArray[4].push(new Array(0, 0, 0, 0, 29, 29, 29, 29));
counterArray[4].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[4].push(new Array(0, 33, 33, 33, 33, 32, 32));
counterArray[4].push(new Array(0, 0, 0, 0, 33, 33, 29, 29, 29));
counterArray[5] = new Array();
counterArray[5].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[5].push(new Array(0, 35, 35, 35, 35, 35, 35));
counterArray[5].push(new Array(0, 35, 35, 35, 35, 35, 35, 35));
counterArray[5].push(new Array(0, 0, 35, 35, 35, 35, 36, 36));
counterArray[5].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[5].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[5].push(new Array(0, 0, 0, 35, 35, 35, 35, 35, 35));
counterArray[6] = new Array();
counterArray[6].push(new Array(0, 25, 25, 25, 45, 40, 40));
counterArray[6].push(new Array(0, 26, 26, 26, 35, 35, 35));
counterArray[6].push(new Array(0, 26, 26, 26, 26, 35, 35, 35));
counterArray[6].push(new Array(0, 0, 26, 26, 26, 27, 30, 30));
counterArray[6].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[6].push(new Array(0, 33, 33, 33, 45, 39, 39));
counterArray[6].push(new Array(0, 25, 25, 33, 45, 39, 39, 39, 39));
counterArray[7] = new Array();
counterArray[7].push(new Array(0, 37, 37, 37, 45, 40, 32));
counterArray[7].push(new Array(0, 28, 28, 44, 38, 38, 38));
counterArray[7].push(new Array(0, 28, 28, 44, 44, 44, 44, 38));
counterArray[7].push(new Array(0, 0, 28, 28, 44, 44, 38, 38));
counterArray[7].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[7].push(new Array(0, 37, 37, 37, 45, 39, 39));
counterArray[7].push(new Array(0, 37, 37, 28, 28, 28, 38, 38, 38));
counterArray[8] = new Array();
counterArray[8].push(new Array(0, 37, 37, 37, 45, 40, 32));
counterArray[8].push(new Array(0, 26, 26, 26, 35, 35, 35));
counterArray[8].push(new Array(0, 28, 28, 44, 44, 44, 44, 38));
counterArray[8].push(new Array(0, 0, 26, 26, 44, 44, 38, 38));
counterArray[8].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[8].push(new Array(0, 37, 37, 37, 45, 39, 39));
counterArray[8].push(new Array(0, 37, 37, 28, 28, 28, 38, 38, 38));
counterArray[9] = new Array();
counterArray[9].push(new Array(0, 0, 0, 33, 33, 33, 32));
counterArray[9].push(new Array(0, 0, 0, 29, 29, 29, 29));
counterArray[9].push(new Array(0, 0, 29, 29, 29, 29, 29, 29));
counterArray[9].push(new Array(0, 0, 0, 0, 29, 29, 29, 29));
counterArray[9].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[9].push(new Array(0, 33, 33, 33, 33, 33, 32));
counterArray[9].push(new Array(0, 0, 0, 0, 33, 32, 32, 32, 32));
counterArray[10] = new Array();
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0, 0));
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0, 0));
counterArray[10].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[10].push(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0));
counterArray[11] = new Array();
counterArray[11].push(new Array(0, 0, 0, 33, 33, 42, 42));
counterArray[11].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[11].push(new Array(0, 0, 0, 0, 27, 27, 27, 27));
counterArray[11].push(new Array(0, 0, 0, 0, 0, 30, 30, 30));
counterArray[11].push(new Array(0, 0, 34, 34, 34, 34, 34));
counterArray[11].push(new Array(0, 33, 33, 33, 33, 42, 42));
counterArray[11].push(new Array(0, 0, 0, 0, 33, 41, 41, 41, 41));
counterArray[12] = new Array();
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0));
counterArray[12].push(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0));
}
public static function work(a:Array, id:uint):void{
switch (id){
case 0:
break;
case 1:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
break;
case 2:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(25, 4));
break;
case 3:
a.push(new aiOrder(27, 4));
a.push(new aiOrder(27, 4));
break;
case 4:
a.push(new aiOrder(27, 4));
a.push(new aiOrder(25, 4));
break;
case 5:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(31, 4));
break;
case 6:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(32, 4));
break;
case 7:
a.push(new aiOrder(27, 4));
break;
case 8:
a.push(new aiOrder(31, 4));
break;
case 9:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(27, 4));
break;
case 10:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(25, 4));
a.push(new aiOrder(30, 4));
break;
case 11:
a.push(new aiOrder(29, 4));
a.push(new aiOrder(27, 4));
break;
case 12:
a.push(new aiOrder(29, 4));
a.push(new aiOrder(29, 4));
break;
case 13:
a.push(new aiOrder(29, 4));
a.push(new aiOrder(25, 4));
break;
case 14:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(32, 4));
break;
case 15:
a.push(new aiOrder(26, 4));
break;
case 16:
a.push(new aiOrder(31, 4));
a.push(new aiOrder(27, 4));
break;
case 17:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
break;
case 18:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
break;
case 19:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(27, 4));
break;
case 20:
a.push(new aiOrder(28, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(29, 4));
break;
case 21:
a.push(new aiOrder(44, 7));
break;
case 22:
a.push(new aiOrder(25, 4));
break;
case 23:
a.push(new aiOrder(27, 4));
a.push(new aiOrder(32, 4));
break;
case 24:
a.push(new aiOrder(29, 4));
a.push(new aiOrder(32, 4));
break;
case 25:
a.push(new aiOrder(14, 2));
a.push(new aiOrder(13, 2));
a.push(new aiOrder(44, 10));
break;
case 26:
a.push(new aiOrder(5, 10));
a.push(new aiOrder(15, 2));
a.push(new aiOrder(35, 10));
trace("Go Make Units!");
break;
case 27:
a.push(new aiOrder(21, 2));
a.push(new aiOrder(16, 3));
a.push(new aiOrder(35, 10));
break;
case 28:
a.push(new aiOrder(15, 2));
a.push(new aiOrder(35, 10));
break;
case 29:
a.push(new aiOrder(19, 1));
a.push(new aiOrder(16, 3));
a.push(new aiOrder(35, 10));
break;
case 30:
a.push(new aiOrder(21, 2));
a.push(new aiOrder(17, 3));
a.push(new aiOrder(35, 10));
break;
case 31:
a.push(new aiOrder(43, 1));
a.push(new aiOrder(35, 10));
break;
case 32:
a.push(new aiOrder(23, 1));
a.push(new aiOrder(18, 2));
a.push(new aiOrder(44, 10));
break;
case 33:
a.push(new aiOrder(24, 5));
a.push(new aiOrder(44, 10));
break;
case 34:
a.push(new aiOrder(37, 1));
break;
case 35:
a.push(new aiOrder(16, 12));
a.push(new aiOrder(35, 10));
break;
case 36:
a.push(new aiOrder(16, 12));
a.push(new aiOrder(17, 3));
a.push(new aiOrder(35, 10));
break;
case 37:
a.push(new aiOrder(13, 15));
a.push(new aiOrder(44, 10));
break;
case 38:
a.push(new aiOrder(20, 1));
a.push(new aiOrder(35, 10));
break;
case 39:
a.push(new aiOrder(18, 2));
a.push(new aiOrder(13, 3));
a.push(new aiOrder(44, 10));
break;
case 40:
a.push(new aiOrder(18, 3));
a.push(new aiOrder(17, 6));
a.push(new aiOrder(44, 10));
break;
case 41:
a.push(new aiOrder(22, 2));
a.push(new aiOrder(44, 10));
break;
case 42:
a.push(new aiOrder(22, 3));
a.push(new aiOrder(17, 6));
a.push(new aiOrder(44, 10));
break;
case 43:
a.push(new aiOrder(15, 10));
a.push(new aiOrder(35, 10));
break;
case 44:
a.push(new aiOrder(39, 1));
a.push(new aiOrder(35, 10));
break;
case 45:
a.push(new aiOrder(38, 2));
a.push(new aiOrder(13, 3));
a.push(new aiOrder(44, 10));
break;
case 46:
a.push(new aiOrder(38, 3));
a.push(new aiOrder(17, 6));
a.push(new aiOrder(44, 10));
break;
case 47:
a.push(new aiOrder(16, 2));
a.push(new aiOrder(15, 1));
a.push(new aiOrder(19, 1));
a.push(new aiOrder(35, 10));
break;
case 48:
a.push(new aiOrder(39, 1));
a.push(new aiOrder(21, 2));
a.push(new aiOrder(35, 10));
break;
case 49:
a.push(new aiOrder(18, 2));
a.push(new aiOrder(13, 3));
a.push(new aiOrder(24, 2));
a.push(new aiOrder(44, 10));
break;
case 50:
a.push(new aiOrder(24, 2));
a.push(new aiOrder(18, 1));
a.push(new aiOrder(22, 1));
a.push(new aiOrder(44, 10));
break;
case 51:
a.push(new aiOrder(39, 1));
a.push(new aiOrder(21, 2));
a.push(new aiOrder(35, 10));
a.push(new aiOrder(24, 2));
a.push(new aiOrder(18, 1));
a.push(new aiOrder(22, 1));
a.push(new aiOrder(44, 10));
break;
case 52:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
a.push(new aiOrder(32, 4));
break;
case 53:
a.push(new aiOrder(26, 4));
a.push(new aiOrder(29, 4));
a.push(new aiOrder(32, 4));
break;
case 54:
a.push(new aiOrder(35, 10));
break;
case 55:
a.push(new aiOrder(31, 4));
break;
case 56:
a.push(new aiOrder(30, 4));
break;
case 57:
a.push(new aiOrder(23, 4));
break;
case 58:
a.push(new aiOrder(25, 4));
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
a.push(new aiOrder(27, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(29, 4));
a.push(new aiOrder(29, 4));
a.push(new aiOrder(44, 3));
a.push(new aiOrder(35, 3));
a.push(new aiOrder(31, 4));
break;
case 59:
a.push(new aiOrder(17, 6));
a.push(new aiOrder(25, 4));
a.push(new aiOrder(26, 4));
a.push(new aiOrder(27, 4));
a.push(new aiOrder(27, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(28, 4));
a.push(new aiOrder(29, 4));
a.push(new aiOrder(29, 4));
a.push(new aiOrder(44, 3));
a.push(new aiOrder(35, 3));
a.push(new aiOrder(31, 4));
case 60:
a.push(new aiOrder(46, 1));
break;
case 61:
a.push(new aiOrder(47, 1));
break;
case 62:
a.push(new aiOrder(48, 1));
break;
default:
break;
};
}
techTreeArray[0] = new Array(2, 4, 9, 6, 33, 11);
techTreeArray[1] = new Array(3, 6, 10, 34, 7, 12);
techTreeArray[2] = new Array(3, 7, 10, 6, 12, 12, 34);
techTreeArray[3] = new Array(6, 3, 7, 10, 4, 34, 12);
techTreeArray[4] = new Array(7, 8, 5, 11, 11, 12);
techTreeArray[5] = new Array(9, 4, 5, 6, 33, 11);
techTreeArray[6] = new Array(2, 6, 3, 9, 33, 10, 34, 11);
techTreeArray[7] = new Array(2, 2, 2, 2);
techTreeArray[8] = new Array(2, 2, 2, 2);
techTimeArray[0] = new Array(1, 8, 16, 36, 40, 48);
techTimeArray[1] = new Array(1, 7, 10, 25, 31, 32);
techTimeArray[2] = new Array(1, 3, 18, 32, 40, 48, 52);
techTimeArray[3] = new Array(0, 1, 8, 18, 22, 26, 36);
techTimeArray[4] = new Array(1, 3, 6, 16, 30, 35);
techTimeArray[5] = new Array(1, 14, 18, 22, 38, 50);
techTimeArray[6] = new Array(1, 2, 16, 23, 32, 38, 45, 55);
techTimeArray[7] = new Array(2, 2, 2, 2);
techTreeArray[8] = new Array(2, 2, 2, 2);
}
}//package
Section 108
//Ambient1 (Ambient1)
package {
import flash.media.*;
public dynamic class Ambient1 extends Sound {
public function Ambient1(){
super();
}
}
}//package
Section 109
//Ambient2 (Ambient2)
package {
import flash.media.*;
public dynamic class Ambient2 extends Sound {
public function Ambient2(){
super();
}
}
}//package
Section 110
//Ambient3 (Ambient3)
package {
import flash.media.*;
public dynamic class Ambient3 extends Sound {
public function Ambient3(){
super();
}
}
}//package
Section 111
//baseBuilding (baseBuilding)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class baseBuilding extends Sprite {
public var working:Boolean;// = false
private var bitmap:Bitmap;// = null
public var techSend:aiStrategy;
public var maxTime:Number;// = 0
public var currentBuilding:uint;// = 0
public var option:Object;
public var ownBy:playerKon;
private var aniTimeLimit:uint;// = 0
public var unitLink:unitBody;// = null
private var hitter:_hitter;
public var percentTime:Number;// = 0
public var INFO:Array;
private var buildPhase:uint;// = 0
public var aiCheck:aiOrder;
private var aniTime:uint;// = 0
public var baseId:uint;
private var base:_base;
public var buildSide:Boolean;// = false
private var currentTime:Number;// = 0
private var buildCommand:uint;// = 0
public var autoBuild:Boolean;// = false
public function baseBuilding():void{
unitLink = null;
hitter = new _hitter();
base = new _base();
bitmap = null;
baseId = new uint();
currentBuilding = 0;
maxTime = 0;
autoBuild = false;
currentTime = 0;
aniTime = 0;
percentTime = 0;
INFO = new Array();
working = false;
buildSide = false;
buildCommand = 0;
aniTimeLimit = 0;
buildPhase = 0;
super();
techSend = null;
addChild(base);
addChildAt(hitter, 0);
INFO = buildingData.LIST[currentBuilding];
render(INFO[1]);
gameKon.theStage.addEventListener(MouseEvent.MOUSE_DOWN, selectBase);
gameKon.displayArray.push(this);
gameKon.buildingArray.push(this);
aiCheck = null;
}
public function destroy():void{
option = optionData.LIST[0];
INFO = buildingData.LIST[0];
buildSwap();
}
public function killEvents():void{
gameKon.theStage.removeEventListener(MouseEvent.MOUSE_DOWN, selectBase);
parent.removeEventListener(Event.ENTER_FRAME, animateBuilding);
parent.removeEventListener(Event.ENTER_FRAME, work);
}
private function work(event:Event):void{
var usePos:uint;
var copyArray:Array;
var scan_b:*;
var missileTarget:String;
var vars:Object;
var q:*;
var d:*;
if (currentTime < maxTime){
currentTime++;
percentTime = (currentTime / maxTime);
if (gameKon.selectedBuilding == this){
gameKon.theRoot.buildBar.width = (percentTime * 150.5);
};
} else {
if (((gameKon.theRoot.gameRunning) && (((((gameKon.theRoot.singlePlayerMode) || ((ownBy == gameKon.playerNow)))) || (((ownBy.aiOn) && (gameKon.theRoot.roomMaster))))))){
if (aiCheck != null){
aiCheck.onHold = false;
if (techSend != null){
techSend.techLevel++;
techSend.techingNow = false;
techSend = null;
};
usePos = ownBy.POS;
} else {
usePos = gameKon.theRoot.clientPlayer[1];
};
if (option.buildMissile != null){
copyArray = new Array();
for (scan_b in ownBy.eteam.all) {
copyArray.push({ID:ownBy.eteam.all[scan_b].unitId, xPOS:ownBy.eteam.all[scan_b].x});
};
if (ownBy.eteam == unitKon.Team2){
copyArray.sortOn("xPOS", Array.NUMERIC);
} else {
copyArray.sortOn("xPOS", (Array.DESCENDING | Array.NUMERIC));
};
missileTarget = copyArray[0].ID;
copyArray = null;
if (gameKon.theRoot.singlePlayerMode){
unitKon.addMissile(missileTarget, parent.x, parent.y);
} else {
vars = new Object();
vars.tar = missileTarget;
vars.px = parent.x;
vars.py = parent.y;
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "createMissile");
};
};
if (option.buildUnits != null){
for (q in option.buildUnits) {
if (gameKon.theRoot.singlePlayerMode){
unitKon.addUnit(ownBy, option.buildUnits[q]);
} else {
vars = new Object();
vars.id = option.buildUnits[q];
vars.pos = usePos;
vars.unitId = unitKon.getNewId(gameKon.playerNow);
vars.rand1 = Math.random();
vars.rand2 = Math.random();
vars.rand3 = Math.random();
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "createUnit");
};
};
};
};
if (option.buildOrder != null){
if ((((ownBy == gameKon.playerNow)) && (gameKon.theRoot.singlePlayerMode))){
if (chatBody.needBuild == option.buildOrder){
chatBody.gotBuild = true;
chatBody.sendEv("B_RIGHT");
} else {
chatBody.sendEv("B_WRONG");
};
};
buildSwap();
INFO = buildingData.LIST[option.buildOrder];
currentBuilding = option.buildOrder;
};
ownBy.addRes(0, option.buildResource[0]);
ownBy.addRes(1, option.buildResource[1]);
ownBy.addRes(2, option.buildResource[2]);
if (option.buildStock != null){
ownBy.stock[option.buildStock] = (ownBy.stock[option.buildStock] + 1);
};
if (option.buildTech != null){
ownBy.tech[option.buildTech] = (ownBy.tech[option.buildTech] + 1);
};
working = false;
if (gameKon.selectedBuilding == this){
displayKon.updateOptions();
};
parent.removeEventListener(Event.ENTER_FRAME, work);
if (gameKon.selectedBuilding == this){
gameKon.theRoot.buildBar.visible = false;
} else {
base.innerFrame.gotoAndStop("basic");
};
if (option.buildOrder != null){
if ((((INFO.autoBuild == null)) || (ownBy.aiOn))){
autoBuild = false;
} else {
d = optionData.LIST[INFO.options[INFO.autoBuild]];
autoBuild = true;
option = d;
maxTime = (d[3] * 30);
};
};
if (autoBuild){
gameKon.doOption(option, false, false, ownBy, this, false, true);
};
};
}
private function buildSwap():void{
buildPhase = 0;
if (currentBuilding != 0){
if (option.buildOrder == 0){
buildCommand = 0;
} else {
buildCommand = 2;
};
aniTimeLimit = 18;
base.bgh.gotoAndPlay("Down");
soundKon.playSound(3, 2, buildSide);
} else {
soundKon.playSound(3, 1, buildSide);
buildCommand = 1;
aniTimeLimit = 15;
base.bc.play();
};
aniTime = 0;
parent.addEventListener(Event.ENTER_FRAME, animateBuilding);
}
public function fixColor(col:String):void{
var addColor:Object;
var colorRim:*;
addColor = (getDefinitionByName(("baseRim_" + col)) as Class);
colorRim = new (addColor);
base.innerFrame.addChildAt(colorRim, 0);
}
public function pushBuild():void{
ownBy.builds.push(this);
}
private function render(r:uint):void{
if (bitmap != null){
base.bgh.bgi.removeChildAt(0);
};
bitmap = new Bitmap(renderMachine.buildings[r]);
base.bgh.bgi.addChild(bitmap);
bitmap.scaleX = renderMachine.poly;
bitmap.scaleY = renderMachine.poly;
}
public function unselBase():void{
if (working == false){
base.innerFrame.gotoAndStop("basic");
} else {
base.innerFrame.gotoAndStop("working");
};
}
public function cancelWork():void{
working = false;
autoBuild = false;
if (gameKon.selectedBuilding == this){
displayKon.updateOptions();
};
gameKon.theRoot.buildBar.visible = false;
parent.removeEventListener(Event.ENTER_FRAME, work);
if (gameKon.selectedBuilding == this){
base.innerFrame.gotoAndStop("selected");
} else {
base.innerFrame.gotoAndStop("basic");
};
}
public function beginWork():void{
currentTime = 0;
working = true;
if (gameKon.selectedBuilding == this){
gameKon.theRoot.buildBar.visible = true;
gameKon.cText2 = option.tip;
if (gameKon.tippingWork){
toolTip.tip(gameKon.cText2, 1);
};
displayKon.updateOptions();
} else {
base.innerFrame.gotoAndStop("working");
};
parent.addEventListener(Event.ENTER_FRAME, work);
}
private function animateBuilding(event:Event):void{
if (buildCommand == 3){
parent.removeEventListener(Event.ENTER_FRAME, animateBuilding);
};
if (aniTime < aniTimeLimit){
aniTime++;
} else {
aniTime = 0;
buildPhase++;
if (buildCommand == 0){
base.bc.play();
buildCommand = 3;
};
if (buildCommand == 1){
base.bgh.visible = true;
render(INFO[1]);
base.bgh.gotoAndPlay("Up");
buildCommand = 3;
};
if (buildCommand == 2){
if (buildPhase == 1){
aniTimeLimit = 20;
base.bc.play();
};
if (buildPhase == 2){
aniTimeLimit = 15;
base.bc.play();
};
if (buildPhase == 3){
render(INFO[1]);
base.bgh.gotoAndPlay("Up");
buildCommand = 3;
};
};
};
}
private function selectBase(event:MouseEvent):void{
if (hitter.hitTestPoint((((parent.parent.x + parent.x) + this.x) + mouseX), (((parent.parent.y + parent.y) + this.y) + mouseY), false)){
if (unitLink != null){
if (unitLink.life > 0){
displayKon.updateUnit([unitLink]);
base.innerFrame.gotoAndStop("selected");
};
} else {
gameKon.unselectBuilding();
gameKon.selectedBuilding = this;
base.innerFrame.gotoAndStop("selected");
displayKon.updateOptions();
if (working == true){
gameKon.cText2 = option.tip;
gameKon.theRoot.buildBar.width = (percentTime * 150.5);
gameKon.theRoot.buildBar.visible = true;
} else {
gameKon.theRoot.buildBar.visible = false;
};
};
};
}
}
}//package
Section 112
//baseFrame (baseFrame)
package {
import flash.display.*;
public dynamic class baseFrame extends MovieClip {
public function baseFrame(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 113
//baseGraphicsMain (baseGraphicsMain)
package {
import flash.display.*;
public dynamic class baseGraphicsMain extends MovieClip {
public function baseGraphicsMain(){
super();
}
}
}//package
Section 114
//baseKon (baseKon)
package {
import flash.display.*;
public class baseKon extends gameKon {
private var cF:Number;// = 0.625
public var BaseHolder2:Sprite;
private var baseX:Array;
private var baseY:Array;
private var r:Number;// = 115
public var BaseHolder:Sprite;
public function baseKon():void{
var i:*;
var Base:baseBuilding;
baseX = new Array();
baseY = new Array();
r = 115;
cF = 0.625;
BaseHolder = new Sprite();
BaseHolder2 = new Sprite();
super();
baseX.push(0);
baseX.push((r / 2));
baseX.push((-(r) / 2));
baseX.push(r);
baseX.push(0);
baseX.push(-(r));
baseX.push((r / 2));
baseX.push((-(r) / 2));
baseX.push(0);
baseY.push((-(r) * cF));
baseY.push(((-(r) / 2) * cF));
baseY.push(((-(r) / 2) * cF));
baseY.push(0);
baseY.push(0);
baseY.push(0);
baseY.push(((r / 2) * cF));
baseY.push(((r / 2) * cF));
baseY.push((r * cF));
for (i in baseX) {
Base = new baseBuilding();
Base.buildSide = false;
BaseHolder.addChild(Base);
Base.x = baseX[i];
Base.y = baseY[i];
};
for (i in baseX) {
Base = new baseBuilding();
Base.buildSide = true;
BaseHolder2.addChild(Base);
Base.x = baseX[i];
Base.y = baseY[i];
};
}
}
}//package
Section 115
//baseRim_Blue (baseRim_Blue)
package {
import flash.display.*;
public dynamic class baseRim_Blue extends MovieClip {
public function baseRim_Blue(){
super();
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 116
//baseRim_Green (baseRim_Green)
package {
import flash.display.*;
public dynamic class baseRim_Green extends MovieClip {
public function baseRim_Green(){
super();
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 117
//baseRim_Red (baseRim_Red)
package {
import flash.display.*;
public dynamic class baseRim_Red extends MovieClip {
public function baseRim_Red(){
super();
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 118
//baseRim_White (baseRim_White)
package {
import flash.display.*;
public dynamic class baseRim_White extends MovieClip {
public function baseRim_White(){
super();
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 119
//baseRim_Yellow (baseRim_Yellow)
package {
import flash.display.*;
public dynamic class baseRim_Yellow extends MovieClip {
public function baseRim_Yellow(){
super();
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 120
//Beat1 (Beat1)
package {
import flash.media.*;
public dynamic class Beat1 extends Sound {
public function Beat1(){
super();
}
}
}//package
Section 121
//Beat2 (Beat2)
package {
import flash.media.*;
public dynamic class Beat2 extends Sound {
public function Beat2(){
super();
}
}
}//package
Section 122
//Beat3 (Beat3)
package {
import flash.media.*;
public dynamic class Beat3 extends Sound {
public function Beat3(){
super();
}
}
}//package
Section 123
//Beat4 (Beat4)
package {
import flash.media.*;
public dynamic class Beat4 extends Sound {
public function Beat4(){
super();
}
}
}//package
Section 124
//Beat5 (Beat5)
package {
import flash.media.*;
public dynamic class Beat5 extends Sound {
public function Beat5(){
super();
}
}
}//package
Section 125
//buildingData (buildingData)
package {
public class buildingData {
private var iN:Number;// = -1
private var build:Array;
public static var LIST:Array = new Array();
public function buildingData():void{
iN = -1;
build = new Array();
super();
make("Ground Zero", 0, "This is an underground construction site.");
build.options = [2, 3, 4, 5, 6, 7, 8, null];
make("Main", 1, "Main");
build.options = [null, null, null, null, null, null, null, null];
make("Outpost", 2, "This is a Tier-1 unit deployment structure.");
build.options = [13, 14, 44, 9, null, null, null, 0];
make("Forge", 5, "This is a Tier-1 unit deployment structure.");
build.options = [16, 15, 35, 10, null, null, null, 0];
make("Hospital", 12, "This is a Tier-1 hybrid structure.");
build.options = [25, 17, 45, 0, null, null, null, null];
make("Bank", 10, "This is a Tier-1 resource structure.");
build.options = [26, 11, 0, null, null, null, null, null];
build.autoBuild = 0;
make("Armory", 13, "This is a Tier-2 resource structure.");
build.options = [31, 30, 32, 47, null, null, null, 0];
make("Generator", 8, "This is a Tier-1 resource structure.");
build.options = [27, 12, 0, null, null, null, null, null];
build.autoBuild = 0;
make("Special Operations", 14, "This is a Tier-3 weapons structure.");
build.options = [37, 40, 48, 0, null, null, null, null];
make("Barracks", 3, "This is a Tier-2 unit deployment structure.");
build.options = [13, 14, 24, 38, 44, 33, null, 0];
make("Manufactory", 6, "This is a Tier-2 unit deployment structure.");
build.options = [16, 15, 19, 39, 35, 34, null, 0];
make("Arsenal", 4, "This is a Tier-3 unit deployment structure.");
build.options = [13, 14, 24, 18, 22, 23, 44, 0];
make("Mechanics Terminal", 7, "This is a Tier-3 unit deployment structure.");
build.options = [16, 15, 19, 20, 21, 43, 35, 0];
make("Treasury", 11, "This is a Tier-3 resource structure.");
build.options = [28, 0, null, null, null, null, null, null];
build.autoBuild = 0;
make("Solar Grid", 9, "This is a Tier-3 resource structure.");
build.options = [29, 46, 0, null, null, null, null, null];
build.autoBuild = 0;
make("Avionics Terminal", 2, "This is a Tier-2 unit deployment structure.");
build.options = [42, null, 34, 0, null, null, null, null];
}
private function make(a:String, b:uint, c:String):void{
iN++;
LIST[iN] = new Array();
LIST[iN].push(a, b, c);
LIST[iN].options = new Array();
LIST[iN].autoBuild = null;
build = LIST[iN];
}
}
}//package
Section 126
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
public function Button_disabledSkin(){
super();
}
}
}//package
Section 127
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
public function Button_downSkin(){
super();
}
}
}//package
Section 128
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
public function Button_emphasizedSkin(){
super();
}
}
}//package
Section 129
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
public function Button_overSkin(){
super();
}
}
}//package
Section 130
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
public function Button_selectedDisabledSkin(){
super();
}
}
}//package
Section 131
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
public function Button_selectedDownSkin(){
super();
}
}
}//package
Section 132
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
public function Button_selectedOverSkin(){
super();
}
}
}//package
Section 133
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
public function Button_selectedUpSkin(){
super();
}
}
}//package
Section 134
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
public function Button_upSkin(){
super();
}
}
}//package
Section 135
//CapitalistTheme (CapitalistTheme)
package {
import flash.media.*;
public dynamic class CapitalistTheme extends Sound {
public function CapitalistTheme(){
super();
}
}
}//package
Section 136
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
public function CellRenderer_disabledSkin(){
super();
}
}
}//package
Section 137
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
public function CellRenderer_downSkin(){
super();
}
}
}//package
Section 138
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
public function CellRenderer_overSkin(){
super();
}
}
}//package
Section 139
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
public function CellRenderer_selectedDisabledSkin(){
super();
}
}
}//package
Section 140
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
public function CellRenderer_selectedDownSkin(){
super();
}
}
}//package
Section 141
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
public function CellRenderer_selectedOverSkin(){
super();
}
}
}//package
Section 142
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
public function CellRenderer_selectedUpSkin(){
super();
}
}
}//package
Section 143
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
public function CellRenderer_upSkin(){
super();
}
}
}//package
Section 144
//chatBody (chatBody)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class chatBody extends Sprite {
private static var RE_HUMAN:RegExp = /are you human|are you a person|who are you|are you real|are u human|are u a person/i;
public static var C_NAME:String;
private static var previousAction:uint;
public static var C_LIKE:String;
public static var C_DO:String;
private static var RE_NAME:RegExp = /what(s| is|'s) (your|ur) (name|full name)/i;
public static var pName:String;
private static var RE_DO:RegExp = /(what|wut|wat) (should i|do u want me to ) (do|make|build)|what do i (make|build|do)/i;
private static var RE_LIKE:RegExp = /(what|wut|wt|wat) do (you|u) like|what's your favourite thing/i;
private static var RE_HOW:RegExp = /how?|how do i|how/i;
private static var RE_SORRY:RegExp = /apologies|i apologize|sorry|sry|soz/i;
private static var RE_SHUT:RegExp = /that's enough|shut up|shutup|shaddap|stop it|stop talking|be quiet/i;
public static var gotBuild:Boolean;
private static var C:Sprite;
private static var RE_NO:RegExp = /no|nope|nah|naw|not really/i;
private static var RE_WHAT:RegExp = /what|which/i;
private static var T:Timer;
private static var RE_THANKS:RegExp = /thanks|thankyou|thank you|ty/i;
private static var missionMode:Boolean = false;
public static var chatOn:Boolean = false;
private static var previousTime:uint;
private static var RE_OK:RegExp = /sure|ok|yes|alright|aight|okay|yes sir|you got it|uh huh|righto|ya|yeah|right|ye|yup|yep|fine/i;
public static var C_MAKE:String;
public static var needBuild:uint;
private static var noMoreDanger:uint;
private static var RE_MAKE:RegExp = /(what|wat|wut) (r|are|will) (you|u) (going to do|doing|do|make|making|building|build|going to make)/i;
public static var addStandard:Boolean;
private static var RE_HI:RegExp = /hey|hi|hello|greetings|sup|yo|heya|oi|morning|good evening| good morning|howdy|gday/i;
private static var noMoreUpgrade:uint;
private static var delayArray:Array;
private static var RE_INSULT:RegExp = /(fuck|fuk) (you|u|off)|sod off|(you|u) (are stupid|suck|r stupid)|(you're|ur) (a moron|stupid|dumb)/i;
private static var RE_WHY:RegExp = /why?|what for?/i;
public static var stepCount:uint;
private static var RE_YES:RegExp = /sure|alright|ok|okay|yes|ya|yes|yeah|yeh|yessir|si|oui|ja|why not|yup|yep|ye|please|fine/i;
private static var RE_HELP:RegExp = /help|hlp/i;
private static var RE_HUH:RegExp = /huh?|what('s| is|) (going on|happening|happened)|/i;
private static var RE_AGE:RegExp = /how old (are|r) (you|u)|what(s|'s) (your|ur) age/i;
public static var C_AGE:String;
public static var C_GREET:String;
public static var pCol:uint;
private static var previousDanger:uint;
public function chatBody(){
super();
}
private static function tut_1(e:chatEvent):void{
delaySay("Alright! That's what I like to hear.", 2);
resetAll();
chatOrder.SET(true, 10, 3);
}
private static function tut_2(e:chatEvent):void{
delaySay("Good work.", 2);
gotBuild = false;
needBuild = 9;
resetAll();
chatOrder.SET(true, 7, 8);
}
private static function tut_4(e:chatEvent):void{
delaySay("Good! I like eager people.", 2);
resetAll();
chatOrder.SET(true, 15, 14);
}
private static function tut_5(e:chatEvent):void{
delaySay("Alright. You know all the basics anyway, so good luck, and let's win this!", 2);
resetAll();
setAction();
chatOrder.SET(false, 0, 0);
}
private static function tut_6(e:chatEvent):void{
delaySay("Wonderful. You learn fast.", 2);
resetAll();
chatOrder.SET(true, 15, 15);
}
private static function tut_7(e:chatEvent):void{
delaySay("Ok for example, when you select Outpost, you can press 1 for Marines, 2 for Tanks, and 3 for Recruit. I hope it's clear now...", 2);
resetAll();
chatOrder.SET(true, 15, 15);
}
private static function insult(e:chatEvent):void{
delaySay("How dare you say that to me!", 2);
}
public static function init(t:uint):void{
noMoreUpgrade = 100;
noMoreDanger = 60;
previousAction = 0;
previousTime = 0;
previousDanger = 0;
T = new Timer(500);
T.start();
T.addEventListener(TimerEvent.TIMER, putItUp, false, 0, true);
stepCount = 0;
delayArray = new Array();
gotBuild = false;
addStandard = false;
needBuild = 99;
chatOn = true;
missionMode = true;
if (t == 0){
addStandard = true;
missionMode = false;
chatOrder.SET(false, 0, 0);
} else {
if (t == 1){
needBuild = 2;
missionMode = false;
chatOrder.SET(true, 3, 1);
} else {
if (t == 2){
pName = "Cpt. Jorin";
pCol = 2;
needBuild = 2;
C_NAME = "Hans Jorin";
chatOrder.SET(true, 3, 1, 1);
} else {
if (t == 3){
pName = "Cpt. Beatrix";
C_NAME = "Erika Beatrix";
chatOrder.SET(true, 3, 1, 2);
} else {
if (t == 4){
pName = "General Glastondale";
C_NAME = "Sir Miles Glastondale";
pCol = 2;
chatOrder.SET(true, 240, 1, 3);
} else {
if (t == 5){
pName = "Cpt. Beatrix";
C_NAME = "Erika Beatrix";
chatOrder.SET(true, 7, 1, 4);
} else {
if (t == 6){
pName = "General Mortfang";
C_NAME = "Lux Mortfang";
chatOrder.SET(true, 7, 1, 5);
} else {
if (t == 7){
pName = "Haxel";
C_NAME = "Julio Haxel";
chatOrder.SET(true, 7, 1, 6);
};
};
};
};
};
};
};
};
resetAll(addStandard);
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
greetTut();
break;
case 2:
tut1();
break;
case 3:
tut2();
break;
case 4:
tut3();
break;
case 5:
tut4();
break;
case 6:
tut5();
break;
case 7:
tut6();
break;
case 8:
tut7();
break;
case 9:
tut8();
break;
case 10:
tut9();
break;
case 11:
tut10();
break;
case 12:
tut11();
break;
case 13:
tut12();
break;
case 14:
tut13();
break;
case 15:
tut14();
break;
case 16:
tut15();
break;
case 17:
tut16();
break;
case 18:
tut17();
break;
case 19:
tut18();
break;
};
}
private static function a_save2(e:chatEvent):void{
jimBob(5, "We're not in immediate danger, but I'm out of resources. I'm going to save up.");
}
private static function tut_3(e:chatEvent):void{
delaySay("No! You've made the wrong building! You don't really listen to me, do you?", 2);
}
private static function a_group(e:chatEvent):void{
jimBob(1, "Alright, I'm going to try form an attack group. Back me up.");
addEar(chatEvent.SAY_OK, ty);
}
public static function dealWithA(u:uint):void{
switch (u){
case 0:
break;
};
}
private static function tut_8(e:chatEvent):void{
delaySay("Beautiful. Now you can make Snipers. These guys have armor piercing bullets, and they can even outrange the enemy base defenses.", 2);
resetAll();
chatOrder.SET(true, 25, 16);
}
public static function setAction():void{
addEar("A_GROUP", a_group);
addEar("A_ATTACK", a_attack);
addEar("A_SAVE", a_save);
addEar("A_RESUME", a_resume);
addEar("A_SAVE2", a_save2);
addEar("A_C1", a_c1);
addEar("A_C2", a_c2);
addEar("A_C3", a_c3);
addEar("A_C4", a_c4);
addEar("A_C5", a_c5);
addEar("A_C6", a_c6);
addEar("A_C7", a_c7);
addEar("A_C8", a_c8);
addEar("A_C9", a_c9);
addEar("A_C11", a_c11);
addEar("C_DO", ac_do);
addEar("C_NAME", ac_name);
addEar("C_AGE", ac_age);
addEar("C_LIKE", ac_like);
addEar("C_MAKE", ac_make);
addEar("C_HUMAN", ac_human);
}
private static function greetTut():void{
sayWhat("Hello! Welcome to the tutorial mission.");
resetAll();
chatOrder.SET(true, 4, 2);
}
public static function sayWhat(r:String):void{
gameKon.theRoot.doChat(r, pName, pCol);
}
public static function dealWith(r:String):void{
if (chatOn){
if (RE_SORRY.test(r)){
sendEv(chatEvent.SAY_SORRY);
};
if (RE_THANKS.test(r)){
sendEv(chatEvent.THANKS);
};
if (RE_HELP.test(r)){
sendEv(chatEvent.HELP);
};
if (RE_INSULT.test(r)){
sendEv(chatEvent.INSULT);
};
if (RE_HOW.test(r)){
sendEv(chatEvent.SAY_HOW);
};
if (RE_WHAT.test(r)){
sendEv(chatEvent.SAY_WHAT);
};
if (RE_WHY.test(r)){
sendEv(chatEvent.SAY_WHY);
};
if (RE_HUH.test(r)){
sendEv("HUH");
};
if (RE_SHUT.test(r)){
sendEv("SHUTUP");
};
if (RE_HUMAN.test(r)){
sendEv("C_HUMAN");
};
if (RE_NAME.test(r)){
sendEv("C_NAME");
};
if (RE_AGE.test(r)){
sendEv("C_AGE");
};
if (RE_LIKE.test(r)){
sendEv("C_LIKE");
};
if (RE_MAKE.test(r)){
sendEv("C_MAKE");
};
if (RE_DO.test(r)){
sendEv("C_DO");
};
if (RE_HI.test(r)){
sendEv(chatEvent.SAY_HI);
};
if (RE_OK.test(r)){
sendEv(chatEvent.SAY_OK);
};
if (RE_NO.test(r)){
sendEv(chatEvent.SAY_NO);
} else {
if (RE_YES.test(r)){
sendEv(chatEvent.SAY_YES);
};
};
};
}
public static function sendEv(r:String):void{
if (chatOn){
C.dispatchEvent(new chatEvent(r));
};
}
private static function talk_2(e:chatEvent):void{
delaySay("Alright then. Let us be silent.", 2);
resetAll(true);
}
public static function killAll():void{
if (chatOn){
T.stop();
T.removeEventListener(TimerEvent.TIMER, putItUp);
T = null;
C = null;
chatOn = false;
};
}
private static function talk_1(e:chatEvent):void{
delaySay("Excellent. I will give you my battle reports.", 2);
resetAll();
setAction();
}
private static function ac_age(e:chatEvent):void{
delaySay(C_AGE, 4);
resetAll();
setAction();
}
public static function delaySay(r:String, t:uint):void{
delayArray.push({T:t, R:r});
}
private static function tut10():void{
sayWhat("You can also make your orders repeat themselves by holding Shift when you press it. It will continute to build as long as you have the resources.");
resetAll();
chatOrder.SET(true, 16, 12);
}
private static function tut11():void{
sayWhat("Also, learn to command the troops that you have on the field. Drag a box around them to select them.");
resetAll();
chatOrder.SET(true, 20, 13);
}
private static function tut12():void{
sayWhat("That's pretty much all the basic stuff. Do you want to learn more? Yes or no?");
resetAll();
chatOrder.SET(false, 0, 0);
addEar(chatEvent.SAY_YES, tut_4);
addEar(chatEvent.SAY_NO, tut_5);
}
private static function tut13():void{
sayWhat("There are hotkeys for all the options. 1, 2, 3, 4, Q, W, E and R. They correspond to the layout of the buttons. You understand?");
resetAll();
chatOrder.SET(false, 0, 0);
addEar(chatEvent.SAY_YES, tut_6);
addEar(chatEvent.SAY_NO, tut_7);
}
private static function tut15():void{
sayWhat("Snipers are expensive though, so you need to control them well. For example, move them back while they reload to keep them away from enemy fire.");
chatOrder.SET(true, 40, 17);
resetAll();
}
private static function greet_1(e:chatEvent):void{
delaySay("Hello.", 3);
resetAll();
chatOrder.SET(true, 6, 19);
}
private static function tut14():void{
sayWhat("Right, moving on... You'll need to ugrade your Outpost if you want to get the best troops. Upgrade it to a Barracks.");
resetAll();
addEar("B_RIGHT", tut_8);
chatOrder.SET(false, 0, 0);
}
private static function tut2():void{
sayWhat("Ok. Basics first. Red bases are yours and Blue are mine. We don't share troops, technology, or funds.");
resetAll();
chatOrder.SET(true, 13, 4);
}
private static function tut4():void{
sayWhat("You can see the enemy's base by scrolling the screen to the right, with either your mouse, or the arrow keys.");
resetAll();
chatOrder.SET(true, 15, 6);
}
private static function tut5():void{
sayWhat("Right... Now I need you to start building something. Click on one of your Red platforms and build an Outpost.");
resetAll();
if (!gotBuild){
chatOrder.SET(false, 0, 0);
addEar("B_RIGHT", tut_2);
addEar("B_WRONG", tut_3);
} else {
gotBuild = false;
needBuild = 9;
chatOrder.SET(true, 2, 7);
};
}
private static function tut6():void{
sayWhat("Oh, it looks like you already have one.");
resetAll();
chatOrder.SET(true, 20, 8);
}
private static function ty(e:chatEvent):void{
delaySay("Thanks.", 2);
C.removeEventListener(chatEvent.SAY_OK, ty);
}
private static function tut3():void{
sayWhat("But we do have the same objective. Protect our central base, and destroy all enemy forces.");
resetAll();
chatOrder.SET(true, 13, 5);
}
private static function ac_name(e:chatEvent):void{
delaySay(C_NAME, 4);
resetAll();
setAction();
}
private static function tut18():void{
sayWhat("Would you like me to talk?");
chatOrder.SET(false, 0, 0);
resetAll();
addEar(chatEvent.SAY_YES, talk_1);
addEar(chatEvent.SAY_NO, talk_2);
}
private static function tut7():void{
sayWhat("Now make some Marines. They will automatically advance and attack.");
resetAll();
chatOrder.SET(true, 15, 9);
}
private static function tut8():void{
sayWhat("If you want them to stop in front of our base instead, toggle rally mode by pressing X.");
resetAll();
chatOrder.SET(true, 16, 10);
}
private static function tut16():void{
sayWhat("Alright, you should be getting a hang of this now.");
chatOrder.SET(true, 15, 18);
resetAll();
}
private static function tut17():void{
sayWhat("Let 's smash them to the ground!");
chatOrder.SET(false, 0, 0);
resetAll();
setAction();
}
private static function ac_like(e:chatEvent):void{
delaySay(C_LIKE, 4);
resetAll();
setAction();
}
private static function a_save(e:chatEvent):void{
jimBob(3, "I'm saving up so I can upgrade.");
}
private static function tut1():void{
sayWhat("The enemy is already mobilizing, so do what I say and we'll be fine. Alright?");
resetAll();
addEar(chatEvent.SAY_OK, tut_1);
chatOrder.SET(true, 25, 3);
}
private static function tut9():void{
sayWhat("When you need additional manpower, use the Recruit option from the Outpost.");
resetAll();
chatOrder.SET(true, 16, 11);
}
private static function shut(e:chatEvent):void{
delaySay("Alright... Fine.", 2);
resetAll(true);
chatOrder.SET(false, 0, 0);
}
private static function good(e:chatEvent):void{
delaySay("Outstanding.", 2);
resetAll();
setAction();
}
private static function np(e:chatEvent):void{
delaySay("Alright don't worry. We'll think of something.", 2);
resetAll();
setAction();
}
private static function jimBob(a:uint, s:String):void{
if (previousAction != a){
if (a > 5){
if (previousDanger != a){
if (previousAction !== 6){
if (noMoreDanger == 0){
trace("BOO");
previousDanger = a;
previousAction = 6;
noMoreDanger = 80;
previousTime = 5000;
sayWhat(s);
resetAll();
setAction();
};
};
};
} else {
if (a == 3){
if (noMoreUpgrade == 0){
previousAction = a;
noMoreUpgrade = 250;
previousTime = 5000;
sayWhat(s);
resetAll();
setAction();
};
} else {
previousAction = a;
previousTime = 5000;
sayWhat(s);
resetAll();
setAction();
};
};
};
}
private static function a_resume(e:chatEvent):void{
jimBob(4, "No major enemy threat detected.");
}
private static function a_c1(e:chatEvent):void{
jimBob(6, "They have a lot of infantry. Tanks will be good against them.");
}
private static function a_c3(e:chatEvent):void{
jimBob(8, "I think now is a good time to deploy a Phantom.");
}
private static function a_c6(e:chatEvent):void{
jimBob(11, "Let's bring down those Anti-Air Spiders.");
}
public static function resetAll(AS:Boolean=false):void{
C = new Sprite();
if (!missionMode){
addEar("SHUTUP", shut);
} else {
addEar("SHUTUP", shut2);
};
addEar("INSULT", insult);
if (AS){
addEar(chatEvent.SAY_HI, greet_1);
};
}
private static function putItUp(e:TimerEvent):void{
var i:*;
stepCount++;
if (noMoreDanger > 0){
noMoreDanger--;
trace(("NMD " + noMoreDanger));
};
if (noMoreUpgrade > 0){
noMoreUpgrade--;
};
if (previousTime > 0){
previousTime--;
} else {
previousAction = 0;
};
for (i in delayArray) {
delayArray[i].T--;
if (delayArray[i].T == 0){
sayWhat(delayArray[i].R);
delayArray.splice(i, 1);
};
};
if (chatOrder.act){
if (stepCount >= chatOrder.timeCount){
chatOrder.go();
};
};
}
private static function a_c4(e:chatEvent):void{
jimBob(9, "Sniper threat detected! Phantoms will be our best counter.");
}
private static function ac_human(e:chatEvent):void{
delaySay("No of course not. I thought you knew that already.", 2);
resetAll();
setAction();
}
private static function a_c7(e:chatEvent):void{
jimBob(12, "Air threat detected! Respond with Sakata Mk-II and Marines!");
}
private static function a_c9(e:chatEvent):void{
jimBob(14, "A Gladiator! Send in everything you've got, we have to take it down!");
}
private static function a_c2(e:chatEvent):void{
jimBob(7, "Threat from ground to ground units. Scouts and Phantoms would be ideal now.");
}
private static function a_c5(e:chatEvent):void{
jimBob(10, "Threat from single target attackers, we shoud shield our forces with Romans.");
}
private static function a_c8(e:chatEvent):void{
jimBob(13, "They've got a Black Queen! Try to damage it during its 12 second reload!");
}
private static function a_c11(e:chatEvent):void{
jimBob(15, "We need some Positron weapons to take down that armor. Can you send in any Hover Tanks or Snipers?");
addEar(chatEvent.SAY_OK, good);
addEar(chatEvent.SAY_YES, good);
addEar(chatEvent.SAY_NO, np);
}
private static function a_attack(e:chatEvent):void{
jimBob(2, "Sending my men forward now! Go! Go!");
}
private static function ac_do(e:chatEvent):void{
delaySay(C_DO, 4);
resetAll();
setAction();
}
private static function ac_make(e:chatEvent):void{
delaySay(C_MAKE, 4);
resetAll();
setAction();
}
public static function addEar(r:String, f:Function):void{
C.addEventListener(r, f, false, 0, true);
}
private static function shut2(e:chatEvent):void{
delaySay("...", 2);
}
}
}//package
Section 145
//chatEvent (chatEvent)
package {
import flash.events.*;
public class chatEvent extends Event {
public static var HELP:String = "HELP";
public static var SAY_HI:String = "SAY_HI";
public static var SAY_SORRY:String = "SAY_SORRY";
public static var INSULT:String = "INSULT";
public static var SAY_OK:String = "SAY_OK";
public static var SAY_YES:String = "SAY_YES";
public static var THANKS:String = "THANKS";
public static var SAY_WHERE:String = "SAY_WHERE";
public static var SAY_HUH:String = "SAY_HUH";
public static var SAY_WHEN:String = "SAY_WHEN";
public static var SAY_WHY:String = "SAY_WHY";
public static var SAY_NO:String = "SAY_NO";
public static var SAY_WHAT:String = "SAY_WHAT";
public static var SAY_WHO:String = "SAY_WHO";
public static var SAY_HOW:String = "SAY_HOW";
public function chatEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=true):void{
super(type, bubbles, cancelable);
}
}
}//package
Section 146
//chatMission1 (chatMission1)
package {
public class chatMission1 {
public function chatMission1(){
super();
}
private static function res11(ce:chatEvent):void{
chatBody.delaySay("Good job.", 5);
chatBody.resetAll();
chatOrder.SET(true, 11, 11, 1);
}
private static function mission1StartAi():void{
gameKon.theRoot.GameKon.player2.startAi(0, 0, 0);
gameKon.theRoot.GameKon.player3.startAi(0, 1, 2);
gameKon.theRoot.GameKon.player3.setRes(0, 80);
gameKon.theRoot.GameKon.player3.setRes(2, 100);
gameKon.theRoot.GameKon.player2.AI.AiStrategy.forceTech = 1;
gameKon.theRoot.GameKon.player3.AI.AiStrategy.forceTech = 1;
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Hey Baylet, it's me. Do you copy?");
chatBody.resetAll();
chatOrder.SET(true, 25, 2, 1);
chatBody.addEar(chatEvent.SAY_HI, res1);
chatBody.addEar(chatEvent.SAY_YES, res1);
chatBody.addEar(chatEvent.SAY_NO, res2);
chatBody.addEar("UNIT_DIED", res10);
break;
case 2:
chatBody.sayWhat("Baylet, are you there? I need you to answer me!");
chatBody.resetAll();
chatOrder.SET(true, 15, 3, 1);
chatBody.addEar(chatEvent.SAY_HI, res1);
chatBody.addEar(chatEvent.SAY_YES, res1);
chatBody.addEar(chatEvent.SAY_OK, res1);
chatBody.addEar(chatEvent.SAY_NO, res2);
chatBody.addEar("UNIT_DIED", res10);
break;
case 3:
chatBody.sayWhat("You can talk to me by pressing Enter, typing something, then pressing Enter again to transmit the message.");
chatBody.resetAll();
chatOrder.SET(false, 0, 0, 1);
chatBody.addEar(chatEvent.SAY_HI, res1);
chatBody.addEar(chatEvent.SAY_OK, res1);
chatBody.addEar(chatEvent.SAY_NO, res2);
chatBody.addEar("UNIT_DIED", res10);
break;
case 4:
chatBody.sayWhat("Again, I'm sorry for waking you up in the middle of the night...");
chatBody.resetAll();
chatOrder.SET(true, 9, 5, 1);
chatBody.addEar("UNIT_DIED", res10);
break;
case 5:
chatBody.sayWhat("But there's been a situation. We've lost contact with all the other settlements.");
chatBody.resetAll();
chatOrder.SET(true, 11, 6, 1);
chatBody.addEar("UNIT_DIED", res10);
break;
case 6:
chatBody.sayWhat("It's probably nothing serious...");
chatBody.resetAll();
chatOrder.SET(true, 10, 7, 1);
chatBody.addEar("UNIT_DIED", res10);
break;
case 7:
chatBody.sayWhat("In any case, I need you to send some men down to Bjorn's base and find out if the same thing's happened to them.");
chatBody.resetAll();
chatOrder.SET(true, 10, 8, 1);
chatBody.addEar("UNIT_DIED", res10);
break;
case 8:
chatBody.sayWhat("First, raise an Outpost on one of your construction platforms.");
chatBody.resetAll();
chatOrder.SET(true, 12, 9, 1);
chatBody.addEar("UNIT_DIED", res10);
chatBody.addEar(chatEvent.SAY_HOW, res4);
chatBody.addEar(chatEvent.SAY_WHY, res5);
break;
case 9:
chatBody.sayWhat("The blue ones are mine, by the way. You have no control over them.");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_HOW, res4);
chatBody.addEar("UNIT_DIED", res10);
if (!chatBody.gotBuild){
chatOrder.SET(true, 30, 10, 1);
chatBody.addEar("B_RIGHT", res11);
chatBody.addEar("B_WRONG", res9);
} else {
chatOrder.SET(true, 10, 20, 1);
};
break;
case 10:
chatBody.sayWhat("Click on one of the empty red platforms at our base and build an Outpost on it.");
chatBody.resetAll();
chatBody.addEar("UNIT_DIED", res10);
if (!chatBody.gotBuild){
chatOrder.SET(false, 0, 0, 0);
chatBody.addEar("B_RIGHT", res11);
chatBody.addEar("B_WRONG", res9);
} else {
chatOrder.SET(true, 10, 20, 1);
};
break;
case 11:
chatBody.sayWhat("Now, make some Marines from the Outpost. They will automatically head towards Bjorn's settlement.");
chatBody.resetAll();
chatBody.addEar("UNIT_DIED", res10);
chatOrder.SET(true, 15, 12, 1);
break;
case 12:
chatBody.sayWhat("We're gonna get to the bottom of this...");
chatBody.resetAll();
chatBody.addEar("UNIT_DIED", res10);
chatOrder.SET(false, 0, 0, 1);
break;
case 13:
chatBody.sayWhat("All stations on high alert! Prepare for retaliation!");
chatBody.resetAll();
mission1StartAi();
chatBody.addEar("SAY_HUH", res7);
chatOrder.SET(true, 20, 14, 1);
break;
case 14:
chatBody.sayWhat("I don't know what happened... Could it be a base malfunction?");
chatBody.resetAll();
chatOrder.SET(true, 6, 15, 1);
break;
case 15:
chatBody.sayWhat("No, wait... Detecting movement from inside their base. There's people behind this!");
chatBody.resetAll();
chatOrder.SET(true, 7, 16, 1);
break;
case 16:
chatBody.sayWhat("Alright, Baylet, are you still there?");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res8);
chatBody.addEar(chatEvent.SAY_HI, res8);
chatOrder.SET(true, 25, 17, 1);
break;
case 17:
chatBody.sayWhat("Baylet! Answer me, dammit!");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res8);
chatBody.addEar(chatEvent.SAY_HI, res8);
chatOrder.SET(false, 0, 0, 1);
break;
case 18:
chatBody.sayWhat("We have to send our attacks in waves. Toggle the rally point by pressing X.");
chatBody.resetAll();
chatOrder.SET(true, 10, 19, 1);
break;
case 19:
chatBody.sayWhat("If your rally point is on, any units you will make gather in front of your base, rather than advance forward.");
chatBody.resetAll();
chatOrder.SET(true, 10, 21, 1);
break;
case 20:
chatBody.sayWhat("Oh, I see you already did that. Very well!");
chatBody.resetAll();
chatOrder.SET(true, 10, 11, 1);
break;
case 21:
chatBody.sayWhat("When you think you have enough troops, drag a box around them to select them, and tell them to advance!");
chatBody.resetAll();
chatOrder.SET(true, 20, 22, 1);
break;
case 22:
chatBody.sayWhat("Remember, our Tanks are good against thier ground units, and our marines can shoot rockets at their flying drones.");
chatBody.resetAll();
chatOrder.SET(true, 15, 23, 1);
break;
case 23:
chatBody.sayWhat("When you need more manpower, you can Recruit them from the Outpost.");
chatBody.resetAll();
chatOrder.SET(true, 12, 24, 1);
break;
case 24:
chatBody.sayWhat("If you hold Shift when you build something, it will put that option into auto-build, repeating itself until you cancel it.");
chatBody.resetAll();
chatOrder.SET(true, 25, 25, 1);
break;
case 25:
chatBody.sayWhat("Do not relent! Stop at nothing to bring them down!");
chatBody.resetAll();
chatOrder.SET(false, 0, 0, 1);
break;
};
}
private static function res1(ce:chatEvent):void{
chatBody.delaySay("Good. Looks like our communication lines are still working.", 6);
chatBody.resetAll();
chatOrder.SET(true, 13, 4, 1);
}
private static function res2(ce:chatEvent):void{
chatBody.delaySay("Stop joking around Baylet, we're on a mission here.", 5);
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_SORRY, res3);
chatOrder.SET(true, 17, 4, 1);
}
private static function res3(ce:chatEvent):void{
chatBody.delaySay("It's fine.", 5);
chatBody.resetAll();
chatOrder.SET(true, 11, 4, 1);
}
private static function res4(ce:chatEvent):void{
chatBody.delaySay("Relax, I'm about to tell you.", 5);
chatBody.resetAll();
chatOrder.SET(true, 13, 10, 1);
}
private static function res5(ce:chatEvent):void{
chatBody.delaySay("Wh-... Because that's our protocal!", 5);
chatBody.resetAll();
chatOrder.SET(true, 15, 9, 1);
}
private static function res6(ce:chatEvent):void{
chatBody.resetAll();
chatOrder.SET(true, 2, 10, 1);
}
private static function res7(ce:chatEvent):void{
chatBody.delaySay("Didn't you see? They just shot at our marines!", 5);
chatBody.resetAll();
chatOrder.SET(true, 18, 14, 1);
}
private static function res8(ce:chatEvent):void{
chatBody.delaySay("Good.", 5);
chatBody.resetAll();
chatOrder.SET(true, 11, 18, 1);
}
private static function res9(ce:chatEvent):void{
chatBody.delaySay("That's the wrong building! I told you to build an Oupost!", 5);
}
private static function res10(ce:chatEvent):void{
chatBody.delaySay("Oh my God... Did they just...", 5);
chatBody.resetAll();
chatOrder.SET(true, 11, 13, 1);
}
}
}//package
Section 147
//chatMission2 (chatMission2)
package {
public class chatMission2 {
public function chatMission2(){
super();
}
private static function res1(ce:chatEvent):void{
chatBody.delaySay("Enjoying the breeze?", 6);
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res2);
chatBody.addEar(chatEvent.SAY_NO, res3);
chatOrder.SET(true, 18, 2, 2);
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Good evening, Jetzul.");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_HI, res1);
chatOrder.SET(true, 30, 2, 2);
break;
case 2:
chatBody.sayWhat("They're going to have heavy security around the Sakata technology.");
chatBody.resetAll();
chatOrder.SET(true, 15, 3, 2);
break;
case 3:
chatBody.sayWhat("Raise a Forge and upgrade it to a Manufactory, so then we can tear them up with our Phantoms.");
chatBody.resetAll();
chatOrder.SET(true, 160, 4, 2);
break;
case 4:
chatBody.sayWhat("Jetzul, I want to see you control those units of yours more! A good captain gives orders!");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_HOW, res4);
chatOrder.SET(true, 300, 5, 2);
break;
case 5:
chatBody.sayWhat("Crush them! The USC are going to have thier communication satellite back up any time now!");
chatBody.resetAll();
chatOrder.SET(false, 0, 0);
break;
};
}
private static function res2(ce:chatEvent):void{
chatBody.delaySay("Spendid! Well that's enough small talk, let's get down to business.", 6);
chatBody.resetAll();
chatOrder.SET(true, 18, 2, 2);
}
private static function res3(ce:chatEvent):void{
chatBody.delaySay("Odd... I guess you belong in prison.", 6);
chatBody.resetAll();
chatOrder.SET(true, 18, 2, 2);
}
private static function res4(ce:chatEvent):void{
chatBody.delaySay("Select troops and pull them back when they are weak, and send them out in groups.", 6);
chatBody.resetAll();
chatOrder.SET(true, 300, 5, 2);
}
}
}//package
Section 148
//chatMission3 (chatMission3)
package {
public class chatMission3 {
public function chatMission3(){
super();
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Hang in there, Baylet! We're on our way!");
chatBody.resetAll();
chatOrder.SET(true, 10, 2, 3);
break;
case 2:
chatBody.sayWhat("We've just arrived... Man the battle stations!");
chatBody.resetAll();
chatOrder.SET(true, 25, 3, 3);
missionStartAi();
break;
case 3:
chatBody.sayWhat("Alright, you've made it this far... Now destroy them!");
chatBody.resetAll();
chatOrder.SET(false, 0, 0, 3);
break;
};
}
private static function missionStartAi():void{
gameKon.theRoot.GameKon.player2.startAi(0, 2, 0);
gameKon.theRoot.GameKon.player2.setRes(0, 80);
gameKon.theRoot.GameKon.player2.setRes(1, 80);
}
}
}//package
Section 149
//chatMission4 (chatMission4)
package {
public class chatMission4 {
public function chatMission4(){
super();
}
private static function res1(ce:chatEvent):void{
chatBody.delaySay("I thought so. Do you know him personally?", 6);
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res3);
chatBody.addEar(chatEvent.SAY_NO, res4);
chatOrder.SET(true, 103, 4, 4);
}
private static function res3(ce:chatEvent):void{
chatBody.delaySay("Really? I suppose we can trust him then...", 6);
chatBody.resetAll();
chatOrder.SET(true, 53, 4, 4);
}
private static function res4(ce:chatEvent):void{
chatBody.delaySay("Me neither. He's probably a USC official himself... Who else could give us such military technology?", 6);
chatBody.resetAll();
chatOrder.SET(true, 53, 4, 4);
}
private static function res5(ce:chatEvent):void{
chatBody.delaySay("You haven't heard?! Have you been living under a rock?", 6);
chatBody.resetAll();
chatOrder.SET(true, 18, 5, 4);
}
private static function res6(ce:chatEvent):void{
chatBody.delaySay("I see. It's a terrifying prospect, isn't it.", 6);
chatBody.resetAll();
chatOrder.SET(true, 28, 10, 4);
}
private static function res7(ce:chatEvent):void{
chatBody.delaySay("You're not easily shaken, are you.", 6);
chatBody.resetAll();
chatOrder.SET(true, 18, 10, 4);
}
private static function res2(ce:chatEvent):void{
chatBody.delaySay("I see... Odd...", 3);
chatBody.resetAll();
chatOrder.SET(true, 53, 4, 4);
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Another fine evening, Jetzul...");
chatBody.resetAll();
chatOrder.SET(true, 10, 2, 4);
break;
case 2:
chatBody.sayWhat("Let's deal with this the old fashioned way.");
chatBody.resetAll();
chatOrder.SET(true, 40, 3, 4);
break;
case 3:
chatBody.sayWhat("Now that we're on a secure channel... Has a person calling himself P been contacting you as well?");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res1);
chatBody.addEar(chatEvent.SAY_NO, res2);
chatOrder.SET(true, 100, 4, 4);
break;
case 4:
chatBody.sayWhat("Jetzul, tell me... Do you believe in the conspiracy?");
chatBody.resetAll();
chatOrder.SET(false, 0, 0);
chatBody.addEar(chatEvent.SAY_WHAT, res5);
chatBody.addEar(chatEvent.SAY_YES, res6);
chatBody.addEar(chatEvent.SAY_NO, res7);
break;
case 5:
chatBody.sayWhat("Okay, you know how the prisoner transfer operation back in 2265 was kept under wraps...");
chatBody.resetAll();
chatOrder.SET(true, 11, 6, 4);
break;
case 6:
chatBody.sayWhat("The Athenians don't even know about us, and all the other labourers here.");
chatBody.resetAll();
chatOrder.SET(true, 11, 7, 4);
break;
case 7:
chatBody.sayWhat("And the rumor is, once they develop the Romans into manual labour andriods, they're going to...");
chatBody.resetAll();
chatOrder.SET(true, 5, 8, 4);
break;
case 8:
chatBody.sayWhat("'Clean up.'");
chatBody.resetAll();
chatOrder.SET(true, 8, 9, 4);
break;
case 9:
chatBody.sayWhat("Do you think it's true?");
chatBody.resetAll();
chatBody.addEar(chatEvent.SAY_YES, res6);
chatBody.addEar(chatEvent.SAY_NO, res7);
chatOrder.SET(false, 0, 0);
break;
case 10:
chatBody.sayWhat("I don't know what to make of it myself. But I'll keep my eyes open.");
chatBody.resetAll(true);
chatOrder.SET(false, 0, 0);
break;
};
}
}
}//package
Section 150
//chatMission5 (chatMission5)
package {
public class chatMission5 {
public function chatMission5(){
super();
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Aright Baylet, we're on our own...");
chatBody.resetAll();
chatOrder.SET(true, 7, 2, 5);
break;
case 2:
chatBody.sayWhat("... But there's a way out of this!");
chatBody.resetAll();
chatOrder.SET(true, 18, 3, 5);
break;
case 3:
chatBody.sayWhat("I'm going to cover for you while you construct a Special Operations center.");
chatBody.resetAll();
chatOrder.SET(true, 11, 4, 5);
break;
case 4:
chatBody.sayWhat("You'll need a lot of resources to operate it though. But do this, and we'll burn them to ashes!");
chatBody.resetAll();
chatOrder.SET(true, 80, 5, 5);
break;
case 5:
chatBody.sayWhat("Time your strikes well, Baylet! Try to kill as many of them as you can with each shot!");
chatBody.resetAll(true);
chatOrder.SET(false, 0, 0);
break;
};
}
}
}//package
Section 151
//chatMission6 (chatMission6)
package {
public class chatMission6 {
public function chatMission6(){
super();
}
public static function runAiChat(a:uint){
switch (a){
case 0:
chatOrder.SET(false, 0, 0);
break;
case 1:
chatBody.sayWhat("Good evening Mr Moston. I'm Julio Haxel, I've been assigned to help you with tonight's mission.");
chatBody.resetAll(true);
chatOrder.SET(false, 0, 0);
break;
};
}
}
}//package
Section 152
//chatOrder (chatOrder)
package {
public class chatOrder {
public static var timeCount:uint;
public static var act:Boolean;
public static var missionChat:uint;
public static var currentOrder:uint;
public function chatOrder(){
super();
}
public static function SET(a:Boolean, b:uint, c:uint, d:uint=0):void{
act = a;
timeCount = (chatBody.stepCount + b);
currentOrder = c;
missionChat = d;
}
public static function go():void{
if (missionChat == 0){
chatBody.runAiChat(currentOrder);
};
if (missionChat == 1){
chatMission1.runAiChat(currentOrder);
};
if (missionChat == 2){
chatMission2.runAiChat(currentOrder);
};
if (missionChat == 3){
chatMission3.runAiChat(currentOrder);
};
if (missionChat == 4){
chatMission4.runAiChat(currentOrder);
};
if (missionChat == 5){
chatMission5.runAiChat(currentOrder);
};
if (missionChat == 6){
chatMission6.runAiChat(currentOrder);
};
}
}
}//package
Section 153
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
public function CheckBox_disabledIcon(){
super();
}
}
}//package
Section 154
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
public function CheckBox_downIcon(){
super();
}
}
}//package
Section 155
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
public function CheckBox_overIcon(){
super();
}
}
}//package
Section 156
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
public function CheckBox_selectedDisabledIcon(){
super();
}
}
}//package
Section 157
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
public function CheckBox_selectedDownIcon(){
super();
}
}
}//package
Section 158
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
public function CheckBox_selectedOverIcon(){
super();
}
}
}//package
Section 159
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
public function CheckBox_selectedUpIcon(){
super();
}
}
}//package
Section 160
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
public function CheckBox_upIcon(){
super();
}
}
}//package
Section 161
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
public function ComboBox_disabledSkin(){
super();
}
}
}//package
Section 162
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
public function ComboBox_downSkin(){
super();
}
}
}//package
Section 163
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
public function ComboBox_overSkin(){
super();
}
}
}//package
Section 164
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
public function ComboBox_upSkin(){
super();
}
}
}//package
Section 165
//comic_0 (comic_0)
package {
import flash.display.*;
public dynamic class comic_0 extends MovieClip {
public function comic_0(){
super();
}
}
}//package
Section 166
//comic_1 (comic_1)
package {
import flash.display.*;
public dynamic class comic_1 extends MovieClip {
public function comic_1(){
super();
}
}
}//package
Section 167
//comic_10 (comic_10)
package {
import flash.display.*;
public dynamic class comic_10 extends MovieClip {
public function comic_10(){
super();
}
}
}//package
Section 168
//comic_11 (comic_11)
package {
import flash.display.*;
public dynamic class comic_11 extends MovieClip {
public function comic_11(){
super();
}
}
}//package
Section 169
//comic_2 (comic_2)
package {
import flash.display.*;
public dynamic class comic_2 extends MovieClip {
public function comic_2(){
super();
}
}
}//package
Section 170
//comic_3 (comic_3)
package {
import flash.display.*;
public dynamic class comic_3 extends MovieClip {
public function comic_3(){
super();
}
}
}//package
Section 171
//comic_4 (comic_4)
package {
import flash.display.*;
public dynamic class comic_4 extends MovieClip {
public function comic_4(){
super();
}
}
}//package
Section 172
//comic_5 (comic_5)
package {
import flash.display.*;
public dynamic class comic_5 extends MovieClip {
public function comic_5(){
super();
}
}
}//package
Section 173
//comic_6 (comic_6)
package {
import flash.display.*;
public dynamic class comic_6 extends MovieClip {
public function comic_6(){
super();
}
}
}//package
Section 174
//comic_7 (comic_7)
package {
import flash.display.*;
public dynamic class comic_7 extends MovieClip {
public function comic_7(){
super();
}
}
}//package
Section 175
//comic_8 (comic_8)
package {
import flash.display.*;
public dynamic class comic_8 extends MovieClip {
public function comic_8(){
super();
}
}
}//package
Section 176
//comic_9 (comic_9)
package {
import flash.display.*;
public dynamic class comic_9 extends MovieClip {
public function comic_9(){
super();
}
}
}//package
Section 177
//CommunistTheme (CommunistTheme)
package {
import flash.media.*;
public dynamic class CommunistTheme extends Sound {
public function CommunistTheme(){
super();
}
}
}//package
Section 178
//costTip (costTip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class costTip extends Sprite {
public var c_e:TextField;
public var c_m:TextField;
public var c_p:TextField;
public function costTip(){
super();
}
}
}//package
Section 179
//costTip2 (costTip2)
package {
import flash.display.*;
import flash.text.*;
public dynamic class costTip2 extends MovieClip {
public var c_i:TextField;
public function costTip2(){
super();
}
}
}//package
Section 180
//dataTracer (dataTracer)
package {
import flash.display.*;
public class dataTracer extends Sprite {
public static var tracer:Tracer = new Tracer();
private static var sup:Boolean = false;
public static var writeLim:uint = 9;
private static var theRoot:Object;
public static var theStage:Stage;
public static var progressing:Boolean = false;
private static var msgArray:Array = new Array();
public function dataTracer(r:Object, s:Stage):void{
super();
theRoot = r;
theStage = s;
addChild(tracer);
}
public static function noMoreProgress():void{
progressing = false;
}
public static function throwError(t:String):void{
progressing = false;
clearTracer();
showTracer();
update(t);
}
public static function update(t:String):void{
var str:String;
trace(("Updating " + t));
msgArray.push(t);
if (msgArray.length > writeLim){
msgArray.shift();
};
str = msgArray.join("<br/>");
tracer.tr.htmlText = str;
}
public static function hideTracer():void{
clearTracer();
theRoot.removeChild(theRoot.DataTracer);
}
public static function clearTracer():void{
msgArray = new Array();
tracer.tr.htmlText = "";
}
public static function suppress():void{
sup = true;
}
public static function showTracer():void{
theRoot.addChild(theRoot.DataTracer);
}
public static function DC(a:String="You have been disconnected from the server! :("):void{
if (!sup){
theRoot.disconnectedHandler();
theRoot.DCTRUE = true;
theRoot.DCLINE = a;
progressing = false;
clearTracer();
theRoot.gotoAndStop("OutOf", "MENU");
} else {
sup = false;
};
}
}
}//package
Section 181
//displayBody (displayBody)
package {
import flash.display.*;
import flash.events.*;
public class displayBody extends Sprite {
private var loopStart:uint;
private var loopMax:uint;
public var bitmap:Bitmap;
private var reCenter:Boolean;// = false
private var loopNow:uint;
private var main:Object;
private var currentMode:uint;
public function displayBody(){
reCenter = false;
super();
}
public function createDisplay(a:Object, c:Boolean=false, doAnim:Boolean=true):void{
if (doAnim){
addEventListener(Event.ENTER_FRAME, animate);
};
bitmap = new Bitmap(a.normal[0]);
addChild(bitmap);
main = a;
loopStart = (loopNow = 0);
loopMax = main.normal.length;
bitmap.width = (bitmap.width * renderMachine.poly);
bitmap.height = (bitmap.height * renderMachine.poly);
reCenter = c;
currentMode = 0;
bitmap.x = (-(bitmap.width) / 2);
bitmap.y = (-(bitmap.height) / 2);
}
public function modeChange(a:uint, a2:Object=null):void{
if ((((currentMode == 2)) && (!((a == 3))))){
} else {
if (a != currentMode){
currentMode = a;
if (a == 0){
loopStart = (loopNow = 0);
loopMax = main.run;
};
if (a == 1){
loopStart = (loopNow = main.run);
loopMax = (main.fire - main.prefire);
};
if (a == 2){
loopStart = (loopNow = main.fire);
loopMax = main.death;
};
if (a == 3){
loopStart = (loopNow = main.death);
loopMax = main.normal.length;
};
if (a == 4){
loopStart = (loopNow = (main.fire - main.prefire));
loopMax = main.death;
};
if (a == 5){
main = a2;
loopStart = (loopNow = 0);
loopMax = main.normal.length;
catchAnimate();
};
};
};
}
private function doDraw(a:BitmapData):void{
bitmap.bitmapData = a;
if (reCenter){
bitmap.x = (-(bitmap.width) / 2);
bitmap.y = (-(bitmap.height) / 2);
};
}
private function catchAnimate():void{
doDraw(main.normal[loopNow]);
loopNow++;
if (loopNow == loopMax){
if (currentMode == 2){
currentMode = 1;
modeChange(0);
} else {
loopNow = loopStart;
};
};
}
public function end():void{
removeEventListener(Event.ENTER_FRAME, animate);
removeChild(bitmap);
bitmap = null;
//unresolved jump
var _slot1 = e;
}
private function animate(event:Event):void{
catchAnimate();
}
}
}//package
Section 182
//displayKon (displayKon)
package {
import flash.display.*;
import flash.events.*;
public class displayKon {
public static var restrictArray:Array;
public static var d_bitmap:Bitmap;
public static var restricted:Boolean = false;
public function displayKon():void{
super();
gameKon.displayArray.push(this);
clearAllOptions(true);
render(0, 1, gameKon.theRoot.b8, null);
}
public function killEvents():void{
gameKon.theStage.removeEventListener(Event.ENTER_FRAME, updateBar);
}
public static function render(a:uint, b:uint, c:MovieClip, d:Object=null):void{
if (a == 0){
d_bitmap = new Bitmap(renderMachine.originalButtons[b]);
} else {
if (a == 1){
d_bitmap = new Bitmap(renderMachine.copyBase[buildingData.LIST[d.buildOrder][1]]);
};
};
d_bitmap.scaleX = renderMachine.poly;
d_bitmap.scaleY = renderMachine.poly;
c.addChild(d_bitmap);
}
public static function clearAllOptions(startClear:Boolean=false):void{
var i:*;
var g:*;
gameKon.theStage.removeEventListener(Event.ENTER_FRAME, updateBar);
if (!startClear){
for (g in unitKon.Team1.all) {
unitKon.Team1.all[g].unfil();
};
for (g in unitKon.Team2.all) {
unitKon.Team2.all[g].unfil();
};
};
gameKon.theStage.removeEventListener(Event.ENTER_FRAME, updateBar);
gameKon.unselectBuilding();
gameKon.theRoot.buildBar.visible = false;
gameKon.selectedBuilding = null;
gameKon.selectedUnit = new Array();
gameKon.theRoot.uiName.text = "Control Panel";
gameKon.theRoot.uiDesc.text = "Nothing selected. Click on a unit or a base to select it.";
i = 0;
while (i < 8) {
gameKon.theRoot[("b" + i)].visible = true;
gameKon.theRoot.oi.visible = false;
gameKon.theRoot.b8.visible = false;
if (gameKon.theRoot[("b" + i)].gfx.numChildren > 0){
gameKon.theRoot[("b" + i)].gfx.removeChildAt(0);
};
gameKon.theRoot[("b" + i)].btn.visible = false;
i++;
};
}
public static function updateUnit(u:Array):void{
var g:*;
var i:*;
gameKon.unselectBuilding();
clearAllOptions();
gameKon.theRoot.buildBar.gotoAndStop("GREEN");
gameKon.selectedBuilding = null;
if (u.length == 1){
gameKon.theRoot.buildBar.visible = true;
gameKon.selectedUnit = [u[0]];
gameKon.theRoot.uiName.text = u[0].INFO.Name;
gameKon.theRoot.uiDesc.text = u[0].INFO.Desc;
gameKon.theStage.addEventListener(Event.ENTER_FRAME, updateBar);
} else {
gameKon.selectedUnit = u;
gameKon.theRoot.buildBar.visible = false;
gameKon.theRoot.uiName.text = "Group Selection";
gameKon.theRoot.uiDesc.text = "Multiple units have been selected.";
};
for (g in gameKon.selectedUnit) {
gameKon.selectedUnit[g].fil();
};
if (u[0].assocBase == null){
if ((((u[0].player == gameKon.playerNow)) || ((u.length > 1)))){
i = 0;
while (i < 4) {
gameKon.theRoot[("b" + i)].btn.visible = true;
render(0, (i + 2), gameKon.theRoot[("b" + i)].gfx);
i++;
};
};
};
}
public static function updateBar(event:Event):void{
var event = event;
if (gameKon.selectedUnit.length == 1){
gameKon.theRoot.buildBar.width = (150.5 * (gameKon.selectedUnit[0].life / gameKon.selectedUnit[0].maxLife));
} else {
if (gameKon.selectedBuilding == null){
gameKon.theRoot.buildBar.visible = false;
};
};
//unresolved jump
var _slot1 = e;
}
public static function updateOptions():void{
var g:*;
var p:*;
var i:*;
var w:*;
var restri:Boolean;
var jj:*;
var d:*;
for (g in unitKon.Team1.all) {
unitKon.Team1.all[g].unfil();
};
for (g in unitKon.Team2.all) {
unitKon.Team2.all[g].unfil();
};
gameKon.theStage.removeEventListener(Event.ENTER_FRAME, updateBar);
gameKon.theRoot.buildBar.gotoAndStop("YELLOW");
p = gameKon.selectedBuilding.INFO.options;
gameKon.theRoot.uiName.text = gameKon.selectedBuilding.INFO[0];
gameKon.theRoot.uiDesc.text = gameKon.selectedBuilding.INFO[2];
if (((gameKon.selectedBuilding.working) && ((gameKon.selectedBuilding.ownBy == gameKon.playerNow)))){
i = 0;
while (i < 8) {
gameKon.theRoot[("b" + i)].visible = false;
i++;
};
gameKon.theRoot.oi.visible = true;
gameKon.theRoot.b8.visible = true;
w = gameKon.selectedBuilding.option;
if (gameKon.theRoot.oi.numChildren > 0){
gameKon.theRoot.oi.removeChildAt(0);
};
render(w.iconGraphic[0], w.iconGraphic[1], gameKon.theRoot.oi, w);
} else {
gameKon.theRoot.oi.visible = false;
gameKon.theRoot.b8.visible = false;
i = 0;
while (i < 8) {
gameKon.theRoot[("b" + i)].visible = true;
if (gameKon.theRoot[("b" + i)].gfx.numChildren > 0){
gameKon.theRoot[("b" + i)].gfx.removeChildAt(0);
};
restri = false;
if (restricted){
for (jj in restrictArray) {
if (p[i] == restrictArray[jj]){
restri = true;
};
};
};
if (((((restri) || ((p[i] == null)))) || (!((gameKon.selectedBuilding.ownBy == gameKon.playerNow))))){
gameKon.theRoot[("b" + i)].btn.visible = false;
} else {
d = optionData.LIST[p[i]];
gameKon.theRoot[("b" + i)].btn.visible = true;
render(d.iconGraphic[0], d.iconGraphic[1], gameKon.theRoot[("b" + i)].gfx, d);
};
i++;
};
};
}
public static function liftRestri():void{
restrictArray = new Array();
restricted = false;
}
}
}//package
Section 183
//exBody (exBody)
package {
import flash.display.*;
import flash.events.*;
public class exBody extends Sprite {
private var loopStart:uint;
private var loopMax:uint;
public var bitmap:Bitmap;
private var velX:Array;
private var velY:Array;
private var reCenter:Boolean;// = false
private var loopNow:uint;
private var timeSpread:uint;// = 9
private var main:Object;
private var pX:Array;
private var pY:Array;
private var spreadMax:uint;
public function exBody(id:uint, realType:Boolean=true):void{
var a:*;
var f:*;
reCenter = false;
velX = new Array();
velY = new Array();
pX = new Array();
pY = new Array();
timeSpread = 9;
spreadMax = timeSpread;
super();
a = renderMachine.explosions[id];
if (realType){
gameKon.shakeScreen(1);
} else {
trace("MONEY ADD");
timeSpread = 0;
};
addEventListener(Event.ENTER_FRAME, animate);
bitmap = new Bitmap(a.normal[0]);
addChild(bitmap);
main = a;
loopStart = (loopNow = 0);
loopMax = main.normal.length;
bitmap.width = (bitmap.width * renderMachine.poly);
bitmap.height = (bitmap.height * renderMachine.poly);
bitmap.x = (-(bitmap.width) / 2);
bitmap.y = (-(bitmap.height) / 2);
f = 0;
while (f < 5) {
velX.push((2 + (Math.random() * 7)));
velY.push((2 + (Math.random() * 7)));
f++;
};
velX[0] = (velX[0] * -1);
velX[1] = (velX[1] * -1);
velY[1] = (velY[1] * -1);
velY[2] = (velY[2] * -1);
velY[3] = (velY[3] * -1);
for (f in velX) {
pX[f] = (velX[f] * 0.7);
pY[f] = (velY[f] * 0.7);
};
}
private function doDraw(a:BitmapData):void{
bitmap.bitmapData = a;
if (reCenter){
bitmap.x = (-(bitmap.width) / 2);
bitmap.y = (-(bitmap.height) / 2);
};
}
public function end():void{
removeEventListener(Event.ENTER_FRAME, animate);
removeChild(bitmap);
bitmap = null;
//unresolved jump
var _slot1 = e;
}
private function animate(event:Event):void{
var f:*;
doDraw(main.normal[loopNow]);
loopNow++;
if (timeSpread > 0){
timeSpread--;
for (f in velX) {
pX[f] = (pX[f] + velX[f]);
pY[f] = (pY[f] + velY[f]);
velY[f] = (velY[f] + 0.8);
unitKon.addTrail(8, (x + pX[f]), (y + pY[f]));
};
};
if (loopNow == loopMax){
end();
unitKon.killEx(this);
};
}
}
}//package
Section 184
//FascistTheme (FascistTheme)
package {
import flash.media.*;
public dynamic class FascistTheme extends Sound {
public function FascistTheme(){
super();
}
}
}//package
Section 185
//Fill1 (Fill1)
package {
import flash.media.*;
public dynamic class Fill1 extends Sound {
public function Fill1(){
super();
}
}
}//package
Section 186
//Fill2 (Fill2)
package {
import flash.media.*;
public dynamic class Fill2 extends Sound {
public function Fill2(){
super();
}
}
}//package
Section 187
//Fill3 (Fill3)
package {
import flash.media.*;
public dynamic class Fill3 extends Sound {
public function Fill3(){
super();
}
}
}//package
Section 188
//Fill4 (Fill4)
package {
import flash.media.*;
public dynamic class Fill4 extends Sound {
public function Fill4(){
super();
}
}
}//package
Section 189
//Fill5 (Fill5)
package {
import flash.media.*;
public dynamic class Fill5 extends Sound {
public function Fill5(){
super();
}
}
}//package
Section 190
//Fill6 (Fill6)
package {
import flash.media.*;
public dynamic class Fill6 extends Sound {
public function Fill6(){
super();
}
}
}//package
Section 191
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
public function focusRectSkin(){
super();
}
}
}//package
Section 192
//G1 (G1)
package {
import flash.display.*;
public dynamic class G1 extends MovieClip {
public function G1(){
super();
}
}
}//package
Section 193
//gameKon (gameKon)
package {
import flash.display.*;
import flash.events.*;
public class gameKon {
private var incomeTime:Number;// = 5
private var resourceTimer:Number;
private var frameTime:Number;
public var player0:playerKon;
public var player1:playerKon;
public var player2:playerKon;
public var player3:playerKon;
public var player4:playerKon;
public static var cText2:tipObject;
public static var buildingArray:Array = new Array();
public static var theStage:Stage;
public static var winningTeam:uint;
public static var tippingWork:Boolean = false;
public static var rallyOn:Boolean;
public static var selectedBuilding:baseBuilding;
public static var theRoot:Object;
public static var playerNow:playerKon;
public static var shiftToggle:Boolean = false;
public static var displayArray:Array = new Array();
private static var newTips:Array = new Array();
public static var selectedUnit:Array;
public function gameKon():void{
incomeTime = 5;
super();
displayArray = new Array();
buildingArray = new Array();
selectedBuilding = null;
selectedUnit = null;
}
public function stopData():void{
theStage.removeEventListener("enterFrame", Run);
}
public function runData():void{
resourceTimer = 0;
theStage.addEventListener("enterFrame", Run);
}
public function killAll():void{
var i:*;
for (i in unitKon.masterUnitArray) {
unitKon.removeUnit(unitKon.masterUnitArray[i]);
};
for (i in displayArray) {
if (displayArray[i] != null){
displayArray[i].killEvents();
};
};
}
public function assignBase():void{
var i:*;
unitKon.resetAll(player1, player3);
buildingArray[5].ownBy = player1;
buildingArray[6].ownBy = player1;
buildingArray[7].ownBy = player1;
buildingArray[8].ownBy = player1;
buildingArray[0].ownBy = player2;
buildingArray[1].ownBy = player2;
buildingArray[2].ownBy = player2;
buildingArray[3].ownBy = player2;
buildingArray[14].ownBy = player3;
buildingArray[15].ownBy = player3;
buildingArray[16].ownBy = player3;
buildingArray[17].ownBy = player3;
buildingArray[9].ownBy = player4;
buildingArray[10].ownBy = player4;
buildingArray[11].ownBy = player4;
buildingArray[12].ownBy = player4;
for (i in buildingArray) {
buildingArray[i].baseId = i;
if ((((i == 4)) || ((i == 13)))){
buildingArray[i].fixColor("White");
buildingArray[i].ownBy = player0;
buildingArray[i].option = optionData.LIST[1];
buildingArray[i].maxTime = (buildingArray[i].option[3] * 30);
buildingArray[i].beginWork();
} else {
buildingArray[i].pushBuild();
buildingArray[i].fixColor(theRoot.colorStrings[buildingArray[i].ownBy.cityColor]);
};
};
}
public function Run(event:Event):void{
resourceTimer++;
if (resourceTimer == frameTime){
theStage.dispatchEvent(new incomeEv("income"));
resourceTimer = 0;
};
}
public function setData(importStage:Stage, importRoot:Object):void{
theStage = importStage;
theRoot = importRoot;
rallyOn = false;
player0 = new playerKon();
player1 = new playerKon();
player2 = new playerKon();
player3 = new playerKon();
player4 = new playerKon();
playerNow = new playerKon();
frameTime = Math.round((incomeTime * theStage.frameRate));
}
public static function unselectBuilding():void{
var i:*;
selectedBuilding = null;
for (i in buildingArray) {
buildingArray[i].unselBase();
};
}
public static function checkBuild(player:playerKon, tar){
var c:Boolean;
var u:*;
c = false;
for (u in player.builds) {
if (player.builds[u].currentBuilding == tar){
c = true;
};
if (tar == null){
c = true;
};
};
return (c);
}
public static function doUnitOption(id:uint, unitArray:Array=null):void{
var orderMatrix:Array;
var k:*;
var u:*;
var scan_i:*;
var f:*;
orderMatrix = new Array();
if (unitArray == null){
orderMatrix = selectedUnit;
} else {
for (u in unitArray) {
for (scan_i in unitKon.masterUnitArray) {
if (unitKon.masterUnitArray[scan_i].unitId == unitArray[u]){
orderMatrix.push(unitKon.masterUnitArray[scan_i]);
};
};
};
};
for (k in orderMatrix) {
if (orderMatrix[k] == playerNow.team.all[0]){
for (f in playerNow.team.all) {
if (f != 0){
playerNow.team.all[f].behave = id;
if (id == 1){
playerNow.team.all[f].modeChange(0);
};
};
};
} else {
orderMatrix[k].behave = id;
orderMatrix[k].modeChange(0);
};
};
}
public static function doTip(j:Number, action:Boolean):void{
var p:*;
var d:*;
if (action){
if (selectedBuilding != null){
p = selectedBuilding.INFO.options[j];
if (p != null){
d = optionData.LIST[p];
toolTip.tip(d.tip, 0);
};
} else {
toolTip.tip(newTips[j], 0);
};
} else {
toolTip.unTip();
};
}
public static function shakeScreen(a:uint):void{
if (a == 0){
theRoot.startShake(4, 1.3, 0.8);
};
if (a == 1){
theRoot.startShake(13, 1.23, 1.4);
};
if (a == 2){
theRoot.startShake(30, 1.5, 0.9);
};
}
public static function doOption(d:Object, j:Boolean, h:Boolean, player:playerKon, tarBuild:baseBuilding, overRide:Boolean=false, autoCom:Boolean=false, vars:Object=null, sendOff:Boolean=false):void{
var UTR:uint;
var sampleArray:uint;
var fgh:*;
if (tarBuild != null){
if (j){
d = tarBuild.option;
player.addRes(0, d[0]);
player.addRes(1, d[1]);
player.addRes(2, d[2]);
player.addRes(3, d[4]);
tarBuild.cancelWork();
} else {
if (((overRide) || ((((((((player.r_m >= d[0])) && ((player.r_p >= d[1])))) && ((player.r_e >= d[2])))) && ((player.r_i >= d[4])))))){
if (((overRide) || (checkBuild(player, d.buildReq)))){
if (((overRide) || (checkTech(player, d.techReq)))){
if (((overRide) || (checkStock(player, d.stockReq)))){
if (((!(gameKon.theRoot.singlePlayerMode)) && ((sendOff == true)))){
gameKon.theRoot.gameRoom.sendToRoom(vars, false, "updateBuilding");
};
player.addRes(0, -(d[0]));
player.addRes(1, -(d[1]));
player.addRes(2, -(d[2]));
player.addRes(3, -(d[4]));
var _local13 = player.stock;
var _local14 = d.stockReq;
var _local15 = (_local13[_local14] - 1);
_local13[_local14] = _local15;
tarBuild.option = d;
sampleArray = 0;
for (fgh in d.buildResource) {
sampleArray = (sampleArray + d.buildResource[fgh]);
};
UTR = d[3];
if (player.race == 0){
if (sampleArray == 0){
UTR = (UTR * 0.65);
if (UTR > 4){
UTR = 4;
};
if (UTR < 1){
UTR = 1;
};
};
};
if (player.race == 2){
if (sampleArray > 0){
UTR = (UTR * 0.85);
};
};
tarBuild.maxTime = (UTR * 30);
tarBuild.beginWork();
if (h){
tarBuild.autoBuild = true;
};
} else {
if (!autoCom){
toolTip.giveError("Error", "You don't have enough things in stock to do this.");
};
};
} else {
if (!autoCom){
toolTip.giveError("Error", "You don't have the required technology to do this.");
};
};
} else {
if (!autoCom){
toolTip.giveError("Error", "You don't have the required structure to do this.");
};
};
} else {
if (!autoCom){
toolTip.giveError("Error", "You don't have enough resources to do this.");
};
};
};
};
}
public static function checkTech(player:playerKon, tar){
if ((((player.tech[tar] > 0)) || ((tar == null)))){
return (true);
};
return (false);
}
public static function checkStock(player:playerKon, tar){
if ((((player.stock[tar] > 0)) || ((tar == null)))){
return (true);
};
return (false);
}
newTips[0] = new tipObject("Advance", 0, 0, 0, "Move forward and attack normally.");
newTips[1] = new tipObject("Hold", 0, 0, 0, "Hold position and fire at nearby enemies.");
newTips[2] = new tipObject("Charge", 0, 0, 0, "Storm towards the enemy base, attacking nothing else.");
newTips[3] = new tipObject("Fall Back", 0, 0, 0, "Retreat back towards base, but will not return enemy fire.");
}
}//package
Section 194
//groundDisplay2 (groundDisplay2)
package {
import flash.display.*;
public dynamic class groundDisplay2 extends MovieClip {
public function groundDisplay2(){
super();
}
}
}//package
Section 195
//groundDisplay3 (groundDisplay3)
package {
import flash.display.*;
public dynamic class groundDisplay3 extends MovieClip {
public function groundDisplay3(){
super();
}
}
}//package
Section 196
//incomeEv (incomeEv)
package {
import flash.events.*;
public class incomeEv extends Event {
public function incomeEv(type:String):void{
super(type);
}
}
}//package
Section 197
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
public function List_skin(){
super();
}
}
}//package
Section 198
//MainFont (MainFont)
package {
import flash.text.*;
public dynamic class MainFont extends Font {
public function MainFont(){
super();
}
}
}//package
Section 199
//MainFont2 (MainFont2)
package {
import flash.text.*;
public dynamic class MainFont2 extends Font {
public function MainFont2(){
super();
}
}
}//package
Section 200
//MenuFont (MenuFont)
package {
import flash.text.*;
public dynamic class MenuFont extends Font {
public function MenuFont(){
super();
}
}
}//package
Section 201
//MultiplayerMakeGraphic (MultiplayerMakeGraphic)
package {
import fl.controls.*;
import flash.display.*;
import flash.text.*;
public dynamic class MultiplayerMakeGraphic extends MovieClip {
public var makeGame:Button;
public var gameSetting:MovieClip;
public var backLobby:Button;
public var T:MenuFont;
public var tf:TextFormat;
public var gameName:TextField;
public var setChange:SimpleButton;
public function MultiplayerMakeGraphic(){
super();
addFrameScript(0, frame1);
__setProp_backLobby_MultiplayerMake_Layer3_1();
__setProp_makeGame_MultiplayerMake_Layer3_1();
}
function __setProp_backLobby_MultiplayerMake_Layer3_1(){
backLobby["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
backLobby.emphasized = false;
backLobby.enabled = true;
backLobby.label = "Exit to Lobby";
backLobby.labelPlacement = "right";
backLobby.selected = false;
backLobby.toggle = false;
backLobby.visible = true;
backLobby["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_makeGame_MultiplayerMake_Layer3_1(){
makeGame["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
makeGame.emphasized = false;
makeGame.enabled = true;
makeGame.label = "Create Game";
makeGame.labelPlacement = "right";
makeGame.selected = false;
makeGame.toggle = false;
makeGame.visible = true;
makeGame["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame1(){
T = new MenuFont();
tf = new TextFormat();
tf.font = T.fontName;
tf.size = 14;
tf.color = 0;
makeGame.setStyle("textFormat", tf);
backLobby.setStyle("textFormat", tf);
}
}
}//package
Section 202
//MultiplayerRoomGraphic (MultiplayerRoomGraphic)
package {
import fl.controls.*;
import flash.display.*;
import fl.data.*;
import flash.text.*;
public dynamic class MultiplayerRoomGraphic extends MovieClip {
public var ad:DisplayObject;
public var c1:ComboBox;
public var c3:ComboBox;
public var c4:ComboBox;
public var c2:ComboBox;
public var d4:MovieClip;
public var T:MenuFont;
public var d2:MovieClip;
public var d3:MovieClip;
public var d1:MovieClip;
public var tf:TextFormat;
public var adBox:MovieClip;
public var CPMStarSubPoolID:int;
public var CPMStarPoolID:int;
public var collProps1:Array;
public var collProps2:Array;
public var collProps3:Array;
public var collProps4:Array;
public var i2:int;
public var i3:int;
public var i4:int;
public var i1:int;
public var chatSend:TextField;
public var j2;
public var j3;
public var j1;
public var j4;
public var collObj1:DataProvider;
public var collObj4:DataProvider;
public var collObj2:DataProvider;
public var backLobby:Button;
public var chatBox:TextField;
public var collObj3:DataProvider;
public var textBox:TextField;
public var startGame:Button;
public var collProp1:Object;
public var collProp3:Object;
public var collProp2:Object;
public var collProp4:Object;
public var itemObj1:SimpleCollectionItem;
public var itemObj2:SimpleCollectionItem;
public var itemObj3:SimpleCollectionItem;
public var itemObj4:SimpleCollectionItem;
public var gameSetting:MovieClip;
public function MultiplayerRoomGraphic(){
super();
addFrameScript(0, frame1);
__setProp_c3_MultiplayerRoom_Layer2_1();
__setProp_c2_MultiplayerRoom_Layer2_1();
__setProp_backLobby_MultiplayerRoom_Layer2_1();
__setProp_c4_MultiplayerRoom_Layer2_1();
__setProp_startGame_MultiplayerRoom_Layer2_1();
__setProp_c1_MultiplayerRoom_Layer2_1();
}
function __setProp_c2_MultiplayerRoom_Layer2_1(){
c2["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj3 = new DataProvider();
collProps3 = [{label:"None", data:"Computer"}];
i3 = 0;
while (i3 < collProps3.length) {
itemObj3 = new SimpleCollectionItem();
collProp3 = collProps3[i3];
for (j3 in collProp3) {
itemObj3[j3] = collProp3[j3];
};
collObj3.addItem(itemObj3);
i3++;
};
c2.dataProvider = collObj3;
c2.editable = false;
c2.enabled = true;
c2.prompt = "";
c2.restrict = "";
c2.rowCount = 5;
c2.visible = true;
c2["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_startGame_MultiplayerRoom_Layer2_1(){
startGame["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
startGame.emphasized = false;
startGame.enabled = true;
startGame.label = "Start Game";
startGame.labelPlacement = "right";
startGame.selected = false;
startGame.toggle = false;
startGame.visible = true;
startGame["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame1(){
stop();
T = new MenuFont();
tf = new TextFormat();
tf.font = T.fontName;
tf.size = 14;
tf.color = 0;
backLobby.setStyle("textFormat", tf);
startGame.setStyle("textFormat", tf);
CPMStarPoolID = 1052;
CPMStarSubPoolID = 37;
ad = AdLoader.LoadAd(CPMStarPoolID, CPMStarSubPoolID);
adBox.addChild(ad);
}
function __setProp_c4_MultiplayerRoom_Layer2_1(){
c4["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj1 = new DataProvider();
collProps1 = [{label:"None", data:"Computer"}];
i1 = 0;
while (i1 < collProps1.length) {
itemObj1 = new SimpleCollectionItem();
collProp1 = collProps1[i1];
for (j1 in collProp1) {
itemObj1[j1] = collProp1[j1];
};
collObj1.addItem(itemObj1);
i1++;
};
c4.dataProvider = collObj1;
c4.editable = false;
c4.enabled = true;
c4.prompt = "";
c4.restrict = "";
c4.rowCount = 5;
c4.visible = true;
c4["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_backLobby_MultiplayerRoom_Layer2_1(){
backLobby["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
backLobby.emphasized = false;
backLobby.enabled = true;
backLobby.label = "Exit to Lobby";
backLobby.labelPlacement = "right";
backLobby.selected = false;
backLobby.toggle = false;
backLobby.visible = true;
backLobby["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_c1_MultiplayerRoom_Layer2_1(){
c1["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj4 = new DataProvider();
collProps4 = [{label:"None", data:"Computer"}];
i4 = 0;
while (i4 < collProps4.length) {
itemObj4 = new SimpleCollectionItem();
collProp4 = collProps4[i4];
for (j4 in collProp4) {
itemObj4[j4] = collProp4[j4];
};
collObj4.addItem(itemObj4);
i4++;
};
c1.dataProvider = collObj4;
c1.editable = false;
c1.enabled = true;
c1.prompt = "";
c1.restrict = "";
c1.rowCount = 5;
c1.visible = true;
c1["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_c3_MultiplayerRoom_Layer2_1(){
c3["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj2 = new DataProvider();
collProps2 = [{label:"None", data:"Computer"}];
i2 = 0;
while (i2 < collProps2.length) {
itemObj2 = new SimpleCollectionItem();
collProp2 = collProps2[i2];
for (j2 in collProp2) {
itemObj2[j2] = collProp2[j2];
};
collObj2.addItem(itemObj2);
i2++;
};
c3.dataProvider = collObj2;
c3.editable = false;
c3.enabled = true;
c3.prompt = "";
c3.restrict = "";
c3.rowCount = 5;
c3.visible = true;
c3["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
}
}//package
Section 203
//MultiplayerScreen (MultiplayerScreen)
package {
import flash.display.*;
import flash.events.*;
import com.jiggmin.blossomSocket.*;
import flash.utils.*;
import com.jiggmin.*;
import com.jiggmin.data.*;
public class MultiplayerScreen extends MovieClip {
private var c_buildUpMax:uint;// = 8
private var team:uint;
private var normalRoom:String;
private var roomSearch:BlossomRoom;
private var c_timer:Timer;
private var m:MultiplayerScreenGraphic;
private var messageArray:Array;
private var c_countDownSmall:uint;
private var rankedMatch:Boolean;// = false
private var maxMessages:int;// = 40
private var cBoxArray:Array;
private var timerRefreshUser:Timer;
private var room:BlossomRoom;
private var STAGE:Stage;
private var userName:String;
private var gameSet:uint;// = 0
private var roomMaster:Boolean;
private var gameRoomMode:Boolean;// = false
private var lastBox;
private var color:uint;
private var m2:MultiplayerMakeGraphic;
private var m3:MultiplayerRoomGraphic;
private var socket:BlossomSocket;
private var c_countDown:uint;
private var justClosed:Boolean;
private var eSend:Object;
private var c_buildUp:uint;
private var lobbyRoom:BlossomRoom;
private var dBoxArray:Array;
private var roomLeader:uint;
private var timerRefresh:Timer;
public function MultiplayerScreen(userName:String, team:uint, color:uint, userData:Object, s:Stage, n:String, usr:uint):void{
var userVars:Object;
var nCyAr:Array;
var hg:*;
gameRoomMode = false;
eSend = new Object();
rankedMatch = false;
gameSet = 0;
c_buildUpMax = 8;
messageArray = new Array();
maxMessages = 40;
super();
normalRoom = n;
STAGE = s;
c_timer = new Timer(1000);
c_timer.start();
c_timer.addEventListener(TimerEvent.TIMER, chatSpamHand, false, 0, true);
c_buildUp = 0;
c_countDown = 0;
c_countDownSmall = 0;
gameSet = 0;
timerRefresh = new Timer(2000);
timerRefresh.start();
timerRefresh.addEventListener(TimerEvent.TIMER, refreshRoomList, false, 0, true);
timerRefreshUser = new Timer(10000);
timerRefreshUser.start();
timerRefreshUser.addEventListener(TimerEvent.TIMER, refreshUserList, false, 0, true);
rankedMatch = false;
this.userName = userName;
this.team = team;
this.color = color;
roomMaster = false;
justClosed = false;
m = new MultiplayerScreenGraphic();
m2 = new MultiplayerMakeGraphic();
m3 = new MultiplayerRoomGraphic();
addChild(m);
m.s_gplayed.text = userData.gamesPlayed;
m.s_gwon.text = userData.gamesWon;
m.s_cwins.text = userData.gamesConsecutiveWins;
m.s_rank.text = userData.rank;
m.ranker.gotoAndStop(userData.rank);
if (userData.gamesPlayed > 0){
m.s_wratio.text = (Math.round(((100 * userData.gamesWon) / userData.gamesPlayed)) + "%");
};
cBoxArray = new Array(m3.c1, m3.c2, m3.c3, m3.c4);
dBoxArray = new Array(m3.d1, m3.d2, m3.d3, m3.d4);
socket = SocketManager.socket;
socket.addEventListener(BlossomEvent.RECEIVE_MESSAGE, msgHandler, false, 0, true);
userVars = new Object();
userVars.userName = userName;
userVars.team = team;
userVars.color = color;
socket.setUserVars(userVars);
room = new BlossomRoom(socket, ("MLX_" + normalRoom));
addEvs();
m.playRankedButton.addEventListener(MouseEvent.CLICK, rankMatchSit, false, 0, true);
m.exitButton.addEventListener(MouseEvent.CLICK, clickExitHandler, false, 0, true);
m.createGameButton.addEventListener(MouseEvent.CLICK, clickCreateGameHandler, false, 0, true);
m.joinGameButton.addEventListener(MouseEvent.CLICK, clickJoinGameHandler, false, 0, true);
m2.backLobby.addEventListener(MouseEvent.CLICK, backLobbyHandler, false, 0, true);
m3.backLobby.addEventListener(MouseEvent.CLICK, backLobbyHandler2, false, 0, true);
m3.startGame.addEventListener(MouseEvent.CLICK, startGameHandler, false, 0, true);
m.chatSend.addEventListener(KeyboardEvent.KEY_DOWN, keyInput, false, 0, true);
m3.chatSend.addEventListener(KeyboardEvent.KEY_DOWN, keyInput, false, 0, true);
m.roomBox.addEventListener(Event.CLOSE, beginRoomSwitch, false, 0, true);
m.raceButton.addEventListener(MouseEvent.CLICK, changeRace, false, 0, true);
m2.setChange.addEventListener(MouseEvent.CLICK, changeSet, false, 0, true);
gameRoomMode = false;
m.racePlate.gotoAndStop((usr + 1));
nCyAr = new Array("Lobby", "Veteran's Hall", "Team Channel", "Deutsch Zimmer", "AFK Garden");
for (hg in nCyAr) {
if (normalRoom == nCyAr[hg]){
m.roomBox.selectedIndex = hg;
};
};
}
private function listUsers():void{
var txt:String;
var user:BlossomUser;
txt = "";
for each (user in room.userArray) {
txt = (txt + (user.vars.userName + "\n"));
};
if (gameRoomMode){
m3.textBox.text = txt;
} else {
m.textBox.text = txt;
};
}
private function refreshRoomList(te:TimerEvent){
socket.getRooms();
socket.addEventListener(BlossomEvent.RECEIVE_ROOMS, refreshRoomListHandler, false, 0, true);
}
private function addMessage(str:String):void{
messageArray.push(str);
if (messageArray.length > maxMessages){
messageArray.shift();
};
showMessages();
}
private function upTeamHand(e:Event):void{
var vars:*;
var i:*;
var theSel:uint;
var j:*;
m3.removeEventListener(Event.ENTER_FRAME, upTeamHand);
if (justClosed){
justClosed = false;
theSel = lastBox.selectedIndex;
for (j in cBoxArray) {
if (cBoxArray[j].selectedIndex == theSel){
if (theSel > 3){
if (cBoxArray[j] != lastBox){
cBoxArray[j].selectedIndex = 0;
};
};
};
};
};
vars = new Object();
vars.array = new Array();
for (i in cBoxArray) {
vars.array.push(cBoxArray[i].selectedLabel);
};
room.sendToRoom(vars, true, "updateTeamDisplay");
}
private function recieveRoomsHandler(be:BlossomEvent):void{
var roomArray:Array;
var len:int;
var i:int;
var Xroom:Object;
var stopScan:Boolean;
var rName:String;
var j:*;
var tty:*;
var vars:Object;
socket.removeEventListener(BlossomEvent.RECEIVE_ROOMS, recieveRoomsHandler);
roomArray = be.roomList;
len = roomArray.length;
stopScan = false;
rName = m2.gameName.text;
i = 0;
while (i < len) {
Xroom = roomArray[i];
if (((!((Xroom.roomName == rName))) && (!((rName == ""))))){
m3.startGame.visible = true;
roomMaster = true;
socket.leaveRoom(room.roomName);
gameRoomMode = true;
clearMessages();
for (j in cBoxArray) {
cBoxArray[j].visible = true;
cBoxArray[j].addEventListener(Event.CLOSE, closeBox, false, 0, true);
cBoxArray[j].removeAll();
cBoxArray[j].addItem({label:"None", data:"NONE"});
cBoxArray[j].addItem({label:"Easy CPU", data:"COMPUTER1"});
cBoxArray[j].addItem({label:"Normal CPU", data:"COMPUTER2"});
cBoxArray[j].addItem({label:"Hard CPU", data:"COMPUTER3"});
cBoxArray[j].selectedIndex = 0;
};
for (tty in dBoxArray) {
dBoxArray[tty].n.text = "None";
};
m2.makeGame.removeEventListener(MouseEvent.CLICK, makeGameHandler);
room = new BlossomRoom(socket, rName);
room.addEventListener("updateTeamDisplay", updateTeamDisplayHandler, false, 0, true);
room.addEventListener("beginGame", beginGameHandler, false, 0, true);
addEvs();
stopScan = true;
addChild(m3);
vars = new Object();
vars.roomLeader = socket.socketID;
vars.randomFactor = (Math.random() * 10);
vars.gs = gameSet;
room.setVars(vars);
roomLeader = socket.socketID;
};
i++;
};
if (stopScan == false){
addChild(m2);
};
}
private function makeGameHandler(me:MouseEvent):void{
socket.getRooms();
removeChild(m2);
socket.addEventListener(BlossomEvent.RECEIVE_ROOMS, recieveRoomsHandler, false, 0, true);
}
private function backLobbyHandler2(me:MouseEvent):void{
socket.leaveRoom(room.roomName);
removeChild(m3);
addChild(m);
roomMaster = false;
gameRoomMode = false;
clearMessages();
socket.getRooms();
socket.addEventListener(BlossomEvent.RECEIVE_ROOMS, refreshRoomListHandler, false, 0, true);
room = new BlossomRoom(socket, ("MLX_" + normalRoom));
addEvs();
listUsers();
}
private function stopLooking(e:chatEvent):void{
STAGE.removeEventListener("CLOSETRACER", stopLooking);
roomSearch.removeEventListener(BlossomEvent.USER_JOIN_ROOM, checkRandomGame);
roomSearch.removeEventListener("beginGame", beginGameHandler);
socket.leaveRoom(roomSearch.roomName);
roomSearch = null;
}
private function checkRandomGame(be:BlossomEvent):void{
var vars:Object;
var iDc:uint;
var doItRand:Boolean;
var user:BlossomUser;
var letterArr:Array;
var bah:String;
if (roomSearch.userArray.length >= 4){
vars = new Object();
vars.randomJoin = true;
vars.arrayId = new Array();
vars.arrayPos = new Array(1, 2, 3, 4);
iDc = 1;
doItRand = false;
for each (user in roomSearch.userArray) {
if (iDc < 5){
iDc++;
vars.arrayId.push(user.socketID);
if (user.socketID == socket.socketID){
doItRand = true;
vars.arrayId.sort();
trace(vars.arrayId);
trace(user.socketID);
if (user.socketID == vars.arrayId[0]){
doItRand = true;
};
};
};
};
if (doItRand){
letterArr = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
bah = letterArr[Math.round((Math.random() * (letterArr.length - 1)))];
vars.randName = (("Ranked_" + bah) + Math.round((Math.random() * 9999)));
roomSearch.sendToRoom(vars, true, "beginGame");
};
};
}
private function msgHandler(be:BlossomEvent):void{
trace(be.data);
trace("GOT VARS");
trace(be.data.kick);
if (be.data.kick){
if (gameRoomMode){
if (!roomMaster){
quitGameRoom();
dataTracer.throwError("You have been kicked from the game.");
};
};
};
}
private function updateTeamDisplayHandler(be:BlossomEvent):void{
var i:*;
for (i in dBoxArray) {
dBoxArray[i].n.text = be.data.array[i];
};
}
private function refreshRoomListHandler(be:BlossomEvent):void{
var roomArray:Array;
var len:int;
var i:int;
var g:int;
var room:Object;
var selStore:String;
var theLabel:String;
socket.removeEventListener(BlossomEvent.RECEIVE_ROOMS, refreshRoomListHandler);
roomArray = be.roomList;
len = roomArray.length;
g = 0;
if (m.theList.selectedItem != null){
selStore = m.theList.selectedItem.data;
} else {
selStore = "MLX_Lobby";
};
m.theList.removeAll();
i = 0;
while (i < len) {
room = roomArray[i];
if ((((room.members < 4)) && (true))){
if ((((room.roomName.indexOf("GameStartX_$") == -1)) && ((room.roomName.indexOf("MLX_") == -1)))){
if (room.roomName.indexOf("GSearchXCV_$") == -1){
theLabel = ((("[" + room.members) + "/4] ") + room.roomName);
m.theList.addItem({label:theLabel, data:room.roomName});
g++;
if (selStore == room.roomName){
m.theList.selectedIndex = (g - 1);
};
};
};
};
i++;
};
}
private function changeSet(me:MouseEvent):void{
gameSet++;
if (gameSet > 5){
gameSet = 0;
};
m2.gameSetting.gotoAndStop((gameSet + 1));
m3.gameSetting.gotoAndStop((gameSet + 1));
}
private function userLeaveRoomHandler(be:BlossomEvent):void{
var j:*;
var labelBefore:*;
var user:BlossomUser;
var b:*;
listUsers();
if (gameRoomMode){
if (roomMaster){
for (j in cBoxArray) {
labelBefore = cBoxArray[j].selectedLabel;
cBoxArray[j].removeAll();
cBoxArray[j].addItem({label:"None", data:"NONE"});
cBoxArray[j].addItem({label:"Easy CPU", data:"COMPUTER1"});
cBoxArray[j].addItem({label:"Normal CPU", data:"COMPUTER2"});
cBoxArray[j].addItem({label:"Hard CPU", data:"COMPUTER3"});
for each (user in room.userArray) {
cBoxArray[j].addItem({label:user.vars.userName, data:user.socketID});
};
cBoxArray[j].selectedIndex = 0;
b = 0;
while (b < cBoxArray[j].length) {
if (cBoxArray[j].getItemAt(b).label == labelBefore){
cBoxArray[j].selectedIndex = b;
};
b++;
};
};
m3.addEventListener(Event.ENTER_FRAME, upTeamHand, false, 0, true);
} else {
trace(be.fromUser.socketID);
trace(roomLeader);
if (be.fromUser.socketID == roomLeader){
quitGameRoom();
};
};
};
}
public function remove():void{
var vars3:*;
vars3 = new Object();
vars3.userRace = MovieClip(parent).userRace;
trace(("Saving " + vars3.userRace));
socket.setUserVars(vars3);
m3.removeChild(m3.adBox);
STAGE.frameRate = 30;
MovieClip(parent).mpscreenMode = false;
MovieClip(parent).normalRoom = normalRoom;
m.exitButton.removeEventListener(MouseEvent.CLICK, clickExitHandler);
timerRefresh.removeEventListener(TimerEvent.TIMER, refreshRoomList);
timerRefreshUser.removeEventListener(TimerEvent.TIMER, refreshUserList);
socket.removeEventListener(BlossomEvent.RECEIVE_ROOMS, refreshRoomListHandler);
room.removeEventListener(BlossomEvent.USER_JOIN_ROOM, userJoinRoomHandler);
room.removeEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeaveRoomHandler);
socket.removeEventListener(BlossomEvent.RECEIVE_MESSAGE, msgHandler);
room.removeEventListener("chat", receiveChatHandler);
c_timer.addEventListener(TimerEvent.TIMER, chatSpamHand, false, 0, true);
socket.leaveRoom(room.roomName);
room = null;
socket = null;
m = null;
m2 = null;
m3 = null;
}
private function beginGameHandler(be:BlossomEvent):void{
var imIn:Boolean;
var i:int;
var myPos:int;
var user:BlossomUser;
var pracRoom:BlossomRoom;
var hisPos:uint;
var v:*;
trace("GOT");
trace(socket.socketID);
if (be.data.randomJoin){
pracRoom = roomSearch;
} else {
pracRoom = room;
};
MovieClip(parent).remotePlayerArray = new Array(false, false, false, false);
MovieClip(parent).allPlayers = new Array();
imIn = false;
i = 0;
myPos = 1;
for each (user in pracRoom.userArray) {
hisPos = 0;
for (v in be.data.arrayId) {
trace(be.data.arrayId);
if (user.socketID == be.data.arrayId[v]){
hisPos = be.data.arrayPos[v];
if (socket.socketID == be.data.arrayId[v]){
myPos = hisPos;
imIn = true;
} else {
MovieClip(parent).remotePlayerArray[i] = true;
};
MovieClip(parent).allPlayers.push({POS:hisPos, NAME:user.vars.userName, ID:user.socketID});
};
};
i++;
};
for (v in be.data.arrayId) {
if ((((((((be.data.arrayId[v] == "NONE")) || ((be.data.arrayId[v] == "COMPUTER1")))) || ((be.data.arrayId[v] == "COMPUTER2")))) || ((be.data.arrayId[v] == "COMPUTER3")))){
MovieClip(parent).allPlayers.push({POS:be.data.arrayPos[v], NAME:be.data.arrayId[v], ID:0});
};
};
team = MovieClip(parent).userRace;
MovieClip(parent).roomMaster = roomMaster;
if (imIn){
MovieClip(parent).gameSet = gameSet;
MovieClip(parent).clientPlayer = [team, myPos, color];
MovieClip(parent).gotoAndStop("Pre", "PRE");
if (be.data.randomJoin){
MovieClip(parent).rankedMatch = true;
STAGE.addEventListener("CLOSETRACER", stopLooking, false, 0, true);
dataTracer.hideTracer();
MovieClip(parent).roomName = ("GameStartX_$" + be.data.randName);
roomSearch.removeEventListener(BlossomEvent.USER_JOIN_ROOM, checkRandomGame);
roomSearch.removeEventListener("beginGame", beginGameHandler);
socket.leaveRoom(roomSearch.roomName);
roomSearch = null;
} else {
MovieClip(parent).roomName = ((("GameStartX_$" + room.roomName) + "_") + be.data.randName);
};
remove();
if (parent != null){
parent.removeChild(this);
};
} else {
if (be.data.randomJoin){
} else {
quitGameRoom();
};
};
}
private function changeRace(me:MouseEvent):void{
MovieClip(parent).userRace++;
if (MovieClip(parent).userRace > 2){
MovieClip(parent).userRace = 0;
};
m.racePlate.gotoAndStop((MovieClip(parent).userRace + 1));
}
private function keyInput(ke:KeyboardEvent):void{
var chatRef:*;
if (ke.keyCode == 13){
if (gameRoomMode){
chatRef = m3;
} else {
chatRef = m;
};
if (chatRef.chatSend.text.indexOf("/stats") == 0){
runChatScript(0, 7, "Sorry, I couldn't find a user with that name in this room.", chatRef);
} else {
if (chatRef.chatSend.text.indexOf("/kick") == 0){
if (roomMaster){
if (gameRoomMode){
runChatScript(1, 6, "Sorry, I couldn't find a user with that name in this room.", chatRef);
} else {
addMessage((("<font color=\"#4F6B47\">" + "You are not in a game room, and cannot kick players.") + "</font>"));
};
} else {
addMessage((("<font color=\"#4F6B47\">" + "You are not the room master, and cannot kick players.") + "</font>"));
};
chatRef.chatSend.text = "";
} else {
if (userName.indexOf("Guest_") == -1){
if (c_countDown == 0){
sendMessage();
c_justSent();
} else {
chatRef.chatSend.text = "";
addMessage((("<font color=\"#4F6B47\">" + "You have sent too many messages. You may not send another message for 60 seconds.") + "</font>"));
};
} else {
chatRef.chatSend.text = "";
addMessage((("<font color=\"#4F6B47\">" + "Guests are not allowed to send messages in chat rooms.") + "</font>"));
};
};
};
};
}
private function closeBox(e:Event){
lastBox = e.target;
justClosed = true;
m3.addEventListener(Event.ENTER_FRAME, upTeamHand, false, 0, true);
}
private function clearMessages():void{
messageArray = new Array();
showMessages();
}
private function receRL(be:BlossomEvent):void{
roomLeader = be.vars.roomLeader;
room.removeEventListener(BlossomEvent.RECEIVE_ROOM_VARS, receRL);
trace(be.vars.gs);
gameSet = be.vars.gs;
m3.gameSetting.gotoAndStop((gameSet + 1));
}
private function clickJoinGameHandler(me:MouseEvent):void{
var j:*;
var i:*;
var varList:Array;
if (m.theList.selectedItem != null){
socket.leaveRoom(room.roomName);
removeChild(m);
roomMaster = false;
addChild(m3);
m3.startGame.visible = false;
for (j in cBoxArray) {
cBoxArray[j].visible = false;
};
for (i in dBoxArray) {
dBoxArray[i].n.text = "None";
};
gameRoomMode = true;
clearMessages();
room = new BlossomRoom(socket, m.theList.selectedItem.data);
varList = new Array("randomFactor", "roomLeader", "gs");
room.getVars(varList);
room.addEventListener(BlossomEvent.RECEIVE_ROOM_VARS, receRL, false, 0, true);
room.addEventListener("updateTeamDisplay", updateTeamDisplayHandler, false, 0, true);
room.addEventListener("beginGame", beginGameHandler, false, 0, true);
addEvs();
};
}
private function chatSpamHand(e:TimerEvent):void{
if (c_countDownSmall > 0){
c_countDownSmall--;
} else {
c_countDownSmall = 2;
if (c_buildUp > 0){
c_buildUp--;
};
};
if (c_countDown > 0){
c_countDown--;
if (c_countDown == 0){
c_buildUp = 0;
};
};
}
private function c_justSent():void{
c_buildUp++;
trace(c_buildUp);
if (c_buildUp >= c_buildUpMax){
c_buildUp = c_buildUpMax;
c_countDown = 30;
};
c_countDownSmall = 3;
}
private function refreshUserList(te:TimerEvent){
listUsers();
}
private function backLobbyHandler(me:MouseEvent):void{
removeChild(m2);
addChild(m);
}
private function rankMatchSit(e:MouseEvent):void{
STAGE.addEventListener("CLOSETRACER", stopLooking, false, 0, true);
dataTracer.clearTracer();
dataTracer.showTracer();
dataTracer.update("Looking for a game...");
dataTracer.progressing = false;
roomSearch = new BlossomRoom(socket, "GSearchXCV_$");
roomSearch.addEventListener(BlossomEvent.USER_JOIN_ROOM, checkRandomGame, false, 0, true);
roomSearch.addEventListener("beginGame", beginGameHandler, false, 0, true);
}
private function userJoinRoomHandler(be:BlossomEvent):void{
var addNew:Boolean;
var added:Boolean;
var saveIndex:uint;
var j:*;
var indexBefore:*;
var labelBefore:*;
var i:uint;
var user:BlossomUser;
listUsers();
addNew = false;
added = false;
if (gameRoomMode){
if (room.userArray.length > 4){
if (be.fromUser.socketID == socket.socketID){
dataTracer.throwError("That game is already full.");
quitGameRoom();
};
};
};
if (((gameRoomMode) && (roomMaster))){
for (j in cBoxArray) {
indexBefore = cBoxArray[j].selectedIndex;
labelBefore = cBoxArray[j].selectedLabel;
addNew = false;
if (cBoxArray[j].selectedLabel == "None"){
addNew = true;
};
cBoxArray[j].removeAll();
cBoxArray[j].addItem({label:"None", data:"NONE"});
cBoxArray[j].addItem({label:"Easy CPU", data:"COMPUTER1"});
cBoxArray[j].addItem({label:"Normal CPU", data:"COMPUTER2"});
cBoxArray[j].addItem({label:"Hard CPU", data:"COMPUTER3"});
i = 4;
for each (user in room.userArray) {
cBoxArray[j].addItem({label:user.vars.userName, data:user.socketID});
if (addNew){
if (user.vars.userName == be.fromUser.vars.userName){
saveIndex = i;
};
} else {
if (user.vars.userName == labelBefore){
saveIndex = i;
};
};
i++;
};
if (((!(addNew)) || (added))){
if (indexBefore < 2){
cBoxArray[j].selectedIndex = indexBefore;
} else {
cBoxArray[j].selectedIndex = saveIndex;
};
} else {
cBoxArray[j].selectedIndex = saveIndex;
added = true;
};
};
m3.addEventListener(Event.ENTER_FRAME, upTeamHand, false, 0, true);
};
}
private function runChatScript(caseString:uint, caseStringSub:uint, errorString:String, chatRef):void{
var foundTheGuy:Boolean;
var user:BlossomUser;
var uNameRank:String;
var regExNew:RegExp;
var tName:String;
var _local10:String;
var _local11:Object;
foundTheGuy = false;
for each (user in room.userArray) {
uNameRank = chatRef.chatSend.text.substr(caseStringSub);
regExNew = new RegExp(uNameRank, "i");
tName = user.vars.userName;
if (regExNew.test(tName)){
if ((((uNameRank.length == tName.length)) && ((tName.indexOf("Guest_") == -1)))){
foundTheGuy = true;
switch (caseString){
case 0:
_local10 = ((((((("<font color=\"#4F6B47\">" + tName) + "'s Rank: ") + user.vars.userData.rank) + ". Games played: ") + user.vars.userData.gamesPlayed) + ".") + "</font>");
break;
case 1:
_local10 = (((("<font color=\"#4F6B47\">" + "Kicked ") + tName) + " from the game.") + "</font>");
_local11 = new Object();
_local11.kick = true;
socket.sendToUser(user.socketID, _local11);
break;
};
};
};
};
chatRef.chatSend.text = "";
if (!foundTheGuy){
addMessage((("<font color=\"#4F6B47\">" + errorString) + "</font>"));
} else {
addMessage(_local10);
};
}
private function changeRooms(e:Event):void{
var rankST:String;
m.removeEventListener(Event.ENTER_FRAME, changeRooms);
if (normalRoom != m.roomBox.selectedLabel){
normalRoom = m.roomBox.selectedLabel;
socket.leaveRoom(room.roomName);
room = new BlossomRoom(socket, ("MLX_" + normalRoom));
addEvs();
listUsers();
rankST = ((("<font color=\"#4F6B47\">" + "Now joining chat channel: ") + normalRoom) + "</font>");
addMessage(rankST);
};
}
private function startGameHandler(me:MouseEvent):void{
var goAhead:Boolean;
var teamArray:*;
var i:*;
var checkID:*;
var j:*;
var vars:Object;
var q:*;
var letterArr2:Array;
var bah2:String;
goAhead = true;
teamArray = new Array();
for (i in cBoxArray) {
teamArray.push({ID:cBoxArray[i].selectedItem.data, POS:(i + 1)});
};
for (i in teamArray) {
checkID = teamArray[i].ID;
for (j in teamArray) {
if (j != i){
if (checkID == teamArray[j].ID){
if (((((((!((checkID == "NONE"))) && (!((checkID == "COMPUTER1"))))) && (!((checkID == "COMPUTER2"))))) && (!((checkID == "COMPUTER3"))))){
goAhead = false;
dataTracer.throwError("You cannot have the same player in two different slots.");
};
};
};
};
};
if (goAhead){
vars = new Object();
vars.arrayId = new Array();
vars.arrayPos = new Array();
for (q in teamArray) {
vars.arrayId.push(teamArray[q].ID);
vars.arrayPos.push(teamArray[q].POS);
};
letterArr2 = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
bah2 = letterArr2[Math.round((Math.random() * (letterArr2.length - 1)))];
vars.randName = (("G_" + bah2) + Math.round((Math.random() * 9999)));
room.sendToRoom(vars, true, "beginGame");
};
}
private function sendMessage():void{
var chatRef:*;
var message:String;
var vars:Object;
if (gameRoomMode){
chatRef = m3;
} else {
chatRef = m;
};
if (chatRef.chatSend.text != ""){
message = chatRef.chatSend.text;
chatRef.chatSend.text = "";
vars = new Object();
vars.message = message;
vars.userName = userName;
room.sendToRoom(vars, true, "chat");
};
}
private function showMessages():void{
var str:String;
var chatRef:*;
str = messageArray.join("<br/>");
if (gameRoomMode){
chatRef = m3;
} else {
chatRef = m;
};
chatRef.chatBox.htmlText = str;
chatRef.chatBox.scrollV = chatRef.chatBox.maxScrollV;
}
private function quitGameRoom():void{
socket.leaveRoom(room.roomName);
removeChild(m3);
addChild(m);
gameRoomMode = false;
clearMessages();
socket.getRooms();
socket.addEventListener(BlossomEvent.RECEIVE_ROOMS, refreshRoomListHandler, false, 0, true);
room = new BlossomRoom(socket, ("MLX_" + normalRoom));
addEvs();
listUsers();
}
private function beginRoomSwitch(e:Event):void{
m.addEventListener(Event.ENTER_FRAME, changeRooms, false, 0, true);
}
private function addEvs():void{
room.addEventListener("chat", receiveChatHandler, false, 0, true);
room.addEventListener(BlossomEvent.USER_JOIN_ROOM, userJoinRoomHandler, false, 0, true);
room.addEventListener(BlossomEvent.USER_LEAVE_ROOM, userLeaveRoomHandler, false, 0, true);
}
private function clickExitHandler(me:MouseEvent):void{
remove();
dataTracer.suppress();
SocketManager.close();
MovieClip(parent).gotoAndStop("START", "MENU");
if (parent != null){
parent.removeChild(this);
};
}
private function clickCreateGameHandler(me:MouseEvent):void{
removeChild(m);
addChild(m2);
m2.makeGame.addEventListener(MouseEvent.CLICK, makeGameHandler, false, 0, true);
}
private function addSystemMessage(message:String):void{
message = (("#<i>" + message) + "</i>");
addMessage(message);
}
private function receiveChatHandler(be:BlossomEvent):void{
var chat:Object;
var message:String;
var userName:String;
var htmlName:String;
var str:String;
chat = be.data;
message = Data.filterSwearing(chat.message);
userName = chat.userName;
message = message.replace(/>/gi, ">");
message = message.replace(/</gi, "<");
htmlName = ((("<font color=\"#2B3C55\">" + userName) + ": ") + "</font>");
str = (htmlName + message);
addMessage(str);
}
}
}//package
Section 204
//MultiplayerScreenGraphic (MultiplayerScreenGraphic)
package {
import fl.controls.*;
import flash.display.*;
import fl.data.*;
import flash.text.*;
public dynamic class MultiplayerScreenGraphic extends MovieClip {
public var chatSend:TextField;
public var i5:int;
public var exitButton:Button;
public var j5;
public var createGameButton:Button;
public var s_gwon:TextField;
public var s_gplayed:TextField;
public var playRankedButton:Button;
public var s_cwins:TextField;
public var collObj5:DataProvider;
public var raceButton:SimpleButton;
public var chatBox:TextField;
public var textBox:TextField;
public var s_rank:TextField;
public var joinGameButton:Button;
public var T:MenuFont;
public var tf:TextFormat;
public var __id2_:Button;
public var collProp5:Object;
public var theList:List;
public var s_wratio:TextField;
public var racePlate:MovieClip;
public var itemObj5:SimpleCollectionItem;
public var ranker:MovieClip;
public var collProps5:Array;
public var roomBox:ComboBox;
public function MultiplayerScreenGraphic(){
super();
addFrameScript(0, frame1);
__setProp___id2__MultiplayerScreenGraphic_Layer2_1();
__setProp_createGameButton_MultiplayerScreenGraphic_Layer2_1();
__setProp_roomBox_MultiplayerScreenGraphic_Layer2_1();
__setProp_exitButton_MultiplayerScreenGraphic_Layer2_1();
__setProp_joinGameButton_MultiplayerScreenGraphic_Layer2_1();
__setProp_playRankedButton_MultiplayerScreenGraphic_Layer2_1();
}
function __setProp_roomBox_MultiplayerScreenGraphic_Layer2_1(){
roomBox["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
collObj5 = new DataProvider();
collProps5 = [{label:"Lobby", data:""}, {label:"Veteran's Hall", data:""}, {label:"Team Channel", data:""}, {label:"Deutsch Zimmer", data:""}, {label:"AFK Garden", data:""}];
i5 = 0;
while (i5 < collProps5.length) {
itemObj5 = new SimpleCollectionItem();
collProp5 = collProps5[i5];
for (j5 in collProp5) {
itemObj5[j5] = collProp5[j5];
};
collObj5.addItem(itemObj5);
i5++;
};
roomBox.dataProvider = collObj5;
roomBox.editable = false;
roomBox.enabled = true;
roomBox.prompt = "";
roomBox.restrict = "";
roomBox.rowCount = 5;
roomBox.visible = true;
roomBox["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function frame1(){
stop();
T = new MenuFont();
tf = new TextFormat();
tf.font = T.fontName;
tf.size = 14;
tf.color = 0;
exitButton.setStyle("textFormat", tf);
joinGameButton.setStyle("textFormat", tf);
createGameButton.setStyle("textFormat", tf);
playRankedButton.setStyle("textFormat", tf);
theList.setRendererStyle("textFormat", tf);
}
function __setProp_createGameButton_MultiplayerScreenGraphic_Layer2_1(){
createGameButton["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
createGameButton.emphasized = false;
createGameButton.enabled = true;
createGameButton.label = "Create Game";
createGameButton.labelPlacement = "right";
createGameButton.selected = false;
createGameButton.toggle = false;
createGameButton.visible = true;
createGameButton["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_playRankedButton_MultiplayerScreenGraphic_Layer2_1(){
playRankedButton["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
playRankedButton.emphasized = false;
playRankedButton.enabled = true;
playRankedButton.label = "Play Random Match";
playRankedButton.labelPlacement = "right";
playRankedButton.selected = false;
playRankedButton.toggle = false;
playRankedButton.visible = true;
playRankedButton["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp___id2__MultiplayerScreenGraphic_Layer2_1(){
__id2_["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
__id2_.emphasized = false;
__id2_.enabled = true;
__id2_.label = "Play Quick Game";
__id2_.labelPlacement = "right";
__id2_.selected = false;
__id2_.toggle = false;
__id2_.visible = true;
__id2_["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_exitButton_MultiplayerScreenGraphic_Layer2_1(){
exitButton["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
exitButton.emphasized = false;
exitButton.enabled = true;
exitButton.label = "Exit Lobby";
exitButton.labelPlacement = "right";
exitButton.selected = false;
exitButton.toggle = false;
exitButton.visible = true;
exitButton["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
function __setProp_joinGameButton_MultiplayerScreenGraphic_Layer2_1(){
joinGameButton["componentInspectorSetting"] = true;
//unresolved jump
var _slot1 = e;
joinGameButton.emphasized = false;
joinGameButton.enabled = true;
joinGameButton.label = "Join Game";
joinGameButton.labelPlacement = "right";
joinGameButton.selected = false;
joinGameButton.toggle = false;
joinGameButton.visible = true;
joinGameButton["componentInspectorSetting"] = false;
//unresolved jump
var _slot1 = e;
}
}
}//package
Section 205
//musicKon (musicKon)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class musicKon {
private static var fadeRate:Number;
private static var theStage:Stage;
public static var systemRunning:Boolean = false;
private static var masterVol:SoundTransform = new SoundTransform();
private static var currentVol:Number = 0;
private static var fadeRateDefault:Number = 0.01;
private static var theSong;
private static var initAlready:Boolean = false;
private static var ThemeChannel:SoundChannel = new SoundChannel();
private static var musicFills:Array = new Array();
private static var changeCounter:uint;
private static var chosenMode:uint;
private static var nextMode:Array;
private static var faderDir:Boolean = true;
private static var currentMode:uint;
private static var switchState:Boolean = true;
private static var centi:Number = 3400;
private static var yesPlay:Boolean;
private static var musicArray:Array = new Array();
private static var TransitChannel:SoundChannel = new SoundChannel();
private static var playTheme2:Boolean = false;
private static var playingSong;
private static var prevSong:uint;
private static var MainChannel:SoundChannel = new SoundChannel();
private static var systemShutOff:Boolean = false;
private static var playTheme:Boolean = false;
private static var oldMode:uint;
private static var MoodChannel:SoundChannel = new SoundChannel();
private static var themeSong;
public function musicKon(){
super();
}
public static function setTheme(a:uint){
if (a == 0){
themeSong = new FascistTheme();
};
if (a == 1){
themeSong = new CommunistTheme();
};
if (a == 2){
themeSong = new CapitalistTheme();
};
}
private static function resetAllMusic():void{
prevSong = 0;
nextMode = new Array();
chosenMode = 0;
currentMode = 0;
changeCounter = 1;
playTheme = false;
switchState = true;
playingSong = musicArray[0].array[0];
}
public static function init(st:Stage):void{
var f1:Fill1;
var f2:Fill2;
var f3:Fill3;
var f4:Fill4;
var f5:Fill5;
var f6:Fill6;
if (!initAlready){
initAlready = true;
theStage = st;
f1 = new Fill1();
f2 = new Fill2();
f3 = new Fill3();
f4 = new Fill4();
f5 = new Fill5();
f6 = new Fill6();
musicFills[0] = new Array();
musicFills[0].push(null);
musicFills[0].push(new Array(f1, f2, f3, f6));
musicFills[0].push(new Array(f3, f6));
musicFills[1] = new Array();
musicFills[1].push(new Array(f3, f6));
musicFills[1].push(new Array(f1, f2, f4, f5));
musicFills[1].push(new Array(f1, f3, f4, f6));
musicFills[2] = new Array();
musicFills[2].push(new Array(f3, f6));
musicFills[2].push(new Array(f3, f6));
musicFills[2].push(new Array(f1, f2, f4));
musicArray[0] = new Object();
musicArray[0].canGo = new Array(1, 2);
musicArray[0].playTimes = 1;
musicArray[0].array = new Array();
musicArray[0].array.push(new Ambient1());
musicArray[0].array.push(new Ambient2());
musicArray[0].array.push(new Ambient3());
musicArray[1] = new Object();
musicArray[1].canGo = new Array(0, 2);
musicArray[1].playTimes = 1;
musicArray[1].array = new Array();
musicArray[1].array.push(new Beat1());
musicArray[1].array.push(new Beat2());
musicArray[1].array.push(new Beat3());
musicArray[1].array.push(new Beat4());
musicArray[1].array.push(new Beat5());
musicArray[2] = new Object();
musicArray[2].canGo = new Array(0, 1);
musicArray[2].playTimes = 0;
musicArray[2].array = new Array();
musicArray[2].array.push(new Slow1());
musicArray[2].array.push(new Slow2());
masterVol.volume = currentVol;
MainChannel.soundTransform = masterVol;
TransitChannel.soundTransform = masterVol;
ThemeChannel.soundTransform = masterVol;
MoodChannel.soundTransform = masterVol;
resetAllMusic();
};
}
private static function runFader(event:Event):void{
if (faderDir){
if (currentVol < 1){
currentVol = (currentVol + fadeRate);
} else {
currentVol = 1;
endFader();
};
} else {
if (currentVol > 0){
currentVol = (currentVol - fadeRate);
} else {
currentVol = 0;
endFader();
};
};
masterVol.volume = currentVol;
MainChannel.soundTransform = masterVol;
TransitChannel.soundTransform = masterVol;
ThemeChannel.soundTransform = masterVol;
MoodChannel.soundTransform = masterVol;
}
public static function startSystem():void{
resetAllMusic();
systemRunning = true;
yesPlay = true;
theStage.addEventListener(Event.ENTER_FRAME, runMusic, false, 0, true);
}
public static function closeSystem():void{
systemRunning = false;
MainChannel.stop();
theStage.removeEventListener(Event.ENTER_FRAME, runMusic);
}
private static function G(a:Number):Number{
return (Math.round((a / 10)));
}
private static function switchMusic():void{
var songGet:Boolean;
var testSong:uint;
var TS:*;
oldMode = currentMode;
if (changeCounter > 0){
if ((((changeCounter == 1)) && ((currentMode == 0)))){
playTheme = true;
};
songGet = false;
while (!(songGet)) {
testSong = R(musicArray[currentMode].array);
if (testSong != prevSong){
prevSong = testSong;
changeCounter--;
songGet = true;
} else {
songGet = false;
};
};
} else {
currentMode = R(musicArray[currentMode].canGo, true);
changeCounter = musicArray[currentMode].playTimes;
prevSong = R(musicArray[currentMode].array);
};
theSong = musicArray[currentMode].array[prevSong];
if (((!((currentMode == 0))) || (!((oldMode == 0))))){
TS = R(musicFills[oldMode][currentMode], true);
TransitChannel = TS.play();
};
}
private static function R(a:Array, returnVal:Boolean=false){
var rander:Number;
var rtake:*;
rander = (Math.random() * 100);
rtake = Math.round(((rander * (a.length - 1)) / 100));
if (returnVal){
return (a[rtake]);
};
return (rtake);
}
private static function runMusic(event:Event):void{
if (yesPlay){
MainChannel = playingSong.play();
yesPlay = false;
};
if (G(MainChannel.position) >= (centi - 265)){
if (switchState){
switchMusic();
switchState = false;
};
};
if (G(MainChannel.position) >= 840){
if (playTheme2){
if (prevSong != 2){
ThemeChannel = themeSong.play();
};
playTheme2 = false;
};
};
if (G(MainChannel.position) >= (centi - 15)){
MainChannel = theSong.play();
playingSong = theSong;
switchState = true;
if (playTheme){
playTheme = false;
playTheme2 = true;
};
};
}
public static function startFader(r:Number=0, fType:uint=0):void{
if (r == 0){
fadeRate = fadeRateDefault;
} else {
fadeRate = r;
};
systemShutOff = false;
if (fType == 1){
faderDir = true;
if (!systemRunning){
startSystem();
};
};
if (fType == 2){
faderDir = false;
systemShutOff = true;
};
theStage.addEventListener(Event.ENTER_FRAME, runFader, false, 0, true);
}
private static function endFader():void{
if (systemShutOff){
closeSystem();
};
theStage.removeEventListener(Event.ENTER_FRAME, runFader);
}
}
}//package
Section 206
//optionData (optionData)
package {
public class optionData {
private var option:Array;
private var iN:Number;// = -1
public static var LIST:Array = new Array();
public function optionData():void{
iN = -1;
option = new Array();
super();
make(0, 0, 0, 5, "Destroy", [0, 24], "Demolish this building to make room for a new one.");
option.buildOrder = 0;
make(0, 0, 0, 1, "Main Base", [0, 0], "X");
option.buildOrder = 1;
make(40, 30, 30, 5, "Build Outpost", [1, 0], "You can deploy marines, tanks, and other combat vehicles from this building.");
option.buildOrder = 2;
make(40, 30, 30, 5, "Build Forge", [1, 0], "You can deploy sky drones and andriod forces from this building.");
option.buildOrder = 3;
make(40, 10, 30, 5, "Build Hospital", [1, 0], "Treat the wounded, and deploy meditecs from this building.");
option.buildOrder = 4;
make(50, 0, 0, 10, "Build Bank", [1, 0], "This building allows you to gain financial resources.");
option.buildOrder = 5;
make(60, 25, 25, 15, "Build Armory", [1, 0], "This building allows to call in any additional supplies.");
option.buildOrder = 6;
make(50, 0, 0, 10, "Build Generator", [1, 0], "This building allows you to gain energy resources.");
option.buildOrder = 7;
make(80, 30, 30, 20, "Build Special Operations", [1, 0], "Launch missiles from this building.");
option.buildOrder = 8;
make(30, 0, 0, 17, "Upgrade to Barracks", [1, 0], "Upgrade this building into a Barracks (Tier 2).");
option.buildOrder = 9;
make(60, 0, 0, 15, "Upgrade to Manufactory", [1, 0], "Upgrade this building into a Manfactory (Tier 2).");
option.buildOrder = 10;
make(50, 0, 0, 15, "Upgrade to Treasury", [1, 0], "Upgrade this building into a Treasury (Tier 2).");
option.buildOrder = 13;
make(50, 0, 0, 15, "Upgrade to Solar Grid", [1, 0], "Upgrade this building into a Solar Grid (Tier 2).");
option.buildOrder = 14;
make(0, 2, 0, 1.2, "Deploy Marine", [0, 6], "Light infantry unit, armed with shocks rifles and anti-air rockets.");
option.buildUnits = new Array([1]);
make(5, 10, 0, 5, "Deploy Chronite Tank", [0, 7], "Heavily armored vehicle. Fires explosive shells at ground targets.");
option.buildUnits = new Array([2]);
make(3, 0, 7, 4, "Deploy Scout", [0, 8], "Fast flying drone with light armor. Fitted with formidable chronite-piercing weapons.");
option.buildUnits = new Array([3]);
make(0, 0, 5, 1.2, "Deploy A25-Roman", [0, 9], "Standard andriod soldier, armed with pulse rifles. Cannot attack air units.");
option.buildUnits = new Array([4]);
make(0, 6, 0, 8, "Deploy Meditec", [0, 10], "Light infantry unit that heals injured men and fixes any damaged ground vehicles.");
option.buildUnits = new Array([5]);
option.buildReq = 4;
make(5, 16, 0, 5, "Deploy Gröditz", [0, 12], "Heavy bi-pedal Walker unit with rapid firing weapons, effective against both ground and air targets.");
option.buildUnits = new Array([6]);
make(23, 5, 3, 7.3, "Deploy Phantom", [0, 13], "Assault helicopter that can rain down rapid fire against ground targets, but cannot fire at air targets.");
option.buildUnits = new Array([7]);
make(0, 0, 23, 5, "Deploy Sakata Mk-II", [0, 14], "Standard Sakata body, fitted with strong anti-air cannons, but unable to attack ground targets.");
option.buildUnits = new Array([9]);
make(0, 0, 35, 3, "Deploy Sakata Spider", [0, 15], "Fast and heavily armored assault unit with self-healing capabilities. Cannot attack air targets.");
option.buildUnits = new Array([8]);
make(0, 30, 10, 3, "Deploy Hover Tank", [0, 16], "Specially armored tank, equipped with deadly anti-Chronite ground weapons.");
option.buildUnits = new Array([10]);
make(30, 50, 25, 15, "Deploy Black Queen", [0, 17], "Heavily armored air superiority fighter. Can drop bombs on ground targets every 12 seconds.");
option.buildUnits = new Array([11]);
make(7, 12, 0, 1.6, "Deploy Sniper", [0, 11], "Light infantry unit, armed with a long range anti-Chronite sniper rifle.");
option.buildUnits = new Array([12]);
make(0, 0, 0, 5, "Resuscitate", [0, 20], "Gain 3 additional manpower over 5 seconds.");
option.buildResource[1] = 3;
make(0, 0, 0, 4.8, "Stock Exhange", [0, 19], "Gain 3 additional money over 5 seconds.");
option.buildResource[0] = 3;
make(0, 0, 0, 4.8, "Generate Power", [0, 21], "Gain 3 additional energy over 5 seconds.");
option.buildResource[2] = 3;
make(0, 0, 0, 3, "Gold Trading", [0, 19], "Gain 4 additional money over 3 seconds.");
option.buildResource[0] = 4;
make(0, 0, 0, 3, "Absorb Power", [0, 21], "Gain 4 additional energy over 3 seconds.");
option.buildResource[2] = 4;
make(0, 0, 0, 10, "Plan Reinforcements", [0, 20], "Gain 9 additional manpower over 10 seconds.");
option.buildResource[1] = 9;
make(0, 0, 0, 10, "Plan Financial Support", [0, 19], "Gain 9 additional money over 10 seconds.");
option.buildResource[0] = 9;
make(0, 0, 0, 10, "Plan Reserve Energy", [0, 21], "Gain 9 additional energy over 10 seconds.");
option.buildResource[2] = 9;
make(80, 0, 50, 10, "Upgrade Structure", [1, 0], "Uprade this building into an Arsenal (Tier 3). Requires an Armory to upgrade.");
option.buildOrder = 11;
option.buildReq = 6;
make(70, 0, 20, 10, "Upgrade Structure", [1, 0], "Upgrade this building into a Mechanics Terminal (Tier 3). Requires an Armory to upgrade.");
option.buildOrder = 12;
option.buildReq = 6;
make(0, 0, 0, 5, "Salvage", [0, 21], "Gain 2 energy over 5 seconds.");
option.buildResource[2] = 2;
make(0, 0, 0, 30, "Create Clones", [0, 20], "Gain 20 manpower over 30 seconds.");
option.buildResource[1] = 20;
make(60, 0, 15, 1, "Launch Missile", [0, 22], "Launches a deadly missile at enemies closest to the base.");
option.buildMissile = 1;
make(5, 16, 0, 5, "Deploy Gröditz", [0, 12], "Requires Armory to deploy. Heavy bi-pedal 'Walker' unit with rapid firing weapons, effective against both ground and air targets.");
option.buildUnits = new Array([6]);
option.buildReq = 6;
make(0, 0, 20, 5, "Deploy Sakata Mk-II", [0, 14], "Requires Armory to deploy. Standard Sakata body, fitted with strong anti-air cannons, but unable to attack ground targets.");
option.buildUnits = new Array([9]);
option.buildReq = 6;
make(15, 0, 60, 1, "Launch Missile", [0, 23], "Launches a deadly missile at enemies closest to the base.");
option.buildMissile = 1;
make(75, 20, 0, 1, "Convert to Avionics", [1, 0], "Convert this building into an Avionics Terminal.");
option.buildOrder = 15;
make(3, 0, 6, 2.5, "Deploy Scout", [0, 8], "Fast flying drone with light armor. Fitted with formidable chronite-piercing weapons.");
option.buildUnits = new Array([3]);
make(40, 10, 40, 15, "Deploy Gladiator", [0, 18], "Specially developed branch of the Roman andriods, with stronger parts, and air-attack capabilities.");
option.buildUnits = new Array([13]);
make(0, 0, 0, 3, "Recruit", [0, 20], "Gain 1 manpower over 3 seconds.");
option.buildResource[1] = 1;
make(0, 0, 0, 1, "Scramble Rescue Team", [0, 25], "Instantly deploy 10 Meditecs.", 100);
option.buildUnits = new Array(5, 5, 5, 5, 5, 5, 5, 5, 5, 5);
make(0, 0, 0, 1, "Deploy Modified Sakata", [0, 26], "Deploy a specialized Sakata unit.", 100);
option.buildUnits = new Array([14]);
make(0, 0, 0, 1, "Deploy Modified Phantom", [0, 27], "Deploy a specialized Phantom unit.", 100);
option.buildUnits = new Array([15]);
make(0, 0, 0, 1, "Deploy Special Forces", [0, 28], "Deploy a team of highly trained infantry.", 100);
option.buildUnits = new Array(16, 16, 16, 16, 5, 5, 12, 12);
}
private function make(a:uint, b:uint, c:uint, d:Number, e:String, f:Array, g:String, h:uint=0):void{
iN++;
LIST[iN] = new Array();
LIST[iN].push(a, b, c, d, h);
LIST[iN].orders = new Array();
option = LIST[iN];
option.iconGraphic = new Array();
option.iconGraphic[0] = f[0];
option.iconGraphic[1] = f[1];
option.nameLabel = e;
option.buildOrder = null;
option.buildResource = new Array(0, 0, 0);
option.buildStock = null;
option.buildTech = null;
option.buildUnits = null;
option.buildMissile = null;
option.buildReq = null;
option.stockReq = null;
option.techReq = null;
option.tip = new tipObject(e, a, b, c, g, h);
}
}
}//package
Section 207
//playerKon (playerKon)
package {
import flash.events.*;
import flash.utils.*;
public class playerKon {
public var aiDifficulty:uint;// = 1
public var playerName:String;
public var m_gain:uint;
public var stock:Array;
public var e_gain:uint;
public var tech:Array;
public var aiOn:Boolean;
public var AI:aiBody;
private var dataPair:Array;
public var POS:uint;
public var cityColor:uint;// = 0
private var dataRegion:Array;
public var createGap:uint;// = 0
public var builds:Array;
public var eteam:Team;
public var race:uint;
private var aiGainArray:Array;
private var T:Timer;
public var hackSend:Boolean;// = true
private var coEff:Number;// = 1
public var team:Team;
public var idCounter:uint;
private var r2_e:int;// = 50
public var theBase:unitBody;
private var r2_i:int;// = 0
private var r2_m:int;// = 50
private var r2_p:int;// = 50
private var dataSection:Array;
public var p_gain:uint;
private var dataZone:Array;
private var incomeData:Array;
public var idTag:String;
public function playerKon(incomeSet:uint=0):void{
var ju:*;
var th:*;
createGap = 0;
T = new Timer(1000);
cityColor = 0;
hackSend = true;
stock = new Array();
tech = new Array();
r2_p = 50;
r2_m = 50;
r2_e = 50;
r2_i = 0;
aiGainArray = new Array(0.7, 1, 1.5, 2.2);
aiDifficulty = 1;
coEff = 1;
dataSection = new Array(4);
dataZone = new Array(4);
dataRegion = new Array(4);
dataPair = new Array(2);
incomeData = new Array();
builds = new Array();
super();
if (!gameKon.theRoot.singlePlayerMode){
T.start();
T.addEventListener(TimerEvent.TIMER, fresh, false, 0, true);
};
ju = 0;
while (ju < 4) {
dataZone[ju] = new Array();
dataRegion[ju] = new Array();
dataSection[ju] = new Array();
th = 0;
while (th < 5) {
dataZone[ju][th] = Math.round(((Math.random() * 100) + 1));
dataRegion[ju][th] = Math.round(((Math.random() * 100) - 50));
dataSection[ju][th] = (-(dataRegion[ju][th]) * dataZone[ju][th]);
th++;
};
ju++;
};
dataPair = new Array(GRP(), GRP());
setRes(0, 50);
setRes(1, 50);
setRes(2, 50);
setRes(3, 0);
idCounter = 0;
aiOn = false;
AI = null;
coEff = 1;
race = incomeSet;
incomeData = new Array();
incomeData[0] = new Array(2, 4, 4);
incomeData[1] = new Array(4, 4, 2);
incomeData[2] = new Array(3, 5, 2);
builds = new Array();
gameKon.displayArray.push(this);
setIncome(incomeSet);
stock = [0, 0, 0, 0, 0, 0, 0, 0];
tech = [0, 0, 0, 0, 0, 0, 0, 0];
}
public function killEvents():void{
if (AI != null){
AI.killAi();
AI = null;
};
gameKon.theStage.removeEventListener("income", income);
}
public function getData(a:uint){
var data_A:uint;
var data_B:uint;
data_A = ((dataSection[a][dataPair[0]] / dataZone[a][dataPair[0]]) + dataRegion[a][dataPair[0]]);
data_B = ((dataSection[a][dataPair[1]] / dataZone[a][dataPair[1]]) + dataRegion[a][dataPair[1]]);
if (data_A == data_B){
return (data_B);
};
}
public function startAi(pos:uint, dif:uint, be:uint=99):void{
POS = pos;
gameKon.theStage.removeEventListener("income", income);
AI = new aiBody(this, be);
setRes(0, 50);
setRes(1, 50);
setRes(2, 50);
setRes(3, 0);
aiOn = true;
switch (dif){
case 1:
aiDifficulty = 0;
break;
case 2:
aiDifficulty = 1;
break;
case 3:
aiDifficulty = 2;
break;
case 4:
aiDifficulty = 3;
break;
default:
aiDifficulty = 1;
break;
};
coEff = aiGainArray[aiDifficulty];
}
private function fresh(te:TimerEvent):void{
createGap = 0;
hackSend = true;
}
public function income(event:Event):void{
if (team != null){
if (team.baseAlive){
team.setGain();
addRes(3, team.gainFactor);
if (getData(3) > 100){
setRes(3, 100);
};
addRes(0, (m_gain * coEff));
addRes(1, (p_gain * coEff));
addRes(2, (e_gain * coEff));
};
};
}
public function addRes(res:int, val:uint):void{
var th:*;
th = 0;
while (th < 5) {
dataSection[res][th] = (dataSection[res][th] + (val * dataZone[res][th]));
th++;
};
}
public function setIncome(incomeSet:uint=0):void{
gameKon.theStage.addEventListener("income", income);
race = incomeSet;
p_gain = incomeData[incomeSet][0];
m_gain = incomeData[incomeSet][1];
e_gain = incomeData[incomeSet][2];
}
public function setRes(res:int, val:uint):void{
var th:*;
th = 0;
while (th < 5) {
dataSection[res][th] = ((val - dataRegion[res][th]) * dataZone[res][th]);
th++;
};
}
public function get r_e():int{
return (getData(2));
}
public function get r_m():int{
return (getData(0));
}
private function GRP():uint{
return (Math.round((Math.random() * 4)));
}
public function get r_i():int{
return (getData(3));
}
public function get r_p():int{
return (getData(1));
}
}
}//package
Section 208
//renderMachine (renderMachine)
package {
import flash.display.*;
import flash.geom.*;
public class renderMachine {
public static var WEP:_weapon = new _weapon();
public static var UNIT:_unit = new _unit();
public static var trail:Array = new Array();
public static var poly:Number = 1;
public static var hold:Sprite = new Sprite();
public static var weapons:Array = new Array();
private static var drawingBuls:Boolean = false;
public static var Adjuster:adjuster = new adjuster();
public static var copyBase:Array = new Array();
public static var TRAIL:_trail = new _trail();
public static var units:Array = new Array();
public static var EX:_ex = new _ex();
public static var BaseGraphicsMain:baseGraphicsMain = new baseGraphicsMain();
public static var originalButtons:Array = new Array();
public static var ICON:_icon = new _icon();
public static var copyUnits:Array = new Array();
public static var explosions:Array = new Array();
public static var buildings:Array = new Array();
public function renderMachine(){
super();
}
public static function renderGo(a, b:Number, c:Number, d:Array, e, anim:Boolean=false, animated:Boolean=false, ob:Object=null, col=null):void{
var i:uint;
var fireFirst:*;
var bitmap:*;
var b2:Number;
var c2:Number;
var colorMatt:*;
var colorTransform:ColorTransform;
if (animated){
ob.run = new uint(0);
ob.fire = new uint(0);
ob.death = new uint(0);
ob.killTime = new uint(0);
ob.prefire = new uint(0);
fireFirst = new uint(0);
};
i = 0;
if (hold.numChildren > 0){
hold.removeChildAt(0);
};
hold.addChild(a);
a.scaleX = (1 / poly);
a.scaleY = (1 / poly);
while (i < e.totalFrames) {
i++;
if ((b + c) == 0){
if (anim){
if (drawingBuls){
b2 = b;
c2 = c;
} else {
b2 = (e.width * 1.1);
c2 = (e.height * 1.1);
};
} else {
b2 = hold.width;
c2 = hold.height;
};
} else {
b2 = b;
c2 = c;
};
if (col != null){
if (e.currentLabel == "death"){
} else {
colorMatt = e.getChildAt(0);
colorTransform = colorMatt.transform.colorTransform;
colorTransform.color = col;
colorMatt.transform.colorTransform = colorTransform;
};
};
if (e.currentLabel == "run"){
if (ob.run == 0){
ob.run = (e.currentFrame - 1);
};
};
if (e.currentLabel == "prefire"){
if (fireFirst == 0){
fireFirst = (e.currentFrame - 1);
};
};
if (e.currentLabel == "fire"){
if (ob.fire == 0){
ob.fire = (e.currentFrame - 1);
};
};
if (e.currentLabel == "death"){
if (ob.death == 0){
ob.death = (e.currentFrame - 1);
};
};
bitmap = new BitmapData(b2, c2, true, 0);
bitmap.draw(hold);
d.push(bitmap);
e.nextFrame();
};
if (animated){
if (ob.normal.length > 1){
ob.killTime = (ob.normal.length - ob.death);
};
if (fireFirst != 0){
ob.prefire = (ob.fire - fireFirst);
};
};
}
public static function renderAll(r_id:uint, col:Array=null, r_pop:uint=0):void{
var maxR:*;
var r:*;
var wA:Array;
var hA:Array;
var Mask:Shape;
trace(r_id);
if (r_id == 0){
renderGo(BaseGraphicsMain, (59 / poly), (97.9 / poly), buildings, BaseGraphicsMain);
};
if (r_id == 0){
renderGo(ICON, (45 / poly), (45 / poly), originalButtons, ICON);
};
if (r_id == 2){
units[r_pop] = new Array();
UNIT = new _unit();
drawingBuls = false;
maxR = UNIT.numChildren;
r = 0;
while (r < maxR) {
units[r_pop][r] = new Object();
units[r_pop][r].normal = new Array();
renderGo(UNIT.getChildAt(0), 0, 0, units[r_pop][r].normal, UNIT.getChildAt(0), true, true, units[r_pop][r], col[r_pop]);
r++;
};
};
if (r_id == 0){
maxR = TRAIL.numChildren;
r = 0;
while (r < maxR) {
trail[r] = new Object();
trail[r].normal = new Array();
renderGo(TRAIL.getChildAt(0), 0, 0, trail[r].normal, TRAIL.getChildAt(0), true);
r++;
};
};
if (r_id == 0){
maxR = WEP.numChildren;
r = 0;
while (r < maxR) {
weapons[r] = new Object();
weapons[r].normal = new Array();
renderGo(WEP.getChildAt(0), 0, 0, weapons[r].normal, WEP.getChildAt(0), true);
r++;
};
};
if (r_id == 0){
wA = new Array(23, 23, 23, 125, 74, 63, 30, 30, 63, 20, 23, 25, 22, 22, 33);
hA = new Array(23, 23, 23, 67, 74, 63, 30, 30, 63, 28, 23, 33, 33, 33, 33);
maxR = EX.numChildren;
drawingBuls = true;
r = 0;
while (r < maxR) {
explosions[r] = new Object();
explosions[r].normal = new Array();
renderGo(EX.getChildAt(0), wA[r], hA[r], explosions[r].normal, EX.getChildAt(0), true);
r++;
};
};
if (r_id == 0){
drawingBuls = false;
Adjuster.addChildAt(BaseGraphicsMain, 1);
Mask = new Shape();
Adjuster.addChildAt(Mask, 2);
Mask.graphics.beginFill(0xFF0000);
Mask.graphics.drawRect(0, 0, 45, 45);
Mask.graphics.endFill();
BaseGraphicsMain.mask = Mask;
BaseGraphicsMain.gotoAndStop(0);
BaseGraphicsMain.scaleX = (BaseGraphicsMain.scaleY = 0.85);
BaseGraphicsMain.x = -2;
BaseGraphicsMain.y = -19;
renderGo(Adjuster, 45, 45, copyBase, BaseGraphicsMain);
};
}
}
}//package
Section 209
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
public function ScrollArrowDown_disabledSkin(){
super();
}
}
}//package
Section 210
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
public function ScrollArrowDown_downSkin(){
super();
}
}
}//package
Section 211
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
public function ScrollArrowDown_overSkin(){
super();
}
}
}//package
Section 212
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
public function ScrollArrowDown_upSkin(){
super();
}
}
}//package
Section 213
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
public function ScrollArrowUp_disabledSkin(){
super();
}
}
}//package
Section 214
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
public function ScrollArrowUp_downSkin(){
super();
}
}
}//package
Section 215
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
public function ScrollArrowUp_overSkin(){
super();
}
}
}//package
Section 216
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
public function ScrollArrowUp_upSkin(){
super();
}
}
}//package
Section 217
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
public function ScrollBar_thumbIcon(){
super();
}
}
}//package
Section 218
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
public function ScrollThumb_downSkin(){
super();
}
}
}//package
Section 219
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
public function ScrollThumb_overSkin(){
super();
}
}
}//package
Section 220
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
public function ScrollThumb_upSkin(){
super();
}
}
}//package
Section 221
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
public function ScrollTrack_skin(){
super();
}
}
}//package
Section 222
//sfx_death1 (sfx_death1)
package {
import flash.media.*;
public dynamic class sfx_death1 extends Sound {
public function sfx_death1(){
super();
}
}
}//package
Section 223
//sfx_death2 (sfx_death2)
package {
import flash.media.*;
public dynamic class sfx_death2 extends Sound {
public function sfx_death2(){
super();
}
}
}//package
Section 224
//sfx_death3 (sfx_death3)
package {
import flash.media.*;
public dynamic class sfx_death3 extends Sound {
public function sfx_death3(){
super();
}
}
}//package
Section 225
//sfx_death4 (sfx_death4)
package {
import flash.media.*;
public dynamic class sfx_death4 extends Sound {
public function sfx_death4(){
super();
}
}
}//package
Section 226
//sfx_death5 (sfx_death5)
package {
import flash.media.*;
public dynamic class sfx_death5 extends Sound {
public function sfx_death5(){
super();
}
}
}//package
Section 227
//sfx_death6 (sfx_death6)
package {
import flash.media.*;
public dynamic class sfx_death6 extends Sound {
public function sfx_death6(){
super();
}
}
}//package
Section 228
//sfx_death7 (sfx_death7)
package {
import flash.media.*;
public dynamic class sfx_death7 extends Sound {
public function sfx_death7(){
super();
}
}
}//package
Section 229
//sfx_ex1 (sfx_ex1)
package {
import flash.media.*;
public dynamic class sfx_ex1 extends Sound {
public function sfx_ex1(){
super();
}
}
}//package
Section 230
//sfx_ex2 (sfx_ex2)
package {
import flash.media.*;
public dynamic class sfx_ex2 extends Sound {
public function sfx_ex2(){
super();
}
}
}//package
Section 231
//sfx_ex3 (sfx_ex3)
package {
import flash.media.*;
public dynamic class sfx_ex3 extends Sound {
public function sfx_ex3(){
super();
}
}
}//package
Section 232
//sfx_ex4 (sfx_ex4)
package {
import flash.media.*;
public dynamic class sfx_ex4 extends Sound {
public function sfx_ex4(){
super();
}
}
}//package
Section 233
//sfx_ex5 (sfx_ex5)
package {
import flash.media.*;
public dynamic class sfx_ex5 extends Sound {
public function sfx_ex5(){
super();
}
}
}//package
Section 234
//sfx_inter1 (sfx_inter1)
package {
import flash.media.*;
public dynamic class sfx_inter1 extends Sound {
public function sfx_inter1(){
super();
}
}
}//package
Section 235
//sfx_inter2 (sfx_inter2)
package {
import flash.media.*;
public dynamic class sfx_inter2 extends Sound {
public function sfx_inter2(){
super();
}
}
}//package
Section 236
//sfx_inter3 (sfx_inter3)
package {
import flash.media.*;
public dynamic class sfx_inter3 extends Sound {
public function sfx_inter3(){
super();
}
}
}//package
Section 237
//sfx_shot1 (sfx_shot1)
package {
import flash.media.*;
public dynamic class sfx_shot1 extends Sound {
public function sfx_shot1(){
super();
}
}
}//package
Section 238
//sfx_shot10 (sfx_shot10)
package {
import flash.media.*;
public dynamic class sfx_shot10 extends Sound {
public function sfx_shot10(){
super();
}
}
}//package
Section 239
//sfx_shot11 (sfx_shot11)
package {
import flash.media.*;
public dynamic class sfx_shot11 extends Sound {
public function sfx_shot11(){
super();
}
}
}//package
Section 240
//sfx_shot12 (sfx_shot12)
package {
import flash.media.*;
public dynamic class sfx_shot12 extends Sound {
public function sfx_shot12(){
super();
}
}
}//package
Section 241
//sfx_shot2 (sfx_shot2)
package {
import flash.media.*;
public dynamic class sfx_shot2 extends Sound {
public function sfx_shot2(){
super();
}
}
}//package
Section 242
//sfx_shot3 (sfx_shot3)
package {
import flash.media.*;
public dynamic class sfx_shot3 extends Sound {
public function sfx_shot3(){
super();
}
}
}//package
Section 243
//sfx_shot4 (sfx_shot4)
package {
import flash.media.*;
public dynamic class sfx_shot4 extends Sound {
public function sfx_shot4(){
super();
}
}
}//package
Section 244
//sfx_shot5 (sfx_shot5)
package {
import flash.media.*;
public dynamic class sfx_shot5 extends Sound {
public function sfx_shot5(){
super();
}
}
}//package
Section 245
//sfx_shot6 (sfx_shot6)
package {
import flash.media.*;
public dynamic class sfx_shot6 extends Sound {
public function sfx_shot6(){
super();
}
}
}//package
Section 246
//sfx_shot7 (sfx_shot7)
package {
import flash.media.*;
public dynamic class sfx_shot7 extends Sound {
public function sfx_shot7(){
super();
}
}
}//package
Section 247
//sfx_shot8 (sfx_shot8)
package {
import flash.media.*;
public dynamic class sfx_shot8 extends Sound {
public function sfx_shot8(){
super();
}
}
}//package
Section 248
//sfx_shot9 (sfx_shot9)
package {
import flash.media.*;
public dynamic class sfx_shot9 extends Sound {
public function sfx_shot9(){
super();
}
}
}//package
Section 249
//Slow1 (Slow1)
package {
import flash.media.*;
public dynamic class Slow1 extends Sound {
public function Slow1(){
super();
}
}
}//package
Section 250
//Slow2 (Slow2)
package {
import flash.media.*;
public dynamic class Slow2 extends Sound {
public function Slow2(){
super();
}
}
}//package
Section 251
//soundKon (soundKon)
package {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class soundKon {
private static var T:Timer = new Timer(10);
private static var RightMixer:SoundTransform = new SoundTransform();
private static var sChanL:SoundChannel = new SoundChannel();
private static var LeftMixer:SoundTransform = new SoundTransform();
private static var sChanR:SoundChannel = new SoundChannel();
private static var playCheck:Array = new Array();
public static var soundOn:Boolean = true;
private static var sfxArray:Array = new Array();
public function soundKon(){
super();
}
private static function clearPlayed(te:TimerEvent):void{
var i:*;
var j:*;
for (i in sfxArray) {
for (j in sfxArray[i]) {
sfxArray[i][j].played = false;
};
};
}
public static function playSound(pool:uint=0, sound:uint=0, chan:Boolean=false):void{
if (soundOn){
if (sound != 0){
if (!sfxArray[pool][sound].played){
if (chan){
sChanR = sfxArray[pool][sound].s.play();
} else {
sChanL = sfxArray[pool][sound].s.play();
};
if (((!((pool == 3))) && (!((sound == 3))))){
sfxArray[pool][sound].played = true;
};
};
};
};
}
public static function init():void{
T.start();
T.addEventListener(TimerEvent.TIMER, clearPlayed);
sfxArray[0] = new Array();
sfxArray[0].push({played:false, s:null});
sfxArray[0].push({played:false, s:new sfx_shot1()});
sfxArray[0].push({played:false, s:new sfx_shot2()});
sfxArray[0].push({played:false, s:new sfx_shot3()});
sfxArray[0].push({played:false, s:new sfx_shot4()});
sfxArray[0].push({played:false, s:new sfx_shot5()});
sfxArray[0].push({played:false, s:new sfx_shot6()});
sfxArray[0].push({played:false, s:new sfx_shot7()});
sfxArray[0].push({played:false, s:new sfx_shot8()});
sfxArray[0].push({played:false, s:new sfx_shot9()});
sfxArray[0].push({played:false, s:new sfx_shot10()});
sfxArray[0].push({played:false, s:new sfx_shot11()});
sfxArray[0].push({played:false, s:new sfx_shot12()});
sfxArray[1] = new Array();
sfxArray[1].push({played:false, s:null});
sfxArray[1].push({played:false, s:new sfx_death1()});
sfxArray[1].push({played:false, s:new sfx_death2()});
sfxArray[1].push({played:false, s:new sfx_death3()});
sfxArray[1].push({played:false, s:new sfx_death4()});
sfxArray[1].push({played:false, s:new sfx_death5()});
sfxArray[1].push({played:false, s:new sfx_death6()});
sfxArray[1].push({played:false, s:new sfx_death7()});
sfxArray[2] = new Array();
sfxArray[2].push({played:false, s:null});
sfxArray[2].push({played:false, s:new sfx_ex1()});
sfxArray[2].push({played:false, s:new sfx_ex2()});
sfxArray[2].push({played:false, s:new sfx_ex3()});
sfxArray[2].push({played:false, s:new sfx_ex4()});
sfxArray[2].push({played:false, s:new sfx_ex5()});
sfxArray[3] = new Array();
sfxArray[3].push({played:false, s:null});
sfxArray[3].push({played:false, s:new sfx_inter1()});
sfxArray[3].push({played:false, s:new sfx_inter2()});
sfxArray[3].push({played:false, s:new sfx_inter3()});
}
public static function surround(a:Number):void{
var leftPan:Number;
var rightPan:Number;
var leftVol:Number;
var rightVol:Number;
leftPan = (((a * -1) * 0.35) - 0.35);
rightPan = ((a * -0.35) + 0.35);
if (a < -1){
a = -1;
};
if (a > 1){
a = 1;
};
if (a > 0){
leftVol = (1 - (a * 0.5));
} else {
leftVol = 1;
};
if (a < 0){
rightVol = (1 + (a * 0.5));
} else {
rightVol = 1;
};
RightMixer.volume = rightVol;
LeftMixer.volume = leftVol;
RightMixer.pan = rightPan;
LeftMixer.pan = leftPan;
sChanL.soundTransform = LeftMixer;
sChanR.soundTransform = RightMixer;
}
}
}//package
Section 252
//Team (Team)
package {
public class Team {
public var rallyPoint:Number;
public var air:Array;
public var ground:Array;
public var all:Array;
public var baseStartX:Number;
public var midPoint:Number;
public var baseStartY:Number;
public var gainFactor:Number;// = 0
public var startX:Number;
public var startY:Number;
public var baseAlive:Boolean;
public function Team():void{
gainFactor = 0;
super();
baseAlive = true;
ground = new Array();
air = new Array();
all = new Array();
}
public function setGain():void{
var copyArray:Array;
var scan_b:*;
var controlPercent:Number;
copyArray = new Array();
for (scan_b in all) {
copyArray.push({xPOS:all[scan_b].x});
};
if (this == unitKon.Team2){
copyArray.sortOn("xPOS", Array.NUMERIC);
controlPercent = (100 * ((startX - copyArray[0].xPOS) / 800));
} else {
copyArray.sortOn("xPOS", (Array.DESCENDING | Array.NUMERIC));
controlPercent = (100 * ((copyArray[0].xPOS - startX) / 800));
};
gainFactor = 0;
if (controlPercent > 0){
gainFactor = 1;
};
if (controlPercent > 25){
gainFactor = 2;
};
if (controlPercent > 50){
gainFactor = 3;
};
}
}
}//package
Section 253
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
public function TextInput_disabledSkin(){
super();
}
}
}//package
Section 254
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
public function TextInput_upSkin(){
super();
}
}
}//package
Section 255
//tipObject (tipObject)
package {
public class tipObject {
public var tipCostM:uint;
public var tipName:String;
public var tipCostP:uint;
public var tipDesc:String;
public var tipCostI:uint;
public var tipCostE:uint;
public function tipObject(b:String, c:uint, d:uint, e:uint, f:String, g:uint=0):void{
super();
tipName = b;
tipCostM = c;
tipCostP = d;
tipCostE = e;
tipDesc = f;
tipCostI = g;
}
}
}//package
Section 256
//toolTip (toolTip)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class toolTip extends Sprite {
private static var tf2:TextFormat = new TextFormat();
private static var theRoot:Object;
private static var t_desc:TextField = new TextField();
private static var CostTip2:costTip2 = new costTip2();
private static var osNum:Number = new Number();
private static var tip_g;
private static var killTime:uint = 0;
private static var theStage:Stage;
private static var FONT:MainFont = new MainFont();
private static var tip_t;
private static var t_cost_e:TextField = new TextField();
private static var t_cost_m:TextField = new TextField();
private static var t_cost_p:TextField = new TextField();
private static var CostTip:costTip = new costTip();
private static var tf:TextFormat = new TextFormat();
private static var t_name:TextField = new TextField();
public static var errorTip:Boolean;
private static var tipState:Boolean = false;
public function toolTip(s:Stage, r:Object, offSetX:Number=15, offSetSize:Number=150):void{
super();
errorTip = false;
theStage = s;
theRoot = r;
gameKon.displayArray.push(this);
tf.font = FONT.fontName;
tf.size = 14;
tf.color = 0xFFFFFF;
tf2.font = FONT.fontName;
tf2.size = 14;
tf2.color = 3354667;
addChild(t_name);
addChild(t_desc);
addChild(CostTip);
addChild(CostTip2);
CostTip.visible = false;
CostTip.x = offSetX;
CostTip2.visible = false;
CostTip2.x = offSetX;
t_name.text = "Name Plate";
t_name.border = true;
t_name.borderColor = 0x111111;
t_name.background = true;
t_name.backgroundColor = 0x1A1A1A;
t_name.selectable = false;
t_name.width = offSetSize;
t_name.x = offSetX;
t_name.y = -20;
t_name.embedFonts = true;
t_name.autoSize = TextFieldAutoSize.LEFT;
t_name.multiline = true;
t_name.wordWrap = true;
t_name.setTextFormat(tf);
t_desc.text = "Text Plate";
t_desc.border = true;
t_desc.borderColor = 0x111111;
t_desc.background = true;
t_desc.backgroundColor = 13223358;
t_desc.selectable = false;
t_desc.width = offSetSize;
t_desc.x = offSetX;
t_desc.embedFonts = true;
t_desc.autoSize = TextFieldAutoSize.LEFT;
t_desc.multiline = true;
t_desc.wordWrap = true;
t_desc.setTextFormat(tf2);
t_name.visible = false;
t_desc.visible = false;
}
public function killEvents():void{
theStage.removeEventListener(Event.ENTER_FRAME, cd_killTip);
}
public static function unTip():void{
errorTip = false;
tipState = true;
t_name.visible = false;
t_desc.visible = false;
CostTip.visible = false;
CostTip2.visible = false;
theStage.removeEventListener(Event.ENTER_FRAME, correctTip);
}
public static function setOffset():void{
if ((theStage.mouseY + osNum) > 570){
theRoot.ToolTip.y = (570 - osNum);
};
}
private static function correctTip(event:Event){
setOffset();
}
public static function tip(t:Object, g:uint):void{
tip_t = t;
tip_g = g;
tipState = true;
theStage.addEventListener(Event.ENTER_FRAME, correctTip, false, 0, true);
if (g == 1){
t_name.text = t.tipName;
t_name.setTextFormat(tf);
t_desc.text = "This is currently in production.";
t_desc.setTextFormat(tf2);
t_name.visible = true;
t_desc.visible = true;
osNum = (t_name.height + t_desc.height);
setOffset();
t_desc.y = (t_name.y + t_name.height);
} else {
if (t.tipName == null){
t_desc.text = t.tipDesc;
t_desc.setTextFormat(tf2);
t_desc.visible = true;
osNum = t_desc.height;
setOffset();
t_desc.y = t_name.y;
} else {
t_name.text = t.tipName;
t_name.setTextFormat(tf);
t_desc.text = t.tipDesc;
t_desc.setTextFormat(tf2);
t_name.visible = true;
t_desc.visible = true;
osNum = (t_name.height + t_desc.height);
setOffset();
t_desc.y = (t_name.y + t_name.height);
if ((((t.tipCostM + t.tipCostP) + t.tipCostE) + t.tipCostI) > 0){
if (t.tipCostI > 0){
CostTip2.visible = true;
CostTip2.c_i.text = t.tipCostI;
osNum = ((t_name.height + CostTip2.height) + t_desc.height);
} else {
CostTip.visible = true;
CostTip.c_m.text = t.tipCostM;
CostTip.c_p.text = t.tipCostP;
CostTip.c_e.text = t.tipCostE;
osNum = ((t_name.height + CostTip.height) + t_desc.height);
};
setOffset();
CostTip.y = (t_name.y + t_name.height);
CostTip2.y = (t_name.y + t_name.height);
t_desc.y = ((t_name.y + t_name.height) + CostTip.height);
};
};
};
}
public static function giveError(msg1:String, msg2:String):void{
if (t_name.visible){
errorTip = true;
t_name.text = msg1;
t_name.setTextFormat(tf);
CostTip.visible = false;
CostTip2.visible = false;
t_name.visible = true;
t_desc.y = (t_name.y + t_name.height);
t_desc.text = msg2;
t_desc.setTextFormat(tf2);
osNum = (t_desc.height + t_name.height);
theStage.addEventListener(Event.ENTER_FRAME, cd_killTip);
killTime = 0;
setOffset();
};
}
private static function cd_killTip(event:Event):void{
killTime++;
if (killTime == 75){
errorTip = false;
theStage.removeEventListener(Event.ENTER_FRAME, cd_killTip);
if (t_desc.visible){
tip(tip_t, tip_g);
};
};
}
}
}//package
Section 257
//Tracer (Tracer)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public dynamic class Tracer extends MovieClip {
public var tr:TextField;
public var traBut:SimpleButton;
public function Tracer(){
super();
addFrameScript(0, frame1);
}
public function hideTra(e:MouseEvent):void{
if (!dataTracer.progressing){
dataTracer.hideTracer();
dataTracer.theStage.dispatchEvent(new chatEvent("CLOSETRACER"));
};
}
function frame1(){
traBut.addEventListener(MouseEvent.CLICK, hideTra, false, 0, true);
}
}
}//package
Section 258
//trailBody (trailBody)
package {
import flash.events.*;
public class trailBody extends displayBody {
private var decayTimeMax:uint;
private var decayTime:uint;
public static var decay:Array = new Array(null, 25, 40, 20, 20, 17, 40, 7, 32, 7, 7, 7);
public static var intensity:Array = new Array(null, 7, 3, 2, 4, 4, 3, 1, 2, 1, 1, 1);
public static var hl:Array = new Array(null, 0.3, 0.4, 0.5, 0.5, 0.6, 0.4, 0.4, 0.4, 0.3, 0.4, 0.4);
public static var yGap:Array = new Array(null, 4, 2, 5, 5, 8, 5, 2, 5, 3, 3, 3);
public static var xGap:Array = new Array(null, 4, 12, 5, 5, 8, 12, 2, 12, 3, 3, 3);
public function trailBody(id:uint, h:Number, d:Number):void{
var i:Boolean;
var dt:uint;
super();
createDisplay(renderMachine.trail[id], true, false);
addEventListener(Event.ENTER_FRAME, trailAction);
i = true;
dt = 0;
while (i) {
dt++;
if ((((Math.random() > h)) || ((dt > 10)))){
i = false;
};
};
decayTime = (decayTimeMax = Math.round((d * dt)));
}
public function terminateEvents():void{
end();
}
public function trailAction(event:Event){
decayTime--;
y = (y + 0.5);
alpha = (decayTime / decayTimeMax);
if (decayTime == 0){
removeEventListener(Event.ENTER_FRAME, trailAction);
unitKon.killTrail(this);
};
}
}
}//package
Section 259
//unitBody (unitBody)
package {
import flash.events.*;
import flash.filters.*;
public class unitBody extends displayBody {
public var kiteNow:Boolean;// = false
public var aiOverride:Boolean;// = false
public var behave:uint;// = 0
public var normalDir:Number;// = 1
private var getClose:Number;
public var minX:Number;
public var aiPoint:Number;// = 0
public var eteam:Team;
private var speedArray:Array;
public var speed:Number;// = 5
public var unitValue:Number;
public var team:Team;
public var maxLife:Number;// = 100
private var a_wep:weapon;
public var assocBase:baseBuilding;// = null
public var aiKite:Boolean;// = false
private var healer:Boolean;// = false
public var INFO:Object;
public var mainTarget:unitBody;
public var exDie:uint;
public var player:playerKon;
private var maxClose:Number;// = 40
public var life:Number;
private var colorMat:ColorMatrixFilter;
public var moveDir:Number;// = 1
public var ID:uint;
public var rallyMode:Boolean;// = false
private var deathSound:uint;
private var armor:uint;
private var aiOverrideCounter:uint;// = 0
public var belong:Array;
private var killTime:uint;
private var tarX:Number;// = 800
private var selfHeal:Number;// = 0
public var prefire:uint;
private var wep:weapon;
private var mat:Array;
public var aiPosition:Boolean;// = false
public var maxX:Number;
public var addResGo:Boolean;// = false
private var g_wep:weapon;
private var task:uint;
public var setFireX:Number;
public var setFireY:Number;
public var addResGoI:uint;// = 0
private var targetBy:Array;
public var unitId:String;
private var targetList:Array;
public var airUnit:Boolean;// = false
public static var armorCrossCheck:Array;
public function unitBody(id:uint, p:playerKon, rand:Number=-1):void{
airUnit = false;
maxLife = 100;
life = maxLife;
speed = 5;
healer = false;
selfHeal = 0;
aiOverride = false;
aiKite = false;
aiPosition = false;
rallyMode = false;
aiPoint = 0;
aiOverrideCounter = 0;
kiteNow = false;
addResGo = false;
addResGoI = 0;
normalDir = 1;
assocBase = null;
moveDir = 1;
behave = 0;
speedArray = [0, 0.5, 0.8, 1, 1.4, 1.6, 1.9];
maxClose = 40;
mat = [2.6, 0, 0, 0, 2.40000000000001, 0, 2.6, 0, 0, 2.40000000000001, 0, 0, 2.6, 0, 2.40000000000001, 0, 0, 0, 1, 0];
colorMat = new ColorMatrixFilter(mat);
tarX = 800;
super();
gameKon.displayArray.push(this);
INFO = unitData.LIST[id];
life = (maxLife = INFO.Life);
unitValue = INFO.Value;
armor = INFO.Armor;
airUnit = INFO.Air;
healer = INFO.Healer;
selfHeal = INFO.selfHeal;
setFireX = INFO.setX;
exDie = INFO.exDie;
setFireY = INFO.setY;
deathSound = INFO.deathSound;
ID = id;
if (rand == -1){
getClose = Math.random();
} else {
getClose = rand;
};
player = p;
createDisplay(renderMachine.units[player.cityColor][INFO.Graphic]);
killTime = renderMachine.units[player.cityColor][INFO.Graphic].killTime;
prefire = renderMachine.units[player.cityColor][INFO.Graphic].prefire;
if (INFO.Weapon_G != null){
g_wep = new weapon(this, INFO.Weapon_G);
} else {
g_wep = null;
};
if (INFO.Weapon_A != null){
a_wep = new weapon(this, INFO.Weapon_A);
} else {
a_wep = null;
};
addEventListener(Event.ENTER_FRAME, go);
addEventListener(MouseEvent.MOUSE_DOWN, displayStatsTrigger);
}
private function displayStatsTrigger(event:Event):void{
displayStats();
}
public function makeOption(id:uint):void{
var selU:Array;
var vars:*;
if (id != behave){
if (gameKon.theRoot.singlePlayerMode){
selU = new Array();
selU.push(unitId);
gameKon.doUnitOption(id, selU);
} else {
vars = new Object();
vars.id = id;
vars.orderArray = new Array();
vars.orderArray.push(unitId);
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "orderUnit");
};
};
}
public function fil():void{
filters = [colorMat];
}
public function killEvents():void{
unitKon.removeUnit(this);
}
public function getTarget():void{
var cteam:*;
var w:*;
var theUnit:*;
if (behave != 2){
targetList = new Array();
if (healer){
cteam = team;
} else {
cteam = eteam;
};
if (g_wep != null){
for (w in cteam.ground) {
if (((!((w == 0))) || (!(healer)))){
theUnit = cteam.ground[w];
if (theUnit != this){
if (((!(healer)) || ((theUnit.life < theUnit.maxLife)))){
targetList.push({u:theUnit, r:getRange(theUnit, g_wep), t:getTime(theUnit), theWep:g_wep});
};
};
};
};
};
if (a_wep != null){
for (w in cteam.air) {
theUnit = cteam.air[w];
if (theUnit != this){
if (((!(healer)) || ((theUnit.life < theUnit.maxLife)))){
targetList.push({u:theUnit, r:getRange(theUnit, a_wep), t:getTime(theUnit), theWep:a_wep});
};
};
};
};
if (healer){
targetList.sortOn(["r", "t"], [Array.NUMERIC, Array.NUMERIC]);
} else {
targetList.sortOn(["r", "t"], [Array.NUMERIC, Array.NUMERIC]);
};
if (targetList.length > 0){
disWeps();
mainTarget = targetList[0].u;
wep = targetList[0].theWep;
} else {
mainTarget = null;
disWeps();
};
targetList = null;
};
if (behave == 2){
if ((((eteam.all.length > 0)) && (!(healer)))){
mainTarget = eteam.all[0];
} else {
mainTarget = null;
disWeps();
};
};
}
public function unfil():void{
filters = [];
}
public function terminateEvents():void{
killEventsSoft();
end();
}
public function endUnitBegin():void{
if (x > 800){
soundKon.playSound(1, deathSound, true);
} else {
soundKon.playSound(1, deathSound, false);
};
killEventsSoft();
if (assocBase != null){
team.baseAlive = false;
assocBase.destroy();
};
if (killTime == 0){
unitKon.removeUnit(this);
} else {
modeChange(3);
addEventListener(Event.ENTER_FRAME, killThis);
};
}
private function go(event:Event):void{
if (((((aiPosition) && (!(kiteNow)))) && (!(aiOverride)))){
if ((((((x < (aiPoint - 25))) && ((normalDir == 1)))) || ((((x > (aiPoint + 25))) && ((normalDir == -1)))))){
makeOption(0);
} else {
if ((((((x > (aiPoint + 25))) && ((normalDir == 1)))) || ((((x < (aiPoint - 25))) && ((normalDir == -1)))))){
makeOption(3);
} else {
makeOption(1);
if (rallyMode){
rallyMode = false;
aiPosition = false;
};
};
};
} else {
if (aiOverride){
makeOption(0);
aiOverrideCounter--;
if (aiOverrideCounter == 0){
aiOverride = false;
};
};
};
if (life > 0){
getTarget();
if (selfHeal > 0){
life = (life + selfHeal);
};
if (life > maxLife){
life = maxLife;
};
if (behave == 3){
if (wep != null){
wep.disengage();
};
if ((((((x > minX)) && ((normalDir == 1)))) || ((((x < minX)) && ((normalDir == -1)))))){
moveDir = -(normalDir);
moveUnit();
};
} else {
if (mainTarget != null){
if (checkRange()){
wep.engage(healer);
scaleX = moveDir;
if (behave != 1){
if (checkRange((getClose * maxClose)) == false){
moveUnit();
};
};
} else {
if (behave != 1){
moveUnit();
};
};
} else {
if (behave != 1){
if ((((((x < maxX)) && ((normalDir == 1)))) || ((((x > maxX)) && ((normalDir == -1)))))){
moveDir = normalDir;
moveUnit();
};
};
};
};
};
}
private function moveUnit():void{
x = (x + (moveDir * speedArray[INFO.Speed]));
scaleX = moveDir;
modeChange(1);
}
private function killEventsSoft():void{
removeEventListener(Event.ENTER_FRAME, go);
removeEventListener(MouseEvent.MOUSE_DOWN, displayStatsTrigger);
removeEventListener(MouseEvent.MOUSE_OVER, fil);
removeEventListener(MouseEvent.MOUSE_OUT, unfil);
if (wep != null){
wep.disengage();
wep = null;
};
if (a_wep != null){
a_wep.disengage();
a_wep = null;
};
if (g_wep != null){
g_wep.disengage();
g_wep = null;
};
}
private function disWeps():void{
if (wep != null){
wep.disengage();
};
if (g_wep != null){
g_wep.disengage();
};
if (a_wep != null){
a_wep.disengage();
};
}
public function displayStats():void{
displayKon.updateUnit([this]);
}
private function checkRange(getC:Number=0){
if (mainTarget.x >= x){
moveDir = 1;
} else {
moveDir = -1;
};
if (getRange(mainTarget, wep, getC) == 0){
return (true);
};
disWeps();
return (false);
}
public function killThis(event:Event):void{
killTime = (killTime - 1);
if (killTime == 0){
if (exDie > 0){
unitKon.addEx(exDie, x, y);
if (addResGo){
unitKon.addEx(addResGoI, x, y, false);
};
};
unitKon.removeUnit(this);
removeEventListener(Event.ENTER_FRAME, killThis);
};
}
private function getTime(m:unitBody){
if (!healer){
return (Math.round((Math.random() * 10)));
};
return ((m.life / m.maxLife));
}
private function getRange(m:unitBody, n:weapon, getC:Number=0, retVal:Boolean=false){
var theHyp:Number;
var theDist:Number;
theHyp = Math.sqrt((Math.pow((m.x - x), 2) + Math.pow((m.y - y), 2)));
theDist = ((theHyp - n.weaponRange) + getC);
if ((((m.ID == 0)) || ((ID == 0)))){
theDist = (theDist - 100);
};
if (((m.airUnit) || (airUnit))){
theDist = (theDist - 50);
};
if (retVal){
trace(("DIST " + Math.round(((Math.floor(theDist) + 20) / speedArray[INFO.Speed]))));
return (Math.round((Math.floor(theDist) + (20 / speedArray[INFO.Speed]))));
};
if (theDist < 0){
theDist = 0;
};
return (theDist);
}
public function takeHit(dam:Number, wepType:uint, shooter:unitBody=null, p:playerKon=null):void{
var realDam:*;
var vars:Object;
if (this != null){
realDam = Math.round((armorCrossCheck[armor][wepType] * dam));
if (life > 0){
if (aiPosition){
if (shooter != null){
if (((((shooter.airUnit) && (!((a_wep == null))))) || (((!(shooter.airUnit)) && (!((g_wep == null))))))){
aiOverrideCounter = 90;
aiOverride = true;
};
};
};
life = (life - realDam);
if (life > maxLife){
life = maxLife;
};
if (life <= 0){
life = 0;
if (gameKon.theRoot.singlePlayerMode){
unitKon.killOffUnit(unitId, p, Math.round((Math.random() * 3)));
} else {
vars = new Object();
vars.id = unitId;
vars.ran = Math.round((Math.random() * 3));
if (p != null){
vars.p = p.POS;
} else {
vars.p = 0;
};
gameKon.theRoot.gameRoom.sendToRoom(vars, true, "killUnit");
};
};
};
};
}
}
}//package
Section 260
//unitData (unitData)
package {
public class unitData {
private var unit:Array;
private var iN:Number;// = -1
public static var LIST:Array = new Array();
public function unitData():void{
iN = -1;
unit = new Array();
super();
make("Central Base", false, 5000, 0, 0, 3, 1, 15, false, 0, "This is the headquarters. Equipped with powerful defensive weapons.", 0, 0, 3);
make("Marine", false, 62, 3, 1, 0, 0, 16, false, 0, "Light armor. Armed with shock rifles and rockets, effective against both ground and air.", 25, 16.4);
unit.Value = 1;
unit.deathSound = 3;
make("Chronite Tank", false, 310, 1, 2, 2, 3, null, false, 0, "Chronite (heavy) armor. Armed with explosive shells, but cannot fire at air targets,", 100, 10, 3);
unit.Value = 5;
unit.deathSound = 4;
make("Scout", true, 140, 5, 11, 1, 11, 11, false, 0, "Titanium armor. Armed with pulse lasers. ", 57, 44, 3);
unit.Value = 3;
unit.deathSound = 6;
make("A25-Roman", false, 220, 4, 4, 1, 13, null, false, 0, "Titanium armor. Armed with pulse rifles, but cannot fire at air targets.", 22, 16);
unit.Value = 2;
unit.deathSound = 5;
make("Meditec", false, 100, 3, 12, 0, 12, null, true, 0, "Light armor. Can heal/repair any friendly ground unit.", 22, 16);
unit.Value = 2;
unit.deathSound = 3;
make("Gröditz", false, 280, 2, 7, 2, 5, 5, false, 0, "Chronite (heavy) armor. Armed with standard machine guns.", 47, 32, 3);
unit.Value = 7;
unit.deathSound = 4;
make("Phantom", true, 320, 4, 3, 1, 8, null, false, 0, "Titanium armor. Armed with area-damage rapid cannons.", 61, 43.3, 3);
unit.Value = 7;
unit.deathSound = 4;
make("Sakata Spider", false, 200, 4, 8, 2, 6, null, false, 0.52, "Chronite (heavy) armor. Armed with singular voltage beams. Self repairing technology.", 54, 5, 3);
unit.Value = 10;
unit.deathSound = 4;
make("Sakata Mk-II", false, 200, 4, 9, 4, null, 7, false, 0.3, "Chronite (heavy) armor. Armed with anti-air Hadron cannons. Cannot attack ground targets.", 64, 5, 3);
unit.Value = 7;
unit.deathSound = 4;
make("Hover Tank", false, 370, 3, 6, 4, 4, null, false, 0, "Special armor, resistant against missile damage. Armed with high impact, linear Positron cannons.", 102, 10, 3);
unit.Value = 10;
unit.deathSound = 4;
make("Black Queen", true, 550, 4, 10, 4, 9, 10, false, 0, "Special armor, resistant against missile damage. Armed with anti-air missiles, and long ranged bombs.", 46, 37, 3);
unit.Value = 15;
unit.deathSound = 1;
make("Sniper", false, 154, 4, 5, 0, 2, 14, false, 0, "Light armor. Equipped with armor-piercing Positron rifles. Not as effective against air targets.", 38, 9.3);
unit.Value = 3;
unit.deathSound = 3;
make("A28-Gladiator", false, 600, 6, 13, 4, 17, 18, false, 0, "Special armor, resistant against missile damage. Armed with a high frequency pulse rifle. Not as effective against air targets.", 22, 16);
unit.Value = 15;
unit.deathSound = 2;
make("Modified Sakata", false, 300, 6, 14, 2, 19, null, false, 2, "Modified to be faster in movement, firing, and repairing.", 54, 5, 3);
unit.Value = 12;
unit.deathSound = 4;
make("Modified Phantom", true, 400, 5, 15, 1, 20, null, false, 0, "Modified to have stronger weapons and more durable armor.", 61, 43.3, 3);
unit.Value = 12;
make("Special Forces", false, 230, 5, 1, 0, 21, 22, false, 0.3, "Specially trained to live longer, and do more damage.", 25, 16.4);
unit.Value = 6;
unit.deathSound = 3;
}
private function make(a:String, b:Boolean, c:uint, d:uint, e:uint, f:uint, g, h, i:Boolean, j:Number, k:String, l:Number=0, m:Number=0, o:uint=0):void{
iN++;
LIST[iN] = new Array();
unit = LIST[iN];
unit.Name = a;
unit.Air = b;
unit.Life = c;
unit.Speed = d;
unit.Graphic = e;
unit.Armor = f;
unit.Weapon_G = g;
unit.Weapon_A = h;
unit.Healer = i;
unit.selfHeal = j;
unit.Desc = k;
unit.setX = l;
unit.setY = m;
unit.exDie = o;
unit.deathSound = 0;
unit.Value = o;
}
}
}//package
Section 261
//unitKon (unitKon)
package {
public class unitKon {
public static var grid;
public static var Team1:Team;
public static var Team2:Team;
private static var trailCount:uint;
public static var grid2;
public static var theTeam:Team;
public static var masterUnitArray:Array;
private static var displayArray:Array = new Array();
public function unitKon(){
super();
}
public static function killMissile(bul:wep_missile){
bul.terminateEvents();
if (grid2.contains(bul)){
grid2.removeChild(bul);
};
bul = null;
}
public static function addBullet(b:wep_projectile, z:unitBody):void{
grid2.addChild(b);
b.x = (z.x + (z.moveDir * (z.setFireX - (z.width / 2))));
b.y = ((z.y + z.setFireY) - (z.height / 2));
b.init(z);
}
private static function sortDisplay(u:unitBody){
var retter:uint;
var h:*;
if (displayArray.length == 0){
displayArray.push({unit:u, posY:(u.y + (u.height / 2))});
return (0);
};
displayArray.sortOn("posY", (Array.DESCENDING | Array.NUMERIC));
retter = 0;
for (h in displayArray) {
if ((displayArray[h].posY <= u.y)){
retter = (retter + 1);
displayArray.push({unit:u, posY:u.y});
retter = (displayArray.length - (1 + h));
return (retter);
};
};
displayArray.push({unit:u, posY:u.y});
return (-1);
}
public static function addMissile(t:String, zx:Number, zy:Number):void{
var u:unitBody;
var scan_i:*;
var b:wep_missile;
u = null;
for (scan_i in masterUnitArray) {
if (masterUnitArray[scan_i].unitId == t){
u = masterUnitArray[scan_i];
};
};
if (u != null){
b = new wep_missile(8, u, 388, 20, 3, 105, 3);
grid2.addChild(b);
b.x = zx;
b.y = zy;
b.init();
};
}
public static function killBullet(bul:wep_projectile){
bul.terminateEvents();
if (grid2.contains(bul)){
grid2.removeChild(bul);
};
bul = null;
}
public static function killTrail(bul:trailBody){
bul.terminateEvents();
if (grid2.contains(bul)){
grid2.removeChild(bul);
trailCount--;
};
bul = null;
}
public static function resetAll(p1:playerKon, p3:playerKon):void{
displayArray = new Array();
Team1 = new Team();
Team2 = new Team();
masterUnitArray = new Array();
trailCount = 0;
unitBody.armorCrossCheck = new Array();
unitBody.armorCrossCheck[0] = new Array(1.25, 1, 1.1, 2);
unitBody.armorCrossCheck[1] = new Array(1, 0.75, 0.75, 2);
unitBody.armorCrossCheck[2] = new Array(0.25, 0.5, 1, 2);
unitBody.armorCrossCheck[3] = new Array(0.9, 0.7, 0.6, 0.7);
unitBody.armorCrossCheck[4] = new Array(0.25, 0.75, 0.75, 0.2);
Team1.startY = (Team2.startY = 140);
Team1.startX = 400;
Team2.startX = (1600 - Team1.startX);
Team1.baseStartX = 199;
Team2.baseStartX = (1600 - Team1.baseStartX);
Team1.baseStartY = (Team2.baseStartY = 130);
Team1.rallyPoint = 480;
Team2.rallyPoint = (1600 - Team1.rallyPoint);
Team1.midPoint = (Team2.midPoint = 800);
grid = gameKon.theRoot.unitDisplay;
grid2 = gameKon.theRoot.effectsDisplay;
}
public static function addUnit(p:playerKon, id:uint, isBase:Boolean=false, uID:String=null, rand1:Number=0, rand2:Number=0, rand3:Number=0):void{
var u:unitBody;
var getD:*;
theTeam = p.team;
if (gameKon.theRoot.singlePlayerMode){
rand1 = Math.random();
rand2 = Math.random();
rand3 = Math.random();
};
u = new unitBody(id, p, rand3);
if (gameKon.theRoot.singlePlayerMode){
u.unitId = getNewId(p);
} else {
u.unitId = uID;
};
masterUnitArray.push(u);
u.team = theTeam;
if (u.team == Team1){
u.eteam = Team2;
} else {
u.eteam = Team1;
};
theTeam.all.push(u);
if (u.airUnit){
theTeam.air.push(u);
u.belong = theTeam.air;
} else {
theTeam.ground.push(u);
u.belong = theTeam.ground;
};
if (isBase){
u.x = u.team.baseStartX;
u.y = u.team.baseStartY;
u.visible = false;
} else {
u.maxX = u.eteam.startX;
u.x = (u.minX = ((u.team.startX - 10) + Math.round((rand1 * 20))));
if (u.minX > u.maxX){
u.normalDir = (u.moveDir = (u.scaleX = -1));
};
if (u.airUnit){
u.y = ((u.team.startY - 220) + Math.round((rand2 * 40)));
} else {
u.y = ((u.team.startY - 25) + Math.round((rand2 * 75)));
};
};
if (((gameKon.rallyOn) && (p)) == gameKon.playerNow){
u.rallyMode = true;
u.aiPosition = true;
u.aiPoint = (u.team.rallyPoint + (30 - (Math.random() * 60)));
};
if (p.aiOn){
if (p.AI.AiStrategy.grouping){
p.AI.AiStrategy.aiGroup.push(u);
u.aiPosition = true;
u.aiPoint = (u.team.rallyPoint + (30 - (Math.random() * 60)));
};
if ((u.ID == 9)){
u.aiPosition = true;
u.aiPoint = (u.team.midPoint - (u.normalDir * (Math.random() * 60)));
};
if ((((((u.ID == 4)) || ((u.ID == 1)))) || ((u.ID == 5)))){
if (Math.random() < 0.15){
u.aiPosition = true;
u.aiPoint = (u.team.midPoint - (u.normalDir * (100 + (Math.random() * 200))));
};
};
};
getD = sortDisplay(u);
if (getD == -1){
grid.addChild(u);
} else {
grid.addChildAt(u, getD);
};
}
public static function killOffUnit(uID:String, theKiller:playerKon=null, randNummer:uint=0):void{
var scan_i:*;
var h:*;
var del:*;
var u:*;
var useVal:Number;
var randAdd:Number;
var playerExGo:uint;
chatBody.sendEv("UNIT_DIED");
for (scan_i in masterUnitArray) {
if (masterUnitArray[scan_i].unitId == uID){
u = masterUnitArray[scan_i];
masterUnitArray.splice(scan_i, 1);
};
};
u.endUnitBegin();
if (theKiller != null){
trace(("Killed by " + theKiller.POS));
if (theKiller.race == 1){
trace("PASS1");
if (u.unitValue < 1){
useVal = 1;
} else {
useVal = u.unitValue;
};
if (useVal > 0){
randAdd = randNummer;
trace("PASS2");
switch (randAdd){
case 0:
theKiller.addRes(0, useVal);
playerExGo = 0;
break;
case 1:
theKiller.addRes(0, useVal);
playerExGo = 0;
break;
case 2:
theKiller.addRes(3, useVal);
playerExGo = 3;
break;
case 3:
theKiller.addRes(3, useVal);
playerExGo = 3;
break;
};
if (theKiller.getData(3) > 100){
theKiller.setRes(3, 100);
};
gameKon.theRoot.upUIHand();
if (theKiller.team == gameKon.playerNow.team){
if (theKiller == gameKon.playerNow){
if (u.exDie > 0){
u.addResGo = true;
u.addResGoI = (11 + playerExGo);
} else {
addEx((11 + playerExGo), u.x, u.y, false);
};
};
};
};
};
};
for (h in displayArray) {
if (displayArray[h].unit == u){
displayArray.splice(h, 1);
};
};
if (gameKon.selectedUnit != null){
if ((((gameKon.selectedUnit.length == 1)) && ((gameKon.selectedUnit[0] == u)))){
if (gameKon.selectedBuilding == null){
displayKon.clearAllOptions();
};
};
};
for (del in u.belong) {
if (u.belong[del] == u){
u.belong.splice(del, 1);
};
};
for (del in u.team.all) {
if (u.team.all[del] == u){
u.team.all.splice(del, 1);
};
};
if (u.team.all.length == 0){
gameKon.theRoot.teamWin = u.eteam;
if (gameKon.playerNow.team == gameKon.theRoot.teamWin){
gameKon.theRoot.iWon = true;
};
gameKon.theRoot.endTheGame();
};
}
public static function getNewId(p:playerKon):String{
p.idCounter = (p.idCounter + 1);
return ((p.idTag + p.idCounter));
}
public static function createBase(p1, p3):void{
addUnit(p1, 0, true, getNewId(p1));
addUnit(p3, 0, true, getNewId(p3));
gameKon.buildingArray[4].unitLink = Team1.all[0];
gameKon.buildingArray[13].unitLink = Team2.all[0];
Team1.all[0].behave = 1;
Team2.all[0].behave = 1;
Team1.all[0].assocBase = gameKon.buildingArray[4];
Team2.all[0].assocBase = gameKon.buildingArray[13];
}
public static function removeUnit(u:unitBody):void{
u.terminateEvents();
if (grid.contains(u)){
grid.removeChild(u);
};
u = null;
}
public static function killEx(bul:exBody){
if (grid2.contains(bul)){
grid2.removeChild(bul);
};
bul = null;
}
public static function addTrail(t:uint, tx:Number, ty:Number):void{
var i:uint;
var tr:trailBody;
i = trailBody.intensity[t];
while (i > 0) {
if (trailCount < 120){
tr = new trailBody(t, trailBody.hl[t], trailBody.decay[t]);
grid2.addChild(tr);
tr.x = ((tx - (trailBody.xGap[t] / 2)) + (Math.random() * trailBody.xGap[t]));
tr.y = ((ty - (trailBody.yGap[t] / 2)) + (Math.random() * trailBody.yGap[t]));
trailCount++;
};
i--;
};
}
public static function addEx(id:uint, ax:Number, ay:Number, fi:Boolean=true):void{
var e:exBody;
e = new exBody(id, fi);
grid2.addChild(e);
e.x = ax;
e.y = ay;
}
}
}//package
Section 262
//weapon (weapon)
package {
import flash.display.*;
import flash.events.*;
public class weapon extends Sprite {
public var reloadTime:Number;
public var weaponGraphic:uint;
private var weaponExSFX:uint;
public var kitingTime:uint;// = 0
public var kiting:Boolean;// = false
private var ownUnit:unitBody;
private var weaponTrail:Number;
private var weaponShotSFX:uint;
public var weaponExplosion:Object;
private var t:unitBody;
public var weaponType:uint;// = 0
public var reloadNow:uint;// = 0
public var weaponRange:Number;
private var healer:Boolean;// = false
private var weaponSpeed:Number;
public var weaponDamage:Number;
public var weaponSplash:Number;
public var weaponShock:Boolean;
public function weapon(o:unitBody, w:uint):void{
var wepLoad:*;
reloadNow = 0;
weaponType = 0;
kiting = false;
kitingTime = 0;
healer = false;
super();
wepLoad = weaponData.LIST[w];
reloadTime = wepLoad[0];
weaponSpeed = wepLoad[1];
weaponRange = wepLoad[2];
weaponDamage = wepLoad[3];
weaponSplash = wepLoad[4];
weaponShock = wepLoad[5];
weaponGraphic = wepLoad[6];
weaponExplosion = renderMachine.explosions[wepLoad[7]];
weaponType = wepLoad[8];
weaponTrail = wepLoad[9];
weaponShotSFX = wepLoad[10];
weaponExSFX = wepLoad[11];
ownUnit = o;
reloadNow = reloadTime;
}
private function work(event:Event):void{
if (reloadNow == 0){
addEventListener(Event.ENTER_FRAME, reload);
} else {
if (reloadNow == reloadTime){
reloadNow = 0;
fire();
};
};
if ((reloadTime - reloadNow) == ownUnit.prefire){
ownUnit.modeChange(4);
};
}
private function fire():void{
var bullet:wep_projectile;
if (ownUnit.x > 800){
soundKon.playSound(0, weaponShotSFX, true);
} else {
soundKon.playSound(0, weaponShotSFX);
};
ownUnit.modeChange(2);
bullet = new wep_projectile(weaponGraphic, ownUnit, weaponDamage, weaponSpeed, weaponExplosion, weaponShock, weaponSplash, healer, weaponType, weaponTrail, weaponExSFX);
unitKon.addBullet(bullet, ownUnit);
}
public function engage(h:Boolean):void{
healer = h;
addEventListener(Event.ENTER_FRAME, work);
}
public function disengage():void{
removeEventListener(Event.ENTER_FRAME, work);
}
private function reload(event:Event):void{
if (reloadNow < reloadTime){
reloadNow++;
} else {
removeEventListener(Event.ENTER_FRAME, reload);
};
}
}
}//package
Section 263
//weaponData (weaponData)
package {
public class weaponData {
private var wep:Array;
private var iN:Number;// = -1
public static var LIST:Array = new Array();
public function weaponData():void{
iN = -1;
wep = new Array();
super();
make([15, 15, 250, 8, 0, true, 0, 0, 0, 0, 4, 0]);
make([13, 45, 382, 35, 7, false, 0, 1, 1, 0, 12, 0]);
make([94, 30, 439, 57, 0, false, 1, 2, 2, 2, 9, 0]);
make([120, 15, 360, 70, 43, false, 2, 4, 1, 7, 10, 3]);
make([35, 15, 390, 140, 0, false, 3, 5, 2, 6, 2, 2]);
make([5, 23, 395, 8.5, 0, false, 4, 6, 1, 0, 11, 0]);
make([42, 18, 230, 85, 0, false, 5, 7, 1, 3, 7, 0]);
make([50, 18, 430, 63, 52, false, 6, 8, 2, 4, 8, 4]);
make([4, 20, 400, 6, 40, false, 7, 6, 1, 9, 5, 0]);
make([360, 17, 500, 140, 85, false, 8, 3, 3, 1, 1, 1]);
make([18, 20, 380, 80, 0, false, 8, 6, 1, 1, 3, 3]);
make([25, 25, 380, 20, 0, false, 6, 1, 2, 0, 8, 0]);
make([15, 25, 170, 12, 0, true, 9, 9, 1, 0, 0, 0]);
make([30, 20, 190, 20, 10, false, 0, 1, 0, 0, 6, 0]);
make([80, 30, 420, 20, 0, false, 1, 2, 2, 2, 9, 5]);
make([70, 18, 400, 40, 28, false, 6, 8, 2, 4, 8, 4]);
make([180, 18, 385, 37, 5, false, 4, 4, 0, 10, 3, 3]);
make([4, 25, 290, 17, 0, false, 10, 10, 3, 11, 12, 0]);
make([12, 20, 420, 27, 0, false, 10, 10, 3, 11, 12, 0]);
make([15, 18, 280, 95, 0, false, 5, 7, 1, 3, 7, 0]);
make([4, 20, 400, 12, 40, false, 7, 6, 1, 9, 5, 0]);
make([10, 15, 300, 12, 0, true, 0, 0, 0, 0, 4, 0]);
make([180, 25, 430, 40, 25, false, 4, 4, 0, 10, 3, 3]);
}
private function make(a:Array):void{
var i:*;
iN++;
LIST[iN] = new Array();
for (i in a) {
LIST[iN][i] = a[i];
};
}
}
}//package
Section 264
//wep_missile (wep_missile)
package {
import flash.events.*;
public class wep_missile extends displayBody {
private var timeToGo:uint;
private var midTime:Number;
private var tar_y:Number;
private var speed:Number;// = 8
private var ySide:Number;
private var tar_x:Number;
private var gravity:Number;// = 0.8
private var hyp:Number;
private var damage:Number;
private var target:unitBody;
private var Splash:Number;
private var EX:Object;
private var WepType:uint;
private var angle:Number;
private var startYVel:Number;
private var xSide:Number;
private var speedX:Number;
private var speedY:Number;
public function wep_missile(id:uint, u:unitBody, dam:Number, s:Number, ex:uint, splash:Number, wepType:uint):void{
gravity = 0.8;
speed = 8;
super();
speed = s;
EX = renderMachine.explosions[ex];
gameKon.displayArray.push(this);
createDisplay(renderMachine.weapons[id], true);
target = u;
damage = dam;
Splash = splash;
WepType = wepType;
addEventListener(Event.ENTER_FRAME, doTrail);
}
public function init():void{
tar_x = (((target.x + (target.width / 2)) * 0.97) + (Math.random() * 0.05));
tar_y = ((target.y * 0.97) + (Math.random() * 0.05));
if (x > 800){
soundKon.playSound(0, 0, true);
} else {
soundKon.playSound(0, 0, false);
};
xSide = Math.abs((x - tar_x));
ySide = Math.abs((y - tar_y));
hyp = Math.sqrt((Math.pow(xSide, 2) + Math.pow(ySide, 2)));
speedX = ((speed * xSide) / hyp);
speedY = ((speed * ySide) / hyp);
if (tar_x < x){
speedX = (speedX * -1);
};
if (tar_y < y){
speedY = (speedY * -1);
};
timeToGo = Math.round((hyp / speed));
if (target.airUnit){
speedY = (speedY * 2);
gravity = (-(speedY) / timeToGo);
} else {
speedY = (speedY - (gravity * (timeToGo / 2)));
};
angle = Math.atan((speedX / speedY));
rotation = ((angle * 180) / Math.PI);
if (tar_x < x){
rotation = (180 - rotation);
};
if (tar_y < y){
rotation = (rotation * -1);
};
addEventListener(Event.ENTER_FRAME, go);
}
public function killEvents():void{
unitKon.killMissile(this);
}
private function calcHyp(dX, dY){
xSide = Math.abs((x - dX));
ySide = Math.abs((y - dY));
hyp = Math.sqrt((Math.pow(xSide, 2) + Math.pow(ySide, 2)));
return (hyp);
}
private function killMain(event:Event):void{
timeToGo = (timeToGo - 1);
if (timeToGo <= 0){
removeEventListener(Event.ENTER_FRAME, killMain);
unitKon.killMissile(this);
};
}
private function doTrail(event:Event):void{
unitKon.addTrail(1, x, y);
}
private function hit():void{
var m:*;
var tempTar:*;
if (x > 800){
soundKon.playSound(2, 1, true);
} else {
soundKon.playSound(2, 1, false);
};
gameKon.shakeScreen(2);
target.takeHit(damage, WepType);
//unresolved jump
var _slot1 = e;
if (Splash > 0){
for (m in target.team.all) {
tempTar = target.team.all[m];
if (calcHyp(tempTar.x, tempTar.y) <= Splash){
tempTar.takeHit(damage, WepType);
};
};
};
stopBullet();
modeChange(5, EX);
unitKon.addEx(3, x, y);
timeToGo = EX.normal.length;
rotation = 0;
addEventListener(Event.ENTER_FRAME, killMain);
}
public function stopBullet():void{
removeEventListener(Event.ENTER_FRAME, go);
removeEventListener(Event.ENTER_FRAME, doTrail);
}
public function terminateEvents():void{
stopBullet();
end();
}
private function go(event:Event):void{
x = (x + speedX);
speedY = (speedY + gravity);
y = (y + speedY);
timeToGo = (timeToGo - 1);
if (timeToGo == 0){
hit();
} else {
angle = Math.atan((speedY / speedX));
rotation = ((angle * 180) / Math.PI);
if (tar_x < x){
rotation = (rotation - 180);
};
};
}
}
}//package
Section 265
//wep_projectile (wep_projectile)
package {
import flash.events.*;
public class wep_projectile extends displayBody {
private var shooter:unitBody;
private var sound:uint;
private var timeToGo:uint;
private var tar_y:Number;
private var speed:Number;// = 8
private var ySide:Number;
private var tar_x:Number;
private var p:playerKon;// = null
private var hyp:Number;
private var Shock:Boolean;
private var damage:Number;
private var target:unitBody;
private var Splash:Number;
private var EX:Object;
private var WepType:uint;
private var angle:Number;
private var wepTrail:uint;
private var xSide:Number;
private var speedX:Number;
private var speedY:Number;
public function wep_projectile(id:uint, u:unitBody, dam:Number, s:Number, ex:Object, shock:Boolean, splash:Number, heal:Boolean, wepType:uint, trail:uint=0, sound:uint=0):void{
p = null;
speed = 8;
super();
speed = s;
EX = ex;
shooter = u;
this.sound = sound;
if (u.assocBase == null){
p = u.player;
};
gameKon.displayArray.push(this);
createDisplay(renderMachine.weapons[id], true);
target = u.mainTarget;
Shock = shock;
Splash = splash;
WepType = wepType;
if (heal){
damage = -(dam);
} else {
damage = dam;
};
if (trail > 0){
wepTrail = trail;
addEventListener(Event.ENTER_FRAME, doTrail);
};
}
public function init(u:unitBody):void{
tar_x = ((u.mainTarget.x + (u.mainTarget.width / 2)) + getRand());
tar_y = (u.mainTarget.y + getRand());
if (Shock){
x = (tar_x + getRand());
y = (tar_y + getRand());
hit();
} else {
xSide = Math.abs((x - tar_x));
ySide = Math.abs((y - tar_y));
hyp = Math.sqrt((Math.pow(xSide, 2) + Math.pow(ySide, 2)));
angle = Math.atan((ySide / xSide));
speedX = ((speed * xSide) / hyp);
speedY = ((speed * ySide) / hyp);
if (tar_x < x){
speedX = (speedX * -1);
};
if (tar_y < y){
speedY = (speedY * -1);
};
timeToGo = Math.round((hyp / speed));
rotation = ((angle * 180) / Math.PI);
if (tar_x < x){
rotation = (180 - rotation);
};
if (tar_y < y){
rotation = (rotation * -1);
};
addEventListener(Event.ENTER_FRAME, go);
};
}
public function killEvents():void{
unitKon.killBullet(this);
}
private function calcHyp(dX, dY){
xSide = Math.abs((x - dX));
ySide = Math.abs((y - dY));
hyp = Math.sqrt((Math.pow(xSide, 2) + Math.pow(ySide, 2)));
return (hyp);
}
private function killMain(event:Event):void{
timeToGo = (timeToGo - 1);
if (timeToGo <= 0){
removeEventListener(Event.ENTER_FRAME, killMain);
unitKon.killBullet(this);
};
}
private function doTrail(event:Event):void{
unitKon.addTrail(wepTrail, x, y);
}
private function hit():void{
var m:*;
var tempTar:*;
if (x > 800){
soundKon.playSound(2, sound, true);
} else {
soundKon.playSound(2, sound, false);
};
target.takeHit(damage, WepType, shooter, p);
//unresolved jump
var _slot1 = e;
if (Splash > 0){
for (m in target.team.all) {
tempTar = target.team.all[m];
if (calcHyp(tempTar.x, tempTar.y) <= Splash){
tempTar.takeHit(damage, WepType);
};
};
};
stopBullet();
modeChange(5, EX);
timeToGo = EX.normal.length;
addEventListener(Event.ENTER_FRAME, killMain);
}
public function stopBullet():void{
removeEventListener(Event.ENTER_FRAME, go);
removeEventListener(Event.ENTER_FRAME, doTrail);
}
private function getRand(){
return ((5 - (Math.random() * 10)));
}
public function terminateEvents():void{
stopBullet();
end();
}
private function go(event:Event):void{
x = (x + speedX);
y = (y + speedY);
timeToGo = (timeToGo - 1);
if (timeToGo == 0){
hit();
};
}
}
}//package