Section 1
//Client (com.king.marble.comm.Client)
package com.king.marble.comm {
public class Client {
public var isPlayer:Boolean;
public var avatarSlot:int;
public var avatar:String;
public var name:String;
public var id:int;
public var playerId:int;
public var isConnected:Boolean;
public function Client(_arg1:Number, _arg2:String, _arg3:String){
this.id = _arg1;
this.name = _arg2;
this.avatar = _arg3;
playerId = (_arg1 + 1);
isPlayer = false;
isConnected = true;
}
}
}//package com.king.marble.comm
Section 2
//CommCallback (com.king.marble.comm.CommCallback)
package com.king.marble.comm {
public interface CommCallback {
function clientAccepted(_arg1:Client):void;
function startGame():void;
function clientDisconnected(_arg1:Number, _arg2:Number):void;
function localDisconnect():void;
function connecting():void;
function gameCommand(_arg1:String):void;
function log(_arg1:String):void;
function unableToConnect():void;
function clientConnected(_arg1:Client):void;
}
}//package com.king.marble.comm
Section 3
//Communicator (com.king.marble.comm.Communicator)
package com.king.marble.comm {
import flash.events.*;
import flash.utils.*;
import com.king.marble.utils.*;
import flash.system.*;
import flash.net.*;
public class Communicator {
private var pauseQueue:Array;
protected var callback:CommCallback;
public var numPlayers:int;// = 0
private var delayQueue:Array;
private var lastPingTime:Number;// = -1
private var connectionEstablished:Boolean;// = false
protected var connectString:String;
protected var pingTime:Number;// = 4
private var magic:String;
protected var socket:XMLSocket;
private var pauseDepth:int;// = 0
private var slotId:String;
private var isConnected:Boolean;// = false
private static var FAKE_LAG:int = 0;
public function Communicator(_arg1:CommCallback=null){
pauseQueue = new Array();
super();
delayQueue = new Array();
this.callback = _arg1;
}
public function handleCommand(_arg1:String):void{
var _local3:Number;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:Number;
var _local8:Number;
if ((((_arg1.indexOf("STM") < 0)) && ((_arg1.indexOf("AIM") < 0)))){
Debug.print(_arg1, "ffffdd");
};
var _local2:Array = _arg1.split(" ");
if (_local2[0] == "SCA"){
_local3 = new Number(_local2[1]);
_local4 = _local2[2];
_local5 = 3;
while (_local4.charAt((_local4.length - 1)) != "\"") {
var _temp1 = _local5;
_local5 = (_local5 + 1);
_local4 = (_local4 + (" " + _local2[_temp1]));
};
var _temp2 = _local5;
_local5 = (_local5 + 1);
_local6 = _local2[_temp2];
while (_local6.charAt((_local6.length - 1)) != "\"") {
var _temp3 = _local5;
_local5 = (_local5 + 1);
_local6 = (_local6 + (" " + _local2[_temp3]));
};
var _temp4 = _local5;
_local5 = (_local5 + 1);
numPlayers = parseInt(_local2[_temp4]);
_local4 = _local4.substring(1, (_local4.length - 1));
_local6 = _local6.substring(1, (_local6.length - 1));
callback.clientAccepted(new Client(_local3, _local4, _local6));
isConnected = true;
} else {
if (_local2[0] == "SAC"){
_local3 = new Number(_local2[1]);
_local4 = _local2[2];
_local5 = 3;
while (_local4.charAt((_local4.length - 1)) != "\"") {
var _temp5 = _local5;
_local5 = (_local5 + 1);
_local4 = (_local4 + (" " + _local2[_temp5]));
};
_local6 = _local2[_local5];
_local4 = _local4.substring(1, (_local4.length - 1));
_local6 = _local6.substring(1, (_local6.length - 1));
callback.clientConnected(new Client(_local3, _local4, _local6));
} else {
if (_local2[0] == "SCD"){
_local3 = new Number(_local2[1]);
_local7 = new Number(_local2[2]);
callback.clientDisconnected(_local3, _local7);
} else {
if (_local2[0] == "SSG"){
callback.startGame();
} else {
if (_local2[0] == "STM"){
_local8 = new Number(_local2[1]);
} else {
callback.gameCommand(_arg1);
};
};
};
};
};
}
public function log(_arg1:String):void{
Debug.print(("Communicator.log() " + _arg1), "ffffdd");
}
public function connected():void{
sendData(((("CCC " + slotId) + " ") + magic));
}
public function onConnect(_arg1:Event):void{
connectionEstablished = true;
connected();
}
public function sendData(_arg1:String):void{
var o:Object;
var cmd = _arg1;
if (!connectionEstablished){
return;
};
if (FAKE_LAG > 0){
o = new Object();
o.time = (getTimer() + int(((Math.random() * Math.random()) * FAKE_LAG)));
o.cmd = cmd;
delayQueue.push(o);
} else {
try {
socket.send(cmd);
} catch(e:Error) {
log(((("ERROR: " + e) + ", ") + typeof(e)));
localDisconnect();
};
};
}
public function cmdReceived(_arg1:String):void{
if ((((pauseDepth > 0)) && ((_arg1.indexOf("S") == 0)))){
pauseQueue.push(_arg1);
return;
};
handleCommand(_arg1);
}
public function unableToConnect():void{
disconnected();
callback.unableToConnect();
}
public function onClose(_arg1:Event):void{
Debug.print("socket event onClose", "ff3333");
localDisconnect();
}
public function disconnected():void{
isConnected = false;
connectionEstablished = false;
}
public function pause():void{
pauseDepth++;
}
public function tick():void{
var now:uint;
if ((((FAKE_LAG > 0)) && ((delayQueue.length > 0)))){
while (delayQueue[0].time < getTimer()) {
try {
socket.send(delayQueue[0].cmd);
} catch(e:Error) {
log(((("ERROR: " + e) + ", ") + typeof(e)));
localDisconnect();
};
delayQueue.splice(0, 1);
};
};
if (isConnected){
now = getTimer();
while ((now - lastPingTime) > 7000) {
lastPingTime = (lastPingTime + 7000);
sendData("CTM");
};
};
}
public function catchIOError(_arg1:IOErrorEvent):void{
log(("IOERROR: " + _arg1));
unableToConnect();
}
public function securityError(_arg1:Event):void{
log(("securityError: " + _arg1));
unableToConnect();
}
public function disconnect():void{
socket.close();
isConnected = false;
connectionEstablished = false;
}
public function localDisconnect():void{
disconnected();
callback.localDisconnect();
}
public function onData(_arg1:DataEvent):void{
cmdReceived(_arg1.data);
}
public function connect(_arg1:String, _arg2:int, _arg3:String, _arg4:String):void{
var serverIp = _arg1;
var serverPort = _arg2;
var slotId = _arg3;
var magic = _arg4;
try {
Security.loadPolicyFile((("http://" + serverIp) + "/crossdomain.xml"));
this.connectString = ((serverIp + ":") + serverPort);
this.slotId = slotId;
this.magic = magic;
socket = new XMLSocket();
callback.connecting();
socket.addEventListener(Event.CONNECT, onConnect);
socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
socket.addEventListener(DataEvent.DATA, onData);
socket.addEventListener(Event.CLOSE, onClose);
socket.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);
log((("connecting to " + connectString) + "..."));
socket.connect(serverIp, serverPort);
} catch(e:Error) {
log(("ERROR: " + e));
unableToConnect();
};
}
public function resume():void{
var _local1:int;
pauseDepth--;
if (pauseDepth <= 0){
_local1 = 0;
while (_local1 < pauseQueue.length) {
handleCommand(pauseQueue[_local1]);
_local1++;
};
pauseQueue = new Array();
};
}
}
}//package com.king.marble.comm
Section 4
//GameData (com.king.marble.comm.GameData)
package com.king.marble.comm {
public class GameData {
public var port:int;
public var gameType:String;
public var magic:String;
public var textMappings:Object;
public var hostName:String;
public var randomSeed:int;
public var slotId:String;
}
}//package com.king.marble.comm
Section 5
//GameDataParser (com.king.marble.comm.GameDataParser)
package com.king.marble.comm {
import com.king.marble.utils.*;
import flash.xml.*;
public class GameDataParser {
public static var textMappings:Object;
public static function parseGameData(_arg1:String):GameData{
var _local2:GameData = new GameData();
var _local3:XMLDocument = new XMLDocument(_arg1);
textMappings = new Object();
_local2.textMappings = textMappings;
var _local4:Array = _local3.firstChild.childNodes;
var _local5:int = parseInt(_local3.firstChild.attributes.randomseed);
_local2.randomSeed = _local5;
var _local6:int;
while (_local6 < _local4.length) {
if (_local4[_local6].nodeName == "id"){
};
if (_local4[_local6].nodeName == "game"){
_local2.gameType = new String(_local4[_local6].attributes.type);
Debug.print(("gameType " + _local2.gameType), "ffffaa");
};
if (_local4[_local6].nodeName == "multiplayer"){
_local2.hostName = _local4[_local6].attributes.hostname.toString();
_local2.port = parseInt(_local4[_local6].attributes.port);
_local2.slotId = _local4[_local6].attributes.slotid.toString();
_local2.magic = _local4[_local6].attributes.magic.toString();
Debug.print(((("host:\t\t " + _local2.hostName) + ":") + _local2.port), "ffffaa");
Debug.print(("slotId:\t " + _local2.slotId), "ffffaa");
Debug.print(("magic:\t\t " + _local2.magic), "ffffaa");
};
if (_local4[_local6].nodeName == "text"){
if ((((_local4[_local6].firstChild == null)) || ((_local4[_local6].firstChild == undefined)))){
textMappings[_local4[_local6].attributes.id] = (("[xx" + _local4[_local6].attributes.id) + "xx]");
} else {
textMappings[_local4[_local6].attributes.id] = new String(_local4[_local6].firstChild.nodeValue);
};
TextMappings.set(_local4[_local6].attributes.id, textMappings[_local4[_local6].attributes.id]);
};
_local6++;
};
return (_local2);
}
}
}//package com.king.marble.comm
Section 6
//TextMappings (com.king.marble.comm.TextMappings)
package com.king.marble.comm {
public class TextMappings {
public static var mappings:Object = new Object();
public static function set(_arg1:String, _arg2:String):void{
mappings[_arg1] = _arg2;
}
public static function get(_arg1:String):String{
if (mappings[_arg1] == null){
return ((("[" + _arg1) + "]"));
};
return (mappings[_arg1]);
}
}
}//package com.king.marble.comm
Section 7
//BitmapDispenser (com.king.marble.data.BitmapDispenser)
package com.king.marble.data {
import flash.display.*;
import flash.utils.*;
import com.king.marble.utils.*;
public class BitmapDispenser {
private static var _movieClip:MovieClip;
private static var _callBack:Function;
private static var _bitmaps:Dictionary;
private static var _frm:int;
private static var _time:int;
private static var _this:BitmapDispenser;
public static function generateBitmaps(_arg1:MovieClip, _arg2:Function):void{
_this = new (BitmapDispenser);
_bitmaps = new Dictionary();
_movieClip = _arg1;
_frm = 1;
_time = getTimer();
_callBack = _arg2;
drawBitmap();
}
private static function drawBitmap():void{
var _local1:BitmapData = new BitmapData(_movieClip.width, _movieClip.height, true, 0x555555);
_local1.draw(_movieClip);
_bitmaps[_movieClip.currentLabel] = _local1;
if (_frm < _movieClip.totalFrames){
_frm++;
_movieClip.gotoAndStop(_frm);
drawBitmap();
} else {
Debug.print(((("BitmapDispenser.generateBitmaps() finished time: " + (getTimer() - _time)) + "ms totalFrames: ") + _movieClip.totalFrames));
if (_callBack != null){
_callBack();
};
};
}
public static function getBitmapData(_arg1:String):BitmapData{
return (((_bitmaps[_arg1])!=null) ? _bitmaps[_arg1] : _bitmaps["err_not_found"]);
}
}
}//package com.king.marble.data
Section 8
//Arrow (com.king.marble.game.Arrow)
package com.king.marble.game {
import com.king.marble.*;
import flash.display.*;
import gs.*;
import flash.filters.*;
public class Arrow extends Sprite {
public function Arrow(){
var _local1:Class = Main.getInstance().MarbleArrowGfx;
var _local2:Sprite = (new (_local1) as Sprite);
addChild(_local2);
filters = [new DropShadowFilter(6, 45, 0, 0.5, 6, 6)];
}
public function hide():void{
TweenLite.to(this, 1, {alpha:0});
}
public function show():void{
TweenLite.to(this, 0.5, {alpha:1});
}
}
}//package com.king.marble.game
Section 9
//Ball (com.king.marble.game.Ball)
package com.king.marble.game {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import gs.*;
import com.king.marble.data.*;
import flash.filters.*;
public class Ball extends Sprite {
public var isSkillShotBall:Boolean;// = false
public var enabled:Boolean;
public var vx:Number;// = 0
public var vy:Number;// = 0
public var px:Number;// = 0
public var py:Number;// = 0
public var isOut:Boolean;// = false
public var bounce:Number;// = 0.6
public var dampen:Number;// = 0.96
public var id:int;
public var m:Number;
public var ownerId:int;
public var r:Number;
private var _shadow:Shape;
public static var ballIdPool:int = 0;
public function Ball(_arg1:int){
ballIdPool++;
id = ballIdPool;
ownerId = _arg1;
r = 25;
m = r;
var _local2:String = ((((_arg1 == 1)) || ((_arg1 == 4)))) ? "ball_blue" : "ball_red";
var _local3:Bitmap = new Bitmap(BitmapDispenser.getBitmapData(_local2));
_local3.smoothing = true;
_local3.x = (-(_local3.width) / 2);
_local3.y = (-(_local3.height) / 2);
addChild(_local3);
mouseChildren = false;
}
public function setEnabled(_arg1:Boolean):void{
enabled = _arg1;
buttonMode = _arg1;
}
public function setShadow(_arg1:Shape):void{
_shadow = _arg1;
_shadow.graphics.beginFill(0, 0.5);
_shadow.graphics.drawCircle(0, 0, (r * 0.9));
_shadow.filters = [new BlurFilter(8, 8, BitmapFilterQuality.LOW)];
_shadow.cacheAsBitmap = true;
_shadow.x = (x + (r / 4));
_shadow.y = (y + (r / 4));
}
public function setInteractive(_arg1:Boolean):void{
if (_arg1){
if (!hasEventListener(MouseEvent.MOUSE_DOWN)){
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
};
} else {
if (hasEventListener(MouseEvent.MOUSE_DOWN)){
removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
};
};
buttonMode = _arg1;
}
public function onUpdate():void{
if (Math.abs(vx) < 0.1){
vx = 0;
};
if (Math.abs(vy) < 0.1){
vy = 0;
};
if ((Math.abs(vx) + Math.abs(vy)) > 0.1){
px = (px + vx);
py = (py + vy);
};
var _local1:Point = Board.fromGameCordsToDisplayCords(new Point(px, py));
x = _local1.x;
_shadow.x = (x + (r / 4));
y = _local1.y;
_shadow.y = (y + (r / 4));
vx = (vx * dampen);
vy = (vy * dampen);
}
private function onMouseDown(_arg1:MouseEvent):void{
if (enabled){
Game.getInstance().input.startShootBall(this);
};
}
public function fadeUp(_arg1:Number=0):void{
alpha = 0.2;
_shadow.alpha = 0.2;
if (_arg1 == 0){
TweenLite.to(this, 0.5, {alpha:1});
TweenLite.to(_shadow, 0.5, {alpha:1});
} else {
TweenLite.to(this, 0.5, {alpha:1, delay:_arg1});
TweenLite.to(_shadow, 0.5, {alpha:1, delay:_arg1});
};
}
public function fadeOut(_arg1:Boolean=true):void{
alpha = 0.95;
if (_arg1){
TweenLite.to(this, 0.5, {alpha:0, onComplete:this.destroy});
} else {
TweenLite.to(this, 0.5, {alpha:0});
};
TweenLite.to(_shadow, 0.5, {alpha:0});
}
public function destroy():void{
if (parent){
parent.removeChild(this);
};
if (_shadow.parent){
_shadow.parent.removeChild(_shadow);
};
Game.getInstance().removeBall(this);
}
}
}//package com.king.marble.game
Section 10
//Board (com.king.marble.game.Board)
package com.king.marble.game {
import flash.geom.*;
import flash.display.*;
import com.king.marble.data.*;
public class Board extends Sprite {
public var targetPl1:SkillShotTarget;
public var targetPl2:SkillShotTarget;
private var _delimiter:Bitmap;
public static const GAME_AREA_CENTER:Point = new Point((GAME_AREA.x + (GAME_AREA.width / 2)), (GAME_AREA.y + (GAME_AREA.height / 2)));
public static const GAME_AREA:Rectangle = new Rectangle(148, 53, 460, 460);
public function Board(){
var _local1:Bitmap = new Bitmap(BitmapDispenser.getBitmapData("game_bg"));
addChild(_local1);
_delimiter = new Bitmap(BitmapDispenser.getBitmapData("start_middle"));
_delimiter.x = ((GAME_AREA.x + (GAME_AREA.width / 2)) - (_delimiter.width / 2));
_delimiter.y = GAME_AREA.y;
}
public function addSkillTarget(_arg1:Number, _arg2:Number, _arg3:int):void{
var _local4:SkillShotTarget = new SkillShotTarget(_arg3);
_local4.px = _arg1;
_local4.py = _arg2;
var _local5:Point = Board.fromGameCordsToDisplayCords(new Point(_arg1, _arg2));
_local4.x = _local5.x;
_local4.y = _local5.y;
addChild(_local4);
if (_arg3 == 1){
targetPl1 = _local4;
} else {
targetPl2 = _local4;
};
}
public function showSkillShotStuff(_arg1:Boolean):void{
if (_arg1){
addChild(_delimiter);
} else {
if (_delimiter.parent){
_delimiter.parent.removeChild(_delimiter);
};
if (targetPl1){
if (targetPl1.parent){
targetPl1.parent.removeChild(targetPl1);
};
};
if (targetPl2){
if (targetPl2.parent){
targetPl2.parent.removeChild(targetPl2);
};
};
};
}
public function containsPoint(_arg1:Number, _arg2:Number):Boolean{
if ((((((((_arg1 > GAME_AREA.x)) && ((_arg1 < (GAME_AREA.x + GAME_AREA.width))))) && ((_arg2 > GAME_AREA.y)))) && ((_arg2 < (GAME_AREA.y + GAME_AREA.height))))){
return (true);
};
return (false);
}
public static function flipVector(_arg1:Point):Point{
if (Game.playerId == 2){
return (_arg1);
};
_arg1.x = -(_arg1.x);
_arg1.y = -(_arg1.y);
return (_arg1);
}
public static function fromDisplayCordsToGameCords(_arg1:Point):Point{
if (Game.playerId == 2){
return (_arg1);
};
var _local2:Number = (_arg1.x - GAME_AREA_CENTER.x);
var _local3:Number = (_arg1.y - GAME_AREA_CENTER.y);
_arg1.x = (GAME_AREA_CENTER.x - _local2);
_arg1.y = (GAME_AREA_CENTER.y - _local3);
return (_arg1);
}
public static function fromGameCordsToDisplayCords(_arg1:Point):Point{
if (Game.playerId == 2){
return (_arg1);
};
var _local2:Number = (_arg1.x - GAME_AREA_CENTER.x);
var _local3:Number = (_arg1.y - GAME_AREA_CENTER.y);
_arg1.x = (GAME_AREA_CENTER.x - _local2);
_arg1.y = (GAME_AREA_CENTER.y - _local3);
return (_arg1);
}
public static function fromGameCordsToDisplayCordsCrazyShit(_arg1:Point):Point{
if (Game.playerId == 1){
return (_arg1);
};
var _local2:Number = (_arg1.x - GAME_AREA_CENTER.x);
var _local3:Number = (_arg1.y - GAME_AREA_CENTER.y);
_arg1.x = (GAME_AREA_CENTER.x - _local2);
_arg1.y = (GAME_AREA_CENTER.y - _local3);
return (_arg1);
}
}
}//package com.king.marble.game
Section 11
//ChatInput (com.king.marble.game.ChatInput)
package com.king.marble.game {
import com.king.marble.*;
import flash.events.*;
import com.king.marble.gui.*;
import flash.display.*;
import flash.text.*;
import com.king.marble.data.*;
import flash.filters.*;
import flash.ui.*;
public class ChatInput extends Sprite {
private var _inputField:StdLabel;
private var _chatSend:Sprite;
public function ChatInput(){
_inputField = new StdLabel(StdLabel.font2, 14, 0xFFFFFF);
_inputField.autoSize = TextFieldAutoSize.NONE;
_inputField.width = 610;
_inputField.height = 20;
_inputField.type = TextFieldType.INPUT;
_inputField.selectable = true;
_inputField.filters = [new GlowFilter(0, 0.75, 6, 6)];
_inputField.x = 2;
_inputField.y = 2;
addChild(_inputField);
_chatSend = new Sprite();
var _local1:Bitmap = new Bitmap(BitmapDispenser.getBitmapData("chat_send"));
_chatSend.addChild(_local1);
_chatSend.x = (675 - 57);
_chatSend.addEventListener(MouseEvent.CLICK, send, false, 0, true);
_chatSend.buttonMode = true;
_chatSend.mouseChildren = false;
addChild(_chatSend);
Main.getInstance().stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true);
}
private function onKey(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
send();
};
if (_inputField.text.length > 75){
_inputField.text = _inputField.text.substr(0, 75);
};
}
private function send(_arg1:Event=null):void{
if (_inputField.text.length > 0){
Main.getInstance().comm.sendChatMsg(_inputField.text);
Game.getInstance().chatMessage(Game.playerId, _inputField.text);
_inputField.text = "";
};
}
}
}//package com.king.marble.game
Section 12
//Collisions (com.king.marble.game.Collisions)
package com.king.marble.game {
import com.king.marble.utils.*;
public class Collisions {
public static function doResponse(_arg1:Ball, _arg2:Ball):void{
var _local17:Number;
var _local3:Number = (_arg2.px - _arg1.px);
var _local4:Number = (_arg2.py - _arg1.py);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
var _local6:Number = XPMath.atan2(_local4, _local3);
var _local7:Number = XPMath.cos(_local6);
var _local8:Number = XPMath.sin(_local6);
var _local9:Number = ((_local7 * _arg1.vx) + (_local8 * _arg1.vy));
var _local10:Number = ((_local7 * _arg1.vy) - (_local8 * _arg1.vx));
var _local11:Number = ((_local7 * _arg2.vx) + (_local8 * _arg2.vy));
var _local12:Number = ((_local7 * _arg2.vy) - (_local8 * _arg2.vx));
var _local13:Number = ((_local9 * _arg1.m) + (_local11 * _arg2.m));
var _local14:Number = (_local9 - _local11);
_local9 = ((_local13 - (_arg2.m * _local14)) / (_arg1.m + _arg2.m));
_local11 = (_local14 + _local9);
_arg1.vx = ((_local7 * _local9) - (_local8 * _local10));
_arg1.vy = ((_local7 * _local10) + (_local8 * _local9));
_arg2.vx = ((_local7 * _local11) - (_local8 * _local12));
_arg2.vy = ((_local7 * _local12) + (_local8 * _local11));
_arg1.vx = (_arg1.vx * _arg1.bounce);
_arg1.vy = (_arg1.vy * _arg1.bounce);
_arg2.vx = (_arg2.vx * _arg2.bounce);
_arg2.vy = (_arg2.vy * _arg2.bounce);
var _local15:Number = (((_arg1.r + _arg2.r) - _local5) / 2);
var _local16:Number = (_local7 * _local15);
_local17 = (_local8 * _local15);
_arg1.px = (_arg1.px - _local16);
_arg1.py = (_arg1.py - _local17);
_arg2.px = (_arg2.px + _local16);
_arg2.py = (_arg2.py + _local17);
}
public static function checkColl(_arg1:Ball, _arg2:Ball):Boolean{
var _local3:Number = (_arg2.px - _arg1.px);
var _local4:Number = (_arg2.py - _arg1.py);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
return ((_local5 <= (_arg1.r + _arg2.r)));
}
}
}//package com.king.marble.game
Section 13
//Game (com.king.marble.game.Game)
package com.king.marble.game {
import com.king.marble.*;
import flash.events.*;
import com.king.marble.gui.*;
import com.king.marble.comm.*;
import flash.geom.*;
import flash.display.*;
import gs.*;
import flash.utils.*;
import com.king.marble.utils.*;
import flash.system.*;
import com.king.marble.data.*;
public class Game extends Sprite implements MarbleListener {
public var player1Score:ScoreBoard;
public var arrow:Arrow;
public var scoreCounter:ScoreCounter;
private var _player1TimeIndicator:TimeIndicator;
private var _waitingMsg:ShortMessage;
private var _exitBtn:BitmapButton;
public var player2Score:ScoreBoard;
private var opponentAim:Arrow;
private var _player2TimeIndicator:TimeIndicator;
private var _gameHasStarted:Boolean;// = false
private var _shots:int;// = 0
private var _timeOutId:uint;
private var _timer:Timer;
public var input:Input;
private var _ticksThisTurn:int;// = -1
private var _ballsStill:int;// = 0
private var _balls:Array;
private var chatInput:ChatInput;
public var board:Board;
private var _readyBtnPressed:Boolean;// = false
private var _ballsAreMoving:Boolean;// = false
private var _readyButton:BitmapButton;
private var _timesTimedOut:int;// = 0
public static const TICKS_PER_SECOND:int = 50;
public static const PHASE_SKILLSHOT:int = 2;
public static const PHASE_MAINGAME:int = 3;
public static const PHASE_OUTRO:int = 4;
public static const PHASE_INTRO:int = 1;
public static const TURN_MAX_TIME:int = 10000;
public static const PHASE_IDLE:int = 5;
public static const SKILLSHOT_MAX_TIME:int = 20000;
public static var roundId:int = 0;
public static var opponentId:int;
public static var turnId:int = 0;
public static var playerId:int = 1;
public static var turnOwner:int = 0;
public static var phase:int;
private static var _this:Game;
public function Game(){
_balls = [];
super();
_this = this;
}
public function showScorePop(_arg1:int, _arg2:Ball, _arg3:int=0):void{
var _local4:ScorePop = new ScorePop(_arg1);
var _local5:Point = Board.flipVector(new Point(_arg2.vx, _arg2.vy));
_local4.x = _arg2.x;
_local4.y = _arg2.y;
_local4.show(_local5.x, _local5.y, _arg3);
addChild(_local4);
}
private function printBallPositions():void{
var _local2:Ball;
var _local1:int;
while (_local1 < _balls.length) {
_local2 = _balls[_local1];
Debug.print(((((((((("Ball " + _local2.id) + " ") + _local2.px) + " ") + _local2.py) + " | ") + _local2.vx) + " ") + _local2.vy));
_local1++;
};
}
public function onSkillShotEnd():void{
phase = PHASE_IDLE;
if (opponentAim.alpha > 0){
opponentAim.hide();
};
}
public function chatMessage(_arg1:int, _arg2:String):void{
Debug.print(((("CHAT: " + _arg1) + " : ") + _arg2));
if (_arg1 == 1){
player1Score.chatMessage(_arg1, _arg2);
} else {
player2Score.chatMessage(_arg1, _arg2);
};
}
public function init():void{
MarbleEvents.addListener(this);
board = new Board();
addChild(board);
scoreCounter = new ScoreCounter();
arrow = new Arrow();
opponentAim = new Arrow();
input = new Input(arrow, opponentAim);
arrow.alpha = 0;
opponentAim.alpha = 0;
_timer = new Timer((1000 / TICKS_PER_SECOND));
_timer.addEventListener(TimerEvent.TIMER, tick, false, 0, true);
chatInput = new ChatInput();
chatInput.x = 25;
chatInput.y = 540;
_waitingMsg = new ShortMessage(TextMappings.get("waiting_for_opponent"));
_waitingMsg.scaleX = (_waitingMsg.scaleY = 0.75);
_waitingMsg.x = (Main.W / 2);
_waitingMsg.y = (Main.H / 2);
addChild(opponentAim);
addChild(arrow);
_readyButton = new BitmapButton();
_readyButton.setBitmap(BitmapDispenser.getBitmapData("btn_ready"));
_readyButton.x = ((Main.W / 2) - (_readyButton.width / 2));
_readyButton.y = ((Main.H / 2) - (_readyButton.height / 2));
_readyButton.setActive(true, onReadyButtonPressed);
var _local1:StdLabel = new StdLabel(StdLabel.font2, 14);
_local1.text = TextMappings.get("btn_ready");
_local1.x = ((_readyButton.width / 2) - (_local1.width / 2));
_local1.y = 5;
_readyButton.addChild(_local1);
addChild(_readyButton);
setTimeout(onReadyButtonPressed, (30 * 1000));
}
public function removeReadyButton():void{
if (_readyButton.parent){
_readyButton.parent.removeChild(_readyButton);
};
}
private function cleanBoard():void{
var _local1:Ball;
while (_balls.length > 0) {
_local1 = _balls[0];
_local1.destroy();
};
if (_balls.length > 0){
Debug.print(("Game.cleanBoard() err balls length: " + _balls.length), "ff3333");
};
}
public function getBalls():Array{
return (_balls);
}
public function enableBalls(_arg1:Boolean):void{
var _local3:Ball;
Debug.print(("Game.enableBalls() " + _arg1), "3399ff");
var _local2:int;
while (_local2 < _balls.length) {
_local3 = _balls[_local2];
if (_local3.ownerId == playerId){
_local3.setEnabled(_arg1);
};
_local2++;
};
}
public function removeBall(_arg1:Ball):void{
var _local3:Ball;
var _local2:int;
while (_local2 < _balls.length) {
_local3 = _balls[_local2];
if (_arg1 == _local3){
_balls.splice(_local2, 1);
return;
};
_local2++;
};
Debug.print("Game.removeBall() err ball not found!!", "ff3333");
}
public function onGameFinished():void{
}
private function setupSkillShotBoard():void{
var _local9:Ball;
Debug.print("Game.setupSkillShotBoard() ", "ffffff");
cleanBoard();
board.showSkillShotStuff(false);
board.showSkillShotStuff(true);
var _local1 = 2;
var _local2 = 1;
var _local3:int = (75 + (100 * Main.random.nextDouble()));
var _local4:int = (150 + (20 * Main.random.nextDouble()));
var _local5:int = (85 + (50 * Main.random.nextDouble()));
var _local6:int = (-130 - (40 * Main.random.nextDouble()));
var _local7:int = (170 + (30 * Main.random.nextDouble()));
var _local8:int = (-20 + (50 * Main.random.nextDouble()));
board.addSkillTarget((Board.GAME_AREA_CENTER.x + _local3), (Board.GAME_AREA_CENTER.y - _local4), _local1);
addBall((Board.GAME_AREA_CENTER.x + _local5), (Board.GAME_AREA_CENTER.y - _local6), _local1, true);
_local9 = addBall((Board.GAME_AREA_CENTER.x + _local7), (Board.GAME_AREA_CENTER.y - _local8), 4, false);
_local1 = 1;
_local2 = 2;
_local3 = -(_local3);
_local4 = -(_local4);
_local5 = -(_local5);
_local6 = -(_local6);
_local7 = -(_local7);
_local8 = -(_local8);
board.addSkillTarget((Board.GAME_AREA_CENTER.x + _local3), (Board.GAME_AREA_CENTER.y - _local4), _local1);
addBall((Board.GAME_AREA_CENTER.x + _local5), (Board.GAME_AREA_CENTER.y - _local6), _local1, true);
_local9 = addBall((Board.GAME_AREA_CENTER.x + _local7), (Board.GAME_AREA_CENTER.y - _local8), 3, false);
enableBalls(true);
addBallsToDisplay();
}
private function tick(_arg1:Event):void{
var _local2:uint;
var _local3:Number;
var _local4:int;
var _local5:Ball;
var _local6:int;
var _local7:Ball;
var _local8:Number;
var _local9:Number;
var _local10:Number;
Main.tick++;
if (_ballsAreMoving){
_ticksThisTurn++;
_local2 = getTimer();
_local3 = 0;
_local4 = 0;
while (_local4 < _balls.length) {
_local5 = _balls[_local4];
_local5.onUpdate();
if (_local5.isOut){
} else {
_local6 = 0;
while (_local6 < _balls.length) {
_local7 = _balls[_local6];
if (((!((_local5 == _local7))) && (!(_local7.isOut)))){
if (Collisions.checkColl(_local5, _local7)){
Collisions.doResponse(_local5, _local7);
_local8 = (((Math.abs(_local5.vx) + Math.abs(_local5.vy)) + Math.abs(_local7.vx)) + Math.abs(_local7.vy));
if (_local8 > 3){
_local9 = (_local8 * 0.03);
Debug.print(("collision volume: " + _local9));
_local10 = Math.random();
if (_local10 < 0.33){
Main.getInstance().soundManager.getByClass(Main.getInstance().SndCollision1, "snd_collision1").play(_local9);
} else {
if (_local10 < 0.66){
Main.getInstance().soundManager.getByClass(Main.getInstance().SndCollision2, "snd_collision2").play(_local9);
} else {
Main.getInstance().soundManager.getByClass(Main.getInstance().SndCollision3, "snd_collision3").play(_local9);
};
};
};
};
};
_local6++;
};
if (!board.containsPoint(_local5.px, _local5.py)){
if (!_local5.isOut){
_local5.isOut = true;
if (phase == PHASE_MAINGAME){
scoreCounter.ballOut(_local5);
};
_local5.fadeOut();
};
};
if (phase == PHASE_SKILLSHOT){
if (_local5.ownerId == 2){
if ((_local5.px - _local5.r) < Board.GAME_AREA_CENTER.x){
_local5.vx = (_local5.vy = 0);
_local5.fadeOut();
_local5.isOut = true;
};
} else {
if (_local5.ownerId == 1){
if ((_local5.px + _local5.r) > Board.GAME_AREA_CENTER.x){
_local5.vx = (_local5.vy = 0);
_local5.fadeOut();
_local5.isOut = true;
};
};
};
};
_local3 = (_local3 + (Math.abs(_local5.vx) + Math.abs(_local5.vy)));
};
_local4++;
};
};
if ((((_local3 < 0.05)) && (_ballsAreMoving))){
_ballsStill++;
if (_ballsStill > 9){
Debug.print(("balls stopped at tick: " + Main.tick), "33FF88");
Main.getInstance().comm.sendLog((("turn played on client, " + _ticksThisTurn) + " ticks"));
_ballsAreMoving = false;
_ballsStill = 0;
_ticksThisTurn = 0;
if (phase == PHASE_SKILLSHOT){
if (_shots > 1){
phase = PHASE_IDLE;
setTimeout(MarbleEvents.executeCue, 1500);
};
} else {
if (phase == PHASE_MAINGAME){
if (_shots > 0){
setTimeout(MarbleEvents.executeCue, 500);
};
};
};
};
};
Main.getInstance().comm.tick();
}
public function getHasGameStarted():Boolean{
return (_gameHasStarted);
}
public function stopGame():void{
clearTimeout(_timeOutId);
enableBalls(false);
stopTime();
_player1TimeIndicator.setPercent(0);
_player2TimeIndicator.setPercent(0);
if (_exitBtn){
if (_exitBtn.parent){
_exitBtn.parent.removeChild(_exitBtn);
};
};
}
public function getChecksum():Number{
var _local3:Ball;
var _local1:Number = 0;
var _local2:int;
while (_local2 < _balls.length) {
_local3 = _balls[_local2];
_local1 = (_local1 + (_local3.px + _local3.py));
_local2++;
};
return (_local1);
}
public function onTurnEnd():void{
phase = PHASE_IDLE;
enableBalls(false);
if (opponentAim.alpha > 0){
opponentAim.hide();
};
}
private function addBall(_arg1:int, _arg2:int, _arg3:int, _arg4:Boolean=true, _arg5:Number=0):Ball{
var _local6:Ball = new Ball(_arg3);
_local6.px = _arg1;
_local6.py = _arg2;
if (Game.playerId == _arg3){
_local6.setInteractive(_arg4);
};
var _local7:Shape = new Shape();
addChild(_local7);
_local6.setShadow(_local7);
_local6.fadeUp(_arg5);
_balls.push(_local6);
return (_local6);
}
private function timeOut():void{
var _local1:ShortMessage;
input.abortShooting();
enableBalls(false);
Debug.print("Game.timeOut() turn timed out!", "ffffff");
Main.getInstance().soundManager.getByClass(Main.getInstance().SndTimeout, "snd_time_out").play(0.5);
if (_timesTimedOut >= 3){
if ((((((phase == PHASE_SKILLSHOT)) && ((playerId == 1)))) && ((_timesTimedOut == 3)))){
Main.getInstance().comm.shootBall(-1, new Point());
shootBallDo(-1, new Point());
_timesTimedOut++;
return;
};
scoreCounter.playerDisconnectedOrForfeited(Game.playerId);
Main.getInstance().comm.forfeitGame();
_local1 = new ShortMessage(TextMappings.get("your_have_forfeited"));
_local1.x = (Main.W / 2);
_local1.y = (Main.H / 2);
_local1.show();
addChild(_local1);
} else {
Main.getInstance().comm.shootBall(-1, new Point());
shootBallDo(-1, new Point());
};
_timesTimedOut++;
}
public function shootBall(_arg1:Ball, _arg2:Point):void{
var _local3:Point = Board.flipVector(_arg2);
_local3.x = (Math.round((_local3.x * 10000)) / 10000);
_local3.y = (Math.round((_local3.y * 10000)) / 10000);
Main.getInstance().comm.shootBall(_arg1.id, _local3);
shootBallDo(_arg1.id, _local3);
clearTimeout(_timeOutId);
_timesTimedOut = 0;
}
public function onNewRound():void{
phase = PHASE_MAINGAME;
_shots = 0;
roundId++;
setupBoard();
board.showSkillShotStuff(false);
Main.getInstance().comm.sendStartTurn();
Main.getInstance().soundManager.getByClass(Main.getInstance().SndNewRound, "snd_new_round").play(0.5);
if (_exitBtn == null){
_exitBtn = new BitmapButton();
_exitBtn.setBitmap(BitmapDispenser.getBitmapData("btn_exit"));
_exitBtn.setActive(true, Main.getInstance().onExitBtn);
_exitBtn.x = 708;
_exitBtn.y = 535;
addChild(_exitBtn);
};
}
public function startTime():void{
_timer.start();
}
private function addBallsToDisplay():void{
var _local2:Ball;
var _local1:int;
while (_local1 < _balls.length) {
_local2 = _balls[_local1];
_local2.onUpdate();
addChild(_local2);
_local1++;
};
}
public function onNewTurn():void{
var _local2:String;
_shots = 0;
turnId++;
phase = PHASE_MAINGAME;
if (turnOwner == 1){
_player1TimeIndicator.animate(TURN_MAX_TIME, 0, 1);
} else {
_player2TimeIndicator.animate(TURN_MAX_TIME, 0, 1);
};
var _local1:Comm = Main.getInstance().comm;
if (turnOwner == playerId){
enableBalls(true);
_timeOutId = setTimeout(timeOut, TURN_MAX_TIME);
_local2 = _local1.playerSelf.name;
Main.getInstance().soundManager.getByClass(Main.getInstance().SndYourTurn, "snd_your_turn").play(0.5);
} else {
enableBalls(false);
_local2 = _local1.playerOpponent.name;
};
var _local3:ShortMessage = new ShortMessage(TextMappings.get("new_turn").split("{0}").join(_local2));
_local3.x = (Main.W / 2);
_local3.y = (Main.H / 2);
_local3.show();
addChild(_local3);
}
public function onSkillShot():void{
if (!_gameHasStarted){
fscommand("gameStart", "");
_waitingMsg.hide();
_waitingMsg = null;
removeReadyButton();
Main.getInstance().comm.sendLog(("this flash client version 080126 14:07 randomseed: " + Main.getInstance().parsedGameData.randomSeed));
};
_gameHasStarted = true;
_timeOutId = setTimeout(timeOut, SKILLSHOT_MAX_TIME);
phase = PHASE_SKILLSHOT;
setupSkillShotBoard();
_ballsStill = 0;
_shots = 0;
}
public function getBallById(_arg1:int):Ball{
var _local3:Ball;
var _local2:int;
while (_local2 < _balls.length) {
_local3 = _balls[_local2];
if (_local3.id == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
public function onInitData():void{
var _local2:Client;
var _local3:Client;
startTime();
var _local1:Comm = Main.getInstance().comm;
if (_local1.playerSelf.playerId == 1){
_local2 = _local1.playerSelf;
_local3 = _local1.playerOpponent;
} else {
if (_local1.playerSelf.playerId == 2){
_local3 = _local1.playerSelf;
_local2 = _local1.playerOpponent;
};
};
if (_local1.playerSelf.playerId == 1){
player1Score = new ScoreBoard(true);
player2Score = new ScoreBoard(false);
player1Score.x = 22;
player1Score.y = 19;
player2Score.x = 635;
player2Score.y = 19;
_player1TimeIndicator = new TimeIndicator(1);
_player2TimeIndicator = new TimeIndicator(2);
_player1TimeIndicator.x = 45;
_player1TimeIndicator.y = 384;
_player2TimeIndicator.x = 657;
_player2TimeIndicator.y = 384;
} else {
player1Score = new ScoreBoard(false);
player2Score = new ScoreBoard(true);
player2Score.x = 22;
player2Score.y = 19;
player1Score.x = 635;
player1Score.y = 19;
_player1TimeIndicator = new TimeIndicator(2);
_player2TimeIndicator = new TimeIndicator(1);
_player2TimeIndicator.x = 45;
_player2TimeIndicator.y = 384;
_player1TimeIndicator.x = 657;
_player1TimeIndicator.y = 384;
};
addChild(player1Score);
addChild(player2Score);
addChild(_player1TimeIndicator);
addChild(_player2TimeIndicator);
addChild(chatInput);
player1Score.setPlayer(_local2.name, _local2.avatar);
player2Score.setPlayer(_local3.name, _local3.avatar);
if (((!(_readyBtnPressed)) && (!(scoreCounter.hasPlayerDisconnectedOrForfeited)))){
addChild(_readyButton);
};
}
private function setupBoard():void{
var _local1:int;
cleanBoard();
board.showSkillShotStuff(false);
var _local2 = 60;
var _local3:int = (7 - scoreCounter.pl1Wins);
var _local4:int = (7 - scoreCounter.pl2Wins);
var _local5:int = ((Board.GAME_AREA.y + 25) + (scoreCounter.pl1Wins * 50));
var _local6:int = (((Board.GAME_AREA.y + Board.GAME_AREA.height) - 25) - (scoreCounter.pl2Wins * 50));
_local1 = (Board.GAME_AREA_CENTER.x - (((_local3 - 1) * _local2) / 2));
var _local7:int;
while (_local7 < _local3) {
addBall(_local1, _local5, 1, true, (_local7 * 0.1));
_local1 = (_local1 + 60);
_local7++;
};
_local1 = (Board.GAME_AREA_CENTER.x - (((_local4 - 1) * _local2) / 2));
_local7 = 0;
while (_local7 < _local4) {
addBall(_local1, _local6, 2, true, (_local7 * 0.1));
_local1 = (_local1 + 60);
_local7++;
};
enableBalls(true);
addBallsToDisplay();
}
public function stopTime():void{
_timer.stop();
}
private function onReadyButtonPressed(_arg1:BasicButton=null):void{
if (((_readyBtnPressed) || (scoreCounter.hasPlayerDisconnectedOrForfeited))){
return;
};
_readyBtnPressed = true;
Main.getInstance().comm.sendRandomSeed();
addChild(_waitingMsg);
_waitingMsg.alpha = 0;
TweenLite.to(_waitingMsg, 0.75, {alpha:1, delay:1});
removeReadyButton();
}
public function shootBallDo(_arg1:int, _arg2:Point):void{
_shots++;
if (turnOwner == 1){
_player1TimeIndicator.setPercent(0);
} else {
_player2TimeIndicator.setPercent(0);
};
if (_arg1 < 0){
setTimeout(MarbleEvents.executeCue, 500);
return;
};
Debug.print(("Game.shootBall() " + _shots), "33FF55");
var _local3:Ball = getBallById(_arg1);
if (_local3 != null){
_local3.vx = _arg2.x;
_local3.vy = _arg2.y;
if (opponentAim.alpha > 0){
opponentAim.hide();
};
_ballsAreMoving = true;
_ballsStill = 0;
} else {
Debug.print(("Game.shootBallDo() err balls not found, id: " + _arg1), "ff3333");
};
}
public function onRoundEnd():void{
phase = PHASE_IDLE;
if (roundId == 4){
Debug.print("==== E N D G A M E ====", "FFFFFF");
setTimeout(Main.getInstance().comm.sendEndGame, 100);
phase = PHASE_OUTRO;
} else {
setTimeout(Main.getInstance().comm.sendStartRound, 1500);
};
}
public static function getInstance():Game{
return (_this);
}
}
}//package com.king.marble.game
Section 14
//Input (com.king.marble.game.Input)
package com.king.marble.game {
import com.king.marble.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import com.king.marble.utils.*;
public class Input {
private var _oppVec:Point;
private var _arrow:Arrow;
private var _endPos:Point;
private var _lastSentTime:int;// = 0
private var _ball:Ball;
private var _opponentAim:Arrow;
private var _oppScaleAim:Number;// = 0
private var _aimVec:Point;
private var _startPos:Point;
private var _oppRotAim:Number;// = 0
private static var _isKeyDown:Boolean = false;
public function Input(_arg1:Arrow, _arg2:Arrow){
_startPos = new Point();
_endPos = new Point();
super();
_arrow = _arg1;
_opponentAim = _arg2;
Main.getInstance().stage.addEventListener(MouseEvent.MOUSE_UP, shootBall, false, 0, true);
Main.getInstance().stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false, 0, true);
Main.getInstance().stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp, false, 0, true);
Main.getInstance().stage.addEventListener(Event.ENTER_FRAME, updateOpponentAim, false, 0, true);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
_isKeyDown = true;
}
private function shootBall(_arg1:MouseEvent):void{
if (_ball == null){
return;
};
Main.getInstance().stage.removeEventListener(Event.ENTER_FRAME, onEnterFrm);
_arrow.hide();
var _local2:Number = Main.getInstance().stage.mouseX;
var _local3:Number = Main.getInstance().stage.mouseY;
var _local4:int;
while (_local4 < 10) {
if (_local2 != Main.getInstance().stage.mouseX){
Debug.print(((("Err mouseX broken, :" + _local2) + " != ") + Main.getInstance().stage.mouseX), "ff3333");
};
if (_local3 != Main.getInstance().stage.mouseY){
Debug.print(((("Err mouseY broken, :" + _local3) + " != ") + Main.getInstance().stage.mouseY), "ff3333");
};
_local2 = Main.getInstance().stage.mouseX;
_local3 = Main.getInstance().stage.mouseY;
_local4++;
};
_endPos.x = _local2;
_endPos.y = _local3;
var _local5:Number = Math.min((MathExtra.getDistanceBetweenPoints(_startPos, _endPos) * 0.5), 50);
var _local6:Number = MathExtra.getAngleBetweenPoints(_startPos, _endPos);
var _local7:Point = MathExtra.getPointByAngleAndDistance(_local5, _local6);
MathExtra.getPointByAngleAndDistance(_local5, _local6).x = (-(_local7.x) * 0.75);
_local7.y = (-(_local7.y) * 0.75);
if (_local5 > (25 * 0.5)){
Game.getInstance().shootBall(_ball, _local7);
} else {
Game.getInstance().enableBalls(true);
Main.getInstance().comm.sendAim(-1, new Point());
};
_ball = null;
}
public function startShootBall(_arg1:Ball):void{
_ball = _arg1;
_arrow.x = _arg1.x;
_arrow.y = _arg1.y;
_arrow.show();
_startPos.x = _arg1.x;
_startPos.y = _arg1.y;
Main.getInstance().stage.addEventListener(Event.ENTER_FRAME, onEnterFrm, false, 0, true);
Game.getInstance().enableBalls(false);
}
private function updateOpponentAim(_arg1:Event):void{
if (_opponentAim.alpha == 0){
return;
};
var _local2:Number = (_aimVec.x - _oppVec.x);
var _local3:Number = (_aimVec.y - _oppVec.y);
_oppVec.x = (_oppVec.x + (_local2 * 0.1));
_oppVec.y = (_oppVec.y + (_local3 * 0.1));
var _local4:Point = new Point(_opponentAim.x, _opponentAim.y);
_opponentAim.rotation = (180 + MathExtra.getAngleBetweenPoints(_local4, _oppVec));
var _local5:Number = Math.min((MathExtra.getDistanceBetweenPoints(_local4, _oppVec) * 0.5), 50);
_opponentAim.scaleX = (0.5 + (_local5 * 0.02));
}
public function setOpponentAim(_arg1:int, _arg2:Point):void{
if (_arg1 == -1){
_opponentAim.hide();
return;
};
_aimVec = Board.fromGameCordsToDisplayCords(_arg2);
if (_opponentAim.alpha == 0){
_opponentAim.show();
_oppVec = _aimVec;
};
var _local3:Ball = Game.getInstance().getBallById(_arg1);
_opponentAim.x = _local3.x;
_opponentAim.y = _local3.y;
}
private function onEnterFrm(_arg1:Event):void{
var _local3:Point;
if (_ball == null){
return;
};
_endPos.x = Main.getInstance().stage.mouseX;
_endPos.y = Main.getInstance().stage.mouseY;
_arrow.rotation = (180 + MathExtra.getAngleBetweenPoints(_startPos, _endPos));
var _local2:Number = Math.min((MathExtra.getDistanceBetweenPoints(_startPos, _endPos) * 0.5), 50);
_arrow.scaleX = (0.5 + (_local2 * 0.02));
if ((getTimer() - _lastSentTime) > 500){
_local3 = Board.fromDisplayCordsToGameCords(_endPos);
Main.getInstance().comm.sendAim(_ball.id, _local3);
_lastSentTime = getTimer();
};
}
public function abortShooting():void{
if (_ball != null){
Main.getInstance().stage.removeEventListener(Event.ENTER_FRAME, onEnterFrm);
_arrow.hide();
_ball = null;
};
}
private function onKeyUp(_arg1:KeyboardEvent):void{
_isKeyDown = false;
}
public static function isKeyDown():Boolean{
return (_isKeyDown);
}
}
}//package com.king.marble.game
Section 15
//SkillShotTarget (com.king.marble.game.SkillShotTarget)
package com.king.marble.game {
import flash.display.*;
import com.king.marble.data.*;
public class SkillShotTarget extends Sprite {
public var px:Number;
public var py:Number;
public function SkillShotTarget(_arg1:int){
var _local2:Bitmap = new Bitmap(BitmapDispenser.getBitmapData("start_target"));
_local2.x = (-(_local2.width) / 2);
_local2.y = (-(_local2.height) / 2);
addChild(_local2);
}
}
}//package com.king.marble.game
Section 16
//BasicButton (com.king.marble.gui.BasicButton)
package com.king.marble.gui {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
public class BasicButton extends Sprite {
protected var _enabled:Boolean;
protected var _callBack:Function;
protected var _mouseIsDown:Boolean;// = false
protected var _label:StdLabel;
public function BasicButton(){
mouseChildren = false;
_label = new StdLabel();
addChild(_label);
}
protected function onMouseDown(_arg1:Event):void{
drawMain("down");
_mouseIsDown = true;
}
protected function onMouseUp(_arg1:Event):void{
drawMain("over");
if (((!((_callBack == null))) && (_mouseIsDown))){
_callBack(this);
};
_mouseIsDown = false;
}
public function draw():void{
graphics.clear();
graphics.beginFill(0, 0.2);
graphics.drawRoundRect(0, 0, 100, 20, 10, 10);
_label.x = ((100 / 2) - (_label.width / 2));
_label.y = ((20 / 2) - (_label.height / 2));
drawMain("idle");
}
public function setActive(_arg1:Boolean=true, _arg2:Function=null):void{
if (_arg1){
if (!hasEventListener(MouseEvent.MOUSE_UP)){
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
};
if (_arg2 != null){
_callBack = _arg2;
};
_enabled = true;
alpha = 1;
} else {
removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_enabled = false;
alpha = 0.4;
};
buttonMode = _arg1;
}
protected function onMouseOut(_arg1:Event):void{
drawMain("idle");
_mouseIsDown = false;
}
protected function onMouseOver(_arg1:Event):void{
drawMain("over");
}
protected function drawMain(_arg1:String):void{
if (_arg1 == "over"){
filters = [new GlowFilter(0, 1, 4, 4, 1)];
} else {
filters = [];
};
}
public function getLabel():StdLabel{
return (_label);
}
}
}//package com.king.marble.gui
Section 17
//BitmapButton (com.king.marble.gui.BitmapButton)
package com.king.marble.gui {
import flash.geom.*;
import flash.display.*;
import flash.filters.*;
public class BitmapButton extends BasicButton {
private var _bitmap:Bitmap;
public function setBitmap(_arg1:BitmapData):void{
if (_bitmap == null){
_bitmap = new Bitmap(_arg1);
addChild(_bitmap);
} else {
_bitmap.bitmapData = _arg1;
};
}
override public function draw():void{
}
override protected function drawMain(_arg1:String):void{
if (_arg1 == "over"){
filters = [new GlowFilter(0, 1, 4, 4, 1)];
transform.colorTransform = new ColorTransform(1.15, 1.15, 1.15);
} else {
filters = [];
transform.colorTransform = new ColorTransform();
};
}
}
}//package com.king.marble.gui
Section 18
//ChatBubble (com.king.marble.gui.ChatBubble)
package com.king.marble.gui {
import flash.display.*;
import gs.*;
import flash.utils.*;
import flash.text.*;
import com.king.marble.data.*;
import gs.easing.*;
public class ChatBubble extends Sprite {
public function ChatBubble(_arg1:String, _arg2:Boolean){
var _local3:Bitmap = new Bitmap(BitmapDispenser.getBitmapData("speech_bubble"));
_local3.y = -(_local3.height);
var _local4:StdLabel = new StdLabel(StdLabel.font1, 11, 0x333333);
_local4.autoSize = TextFieldAutoSize.NONE;
_local4.multiline = true;
_local4.wordWrap = true;
_local4.width = 130;
_local4.height = 110;
_local4.x = 15;
_local4.y = -100;
_local4.text = _arg1;
addChild(_local3);
addChild(_local4);
if (_arg2){
x = 90;
} else {
x = 10;
_local3.scaleX = -1;
_local4.x = (_local4.x - 154);
};
y = 100;
}
public function destroy():void{
if (parent){
parent.removeChild(this);
};
}
public function hide():void{
TweenLite.to(this, 1, {alpha:0.1, onComplete:destroy});
}
public function show():void{
alpha = 0.1;
scaleX = 0.4;
scaleY = 0.4;
TweenLite.to(this, 0.6, {alpha:1, scaleX:1, scaleY:1, ease:Elastic.easeOut});
setTimeout(hide, 3500);
}
}
}//package com.king.marble.gui
Section 19
//DebugWindow (com.king.marble.gui.DebugWindow)
package com.king.marble.gui {
import com.king.marble.*;
import flash.events.*;
import flash.display.*;
import com.king.marble.utils.*;
import flash.text.*;
import flash.system.*;
public class DebugWindow extends Sprite {
private var _tf:TextField;
private var _text:Array;
public function DebugWindow(){
var _local3:Sprite;
_text = [];
super();
var _local1:TextFormat = new TextFormat();
_local1.size = 9;
_local1.font = "Verdana";
_tf = new TextField();
_tf.wordWrap = true;
_tf.multiline = true;
_tf.x = 5;
_tf.y = 15;
_tf.width = (325 + 150);
_tf.height = 460;
_tf.defaultTextFormat = _local1;
_tf.textColor = 0xAAAAAA;
addChild(_tf);
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 0.6);
graphics.drawRect(0, 0, 330, 460);
var _local2:Sprite = new Sprite();
_local2.graphics.lineStyle(1, 0, 1);
_local2.graphics.beginFill(0xCCCCCC, 0.75);
_local2.graphics.drawRect(0, 0, 330, 10);
_local2.buttonMode = true;
addChild(_local2);
_local2.addEventListener(MouseEvent.MOUSE_DOWN, onClicked, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_UP, onReleased, false, 0, true);
_local3 = new Sprite();
_local3.x = 310;
_local3.y = 0;
_local3.graphics.lineStyle(1, 0, 1);
_local3.graphics.beginFill(0xFFFFFF);
_local3.graphics.drawRect(0, 0, 20, 10);
_local3.buttonMode = true;
_local3.addEventListener(MouseEvent.MOUSE_DOWN, copyText, false, 0, true);
addChild(_local3);
}
private function copyText(_arg1:MouseEvent):void{
var _local2 = "";
var _local3:int;
while (_local3 < _text.length) {
_local2 = (_local2 + (_text[_local3] + "\n"));
_local3++;
};
System.setClipboard(_local2);
print("DebugWindow.copyText() content copied to clipboard", null);
}
private function onReleased(_arg1:MouseEvent):void{
stopDrag();
}
public function print(_arg1:String, _arg2:String):void{
var _local5:String;
if (_arg2 != null){
if (_arg2.toLowerCase() == "ff3333"){
Main.getInstance().addChild(this);
};
};
_arg1.split("<").join("{");
_arg1.split(">").join("}");
var _local3:Date = new Date();
var _local4:String = ((((_local3.getHours() + ":") + Formatter.addZero(_local3.getMinutes())) + ":") + Formatter.addZero(_local3.getSeconds()));
if (_arg2 != null){
_local5 = (((((("<b>" + _local4) + " - </b><font color=\"#") + _arg2) + "\">") + _arg1) + "</font>");
} else {
_local5 = ((("<b>" + _local4) + " - </b>") + _arg1);
};
_text.push(_local5);
if (_tf.numLines > 32){
_text.shift();
};
var _local6 = "";
var _local7:int;
while (_local7 < _text.length) {
_local6 = (_local6 + (_text[_local7] + "\n"));
_local7++;
};
_tf.htmlText = _local6;
}
private function onClicked(_arg1:MouseEvent):void{
startDrag();
}
}
}//package com.king.marble.gui
Section 20
//PopupMsg (com.king.marble.gui.PopupMsg)
package com.king.marble.gui {
import com.king.marble.*;
import flash.events.*;
import flash.display.*;
import gs.*;
import com.king.marble.data.*;
import flash.filters.*;
public class PopupMsg extends Sprite {
public var closable:Boolean;// = true
private static var msgId:int = 0;
private static var _lastPopup:PopupMsg;
public function PopupMsg(_arg1:String, _arg2:String){
var _local3:Bitmap = new Bitmap(BitmapDispenser.getBitmapData("info_frame"));
addChild(_local3);
var _local4:StdLabel = new StdLabel(StdLabel.font2, 20);
_local4.text = _arg1;
_local4.x = (267 - (_local4.width / 2));
_local4.y = 65;
addChild(_local4);
var _local5:StdLabel = new StdLabel(StdLabel.font2, 16);
_local5.width = 370;
_local5.multiline = true;
_local5.wordWrap = true;
_local5.text = _arg2;
_local5.x = 70;
_local5.y = 110;
addChild(_local5);
filters = [new GlowFilter(0, 0.5, 8, 8)];
addEventListener(MouseEvent.CLICK, close, false, 0, true);
buttonMode = true;
}
public function addDisplayObject(_arg1:DisplayObject, _arg2:Number, _arg3:Number):void{
addChildAt(_arg1, 1);
_arg1.x = _arg2;
_arg1.y = _arg3;
}
public function close(_arg1:MouseEvent):void{
if (!closable){
return;
};
if (parent){
parent.removeChild(this);
};
msgId--;
_lastPopup = null;
}
public static function openPopupMsg(_arg1:DisplayObjectContainer, _arg2:String, _arg3:String):PopupMsg{
if (_lastPopup != null){
_lastPopup.close(null);
};
var _local4:PopupMsg = new PopupMsg(_arg2, _arg3);
_arg1.addChild(_local4);
_local4.x = (((Main.W / 2) - (_local4.width / 2)) + (msgId * 15));
_local4.y = (((Main.H / 2) - (_local4.height / 2)) + (msgId * 15));
TweenLite.from(_local4, 0.5, {y:(_local4.y - 10), alpha:0});
_lastPopup = _local4;
msgId++;
return (_local4);
}
}
}//package com.king.marble.gui
Section 21
//ScoreBoard (com.king.marble.gui.ScoreBoard)
package com.king.marble.gui {
import com.king.marble.*;
import flash.events.*;
import com.king.marble.comm.*;
import flash.display.*;
import com.king.marble.game.*;
import flash.utils.*;
import com.king.marble.utils.*;
import flash.text.*;
import flash.system.*;
import com.king.marble.data.*;
import com.midasplayer.avatar.*;
import flash.filters.*;
public class ScoreBoard extends Sprite implements MarbleListener {
private var _avatarMood:String;// = "neutral"
private var _addedScore:StdLabel;
private var _oldScore:StdLabel;
private var _avatarString:String;
private var _playerName:StdLabel;
private var _roundScore:int;// = 0
private var _total:int;// = 0
private var _flipAvatar:Boolean;
private var _totalScore:StdLabel;
private var _moodDelay:uint;
private var _dotHolder:Sprite;
private var _new:int;// = 0
private var _old:int;// = 0
private var _avatar;
private static var avatarLoader:AvatarLoader;
public function ScoreBoard(_arg1:Boolean){
var _local2:StdLabel;
super();
_flipAvatar = _arg1;
MarbleEvents.addListener(this);
_playerName = new StdLabel(StdLabel.font2, 15, 0xFFFFFF);
_playerName.text = "";
_playerName.x = ((103 / 2) - (_playerName.width / 2));
_playerName.y = 120;
_playerName.filters = [new GlowFilter(0, 0.75, 6, 6)];
addChild(_playerName);
_local2 = new StdLabel(StdLabel.font2, 15, 0xFFFFFF);
_local2.text = TextMappings.get("wins");
_local2.x = ((103 / 2) - (_local2.width / 2));
_local2.y = 162;
_local2.filters = [new GlowFilter(0, 0.75, 6, 6)];
addChild(_local2);
_dotHolder = new Sprite();
_dotHolder.x = 4;
_dotHolder.y = 193;
addChild(_dotHolder);
var _local3 = 234;
var _local4:StdLabel = new StdLabel(StdLabel.font3, (23 - 4), 0xFFFFFF);
_local4.filters = [new GlowFilter(0xFFFFFF, 1, 1, 1, 1)];
_local4.text = TextMappings.get("score_title");
_local4.x = ((103 / 2) - (_local4.width / 2));
_local4.y = 234;
_local4.alpha = 0.8;
addChild(_local4);
_local3 = (_local3 + 30);
_oldScore = new StdLabel(StdLabel.font3, (23 - 4), 0xFFFFFF);
_oldScore.filters = [new GlowFilter(0xFFFFFF, 1, 1, 1, 1)];
_oldScore.autoSize = TextFieldAutoSize.RIGHT;
_oldScore.x = 75;
_oldScore.y = _local3;
_oldScore.alpha = 0.8;
addChild(_oldScore);
_local3 = (_local3 + 18);
_addedScore = new StdLabel(StdLabel.font3, (23 - 4), 0xFFFFFF);
_addedScore.filters = [new GlowFilter(0xFFFFFF, 1, 1, 1, 1)];
_addedScore.autoSize = TextFieldAutoSize.RIGHT;
_addedScore.x = 75;
_addedScore.y = _local3;
_addedScore.alpha = 0.8;
addChild(_addedScore);
_local3 = (_local3 + 33);
_totalScore = new StdLabel(StdLabel.font3, (23 - 4), 0xFFFFFF);
_totalScore.filters = [new GlowFilter(0xFFFFFF, 1, 1, 1, 1)];
_totalScore.autoSize = TextFieldAutoSize.RIGHT;
_totalScore.x = 75;
_totalScore.y = _local3;
_totalScore.alpha = 0.8;
_totalScore.text = ("" + _total);
addChild(_totalScore);
}
public function onGameFinished():void{
}
public function chatMessage(_arg1:int, _arg2:String):void{
var _local3:ChatBubble = new ChatBubble(_arg2, _flipAvatar);
_local3.show();
_local3.x = (_local3.x + x);
_local3.y = (_local3.y + y);
Game.getInstance().addChild(_local3);
}
public function setWins(_arg1:int):void{
var _local3:Bitmap;
while (_dotHolder.numChildren > 0) {
_dotHolder.removeChildAt(0);
};
var _local2:int;
while (_local2 < _arg1) {
_local3 = new Bitmap(BitmapDispenser.getBitmapData("win_marker"));
_local3.x = (_local2 * 25.5);
_local3.y = 5;
_dotHolder.addChild(_local3);
_local2++;
};
}
public function avatarLoadProgress(_arg1:Event):void{
Debug.print("Avatar loadeding....", "99FFFF");
}
public function setTotalScore(_arg1:int):void{
_total = _arg1;
_totalScore.text = ("" + _total);
}
private function avatarLoaded(_arg1:Event):void{
Game.getInstance().player1Score.createAvatar(_arg1);
Game.getInstance().player2Score.createAvatar(_arg1);
Debug.print("Avatar loaded", "99FFFF");
}
public function onTurnEnd():void{
}
public function onSkillShot():void{
}
public function onInitData():void{
}
public function onNewRound():void{
_roundScore = 0;
_old = _total;
_totalScore.text = ("" + _total);
_addedScore.text = ("" + _roundScore);
_oldScore.text = ("" + _old);
}
public function onNewTurn():void{
}
public function setPlayer(_arg1:String, _arg2:String):void{
_playerName.text = _arg1;
_playerName.x = ((103 / 2) - (_playerName.width / 2));
if ((((((avatarLoader == null)) && (!((Capabilities.playerType == "External"))))) && (!((Capabilities.playerType == "StandAlone"))))){
avatarLoader = new AvatarLoader();
avatarLoader.load(this.avatarLoaded, this.avatarLoadProgress);
Debug.print("Starting loading avatars....");
};
_avatarString = _arg2;
}
public function onSkillShotEnd():void{
}
public function addScore(_arg1:int):void{
_new = _arg1;
_total = (_total + _arg1);
_roundScore = (_roundScore + _arg1);
_totalScore.text = ("" + _total);
_addedScore.text = ("" + _roundScore);
_oldScore.text = ("" + _old);
}
public function setAvatarMood(_arg1:String):void{
if (_avatarMood != _arg1){
_avatarMood = _arg1;
_avatar.setMood(_arg1);
};
clearTimeout(_moodDelay);
_moodDelay = setTimeout(setAvatarNeutral, 2500);
}
public function onRoundEnd():void{
}
private function createAvatar(_arg1:Event):void{
var av:DisplayObject;
var event = _arg1;
try {
_avatar = event.target.content.getAvatar(_avatarString);
} catch(e1:Error) {
Debug.print(((((("createAvatar() : " + e1.errorID) + " ") + e1.message) + " ") + e1.name), "ff3333");
};
try {
av = (_avatar as Sprite);
av.scaleX = (_flipAvatar) ? -0.8 : 0.8;
av.scaleY = 0.8;
av.x = (_flipAvatar) ? (50 + (_avatar.getWidth() / 2)) : (50 - (_avatar.getWidth() / 2));
av.y = (70 - (_avatar.getHeight() / 2));
av.filters = [new GlowFilter(0, 0.75, 8, 8)];
addChild(av);
} catch(e2:Error) {
Debug.print(("createAvatar() : " + e2.toString()), "ff3333");
};
}
private function setAvatarNeutral():void{
setAvatarMood(AvatarMood.MOOD_NEUTRAL);
}
}
}//package com.king.marble.gui
Section 22
//ScorePop (com.king.marble.gui.ScorePop)
package com.king.marble.gui {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class ScorePop extends Sprite {
private var _lbl:StdLabel;
public function ScorePop(_arg1:int){
_lbl = new StdLabel(StdLabel.font2, Math.min((25 + int((_arg1 * 0.75))), 50), 0xFFFFFF);
_lbl.filters = [new GlowFilter(0xDD5500, 1, 4, 4, 3), new GlowFilter(0, 1, 6, 6, 1)];
_lbl.text = ("" + _arg1);
_lbl.x = (-(_lbl.width) / 2);
_lbl.y = (-(_lbl.height) / 2);
addChild(_lbl);
}
public function destroy():void{
if (parent){
parent.removeChild(this);
};
}
public function hide():void{
TweenLite.to(this, 0.75, {alpha:0.1, scaleX:0.9, scaleY:0.9, overwrite:0, onComplete:destroy});
}
public function show(_arg1:Number, _arg2:Number, _arg3:int=0):void{
alpha = 0;
scaleX = 0.4;
scaleY = 0.4;
rotation = (-10 + (Math.random() * 20));
if (_arg3 == 0){
TweenLite.to(this, 0.5, {alpha:1, scaleX:1, scaleY:1, overwrite:0, onComplete:hide});
TweenLite.to(this, 1.2, {x:(x + (_arg1 * 2)), y:(y + (_arg2 * 2)), overwrite:0});
} else {
TweenLite.to(this, 0.5, {alpha:1, scaleX:1, scaleY:1, overwrite:0, onComplete:hide, delay:(_arg3 / 1000)});
TweenLite.to(this, 1.2, {x:(x + (_arg1 * 2)), y:(y + (_arg2 * 2)), overwrite:0, delay:(_arg3 / 1000)});
};
}
}
}//package com.king.marble.gui
Section 23
//ShortMessage (com.king.marble.gui.ShortMessage)
package com.king.marble.gui {
import flash.display.*;
import gs.*;
import flash.filters.*;
public class ShortMessage extends Sprite {
private var _lbl:StdLabel;
public function ShortMessage(_arg1:String){
var _local2:int = (74 - _arg1.length);
_lbl = new StdLabel(StdLabel.font2, _local2, 0xFFFFFF);
_lbl.filters = [new GlowFilter(0xDD5500, 1, 4, 4, 3), new GlowFilter(0, 1, 6, 6, 1)];
_lbl.text = _arg1;
_lbl.x = (-(_lbl.width) / 2);
_lbl.y = (-(_lbl.height) / 2);
addChild(_lbl);
}
public function destroy():void{
if (parent){
parent.removeChild(this);
};
}
public function hide():void{
TweenLite.to(this, 1, {alpha:0, scaleX:0.9, scaleY:0.9, overwrite:0, onComplete:destroy});
}
public function show(_arg1:Boolean=true):void{
alpha = 0.1;
scaleX = 0.4;
scaleY = 0.4;
rotation = (-10 + (Math.random() * 20));
if (_arg1){
TweenLite.to(this, 0.75, {alpha:1, scaleX:1, scaleY:1, overwrite:0, onComplete:hide});
} else {
TweenLite.to(this, 0.75, {alpha:1, scaleX:1, scaleY:1, overwrite:0});
};
}
}
}//package com.king.marble.gui
Section 24
//StdLabel (com.king.marble.gui.StdLabel)
package com.king.marble.gui {
import flash.text.*;
public class StdLabel extends TextField {
public static const font1:String = "Verdana";
public static const font2:String = "impact";
public static const font3:String = "bradhitc";
public function StdLabel(_arg1:String="Verdana", _arg2:int=10, _arg3:uint=0){
var _local4:TextFormat = new TextFormat();
_local4.font = _arg1;
_local4.size = _arg2;
_local4.color = _arg3;
embedFonts = true;
defaultTextFormat = _local4;
selectable = false;
autoSize = TextFieldAutoSize.LEFT;
}
}
}//package com.king.marble.gui
Section 25
//TimeIndicator (com.king.marble.gui.TimeIndicator)
package com.king.marble.gui {
import flash.display.*;
import gs.*;
import flash.utils.*;
import com.king.marble.data.*;
import flash.filters.*;
public class TimeIndicator extends Sprite {
private var _timeLbl:StdLabel;
private var _mask:Shape;
private var _empty:Bitmap;
private var _timeLeft:int;
private var _full:Bitmap;
private var _fullH:int;// = 116
public function TimeIndicator(_arg1:int){
if (_arg1 == 1){
_empty = new Bitmap(BitmapDispenser.getBitmapData("time_l_e"));
_full = new Bitmap(BitmapDispenser.getBitmapData("time_l_f"));
} else {
_empty = new Bitmap(BitmapDispenser.getBitmapData("time_r_e"));
_full = new Bitmap(BitmapDispenser.getBitmapData("time_r_f"));
};
_mask = new Shape();
_mask.graphics.beginFill(0xFF0000);
_mask.graphics.drawRect(0, 0, 56, _fullH);
addChild(_empty);
addChild(_full);
addChild(_mask);
_full.mask = _mask;
_timeLbl = new StdLabel(StdLabel.font2, 26, 0xFFFFFF);
_timeLbl.x = ((_arg1 == 1)) ? (56 + 2) : (56 + 2);
_timeLbl.filters = [new GlowFilter(0xFFFFFF, 1, 4, 4, 1)];
addChild(_timeLbl);
setPercent(0);
}
public function animate(_arg1:int, _arg2:Number, _arg3:Number):void{
var _local4:int = (_fullH - (_arg2 * _fullH));
var _local5:int = (_fullH - ((_arg3 * _fullH) * 0.8));
_mask.y = _local4;
_timeLbl.y = (_local4 - 11);
_timeLeft = 10;
TweenLite.to(_mask, (_arg1 / 1000), {y:_local5});
TweenLite.to(_timeLbl, (_arg1 / 1000), {y:(_local5 - 11)});
updateLbl();
}
private function updateLbl():void{
_timeLbl.text = ("" + _timeLeft);
if (_timeLeft == 0){
_timeLbl.text = "";
};
if (_timeLeft > 0){
_timeLeft--;
setTimeout(updateLbl, 900);
};
}
public function setPercent(_arg1:Number):void{
var _local2:int = Math.min((_arg1 * _fullH), _fullH);
_mask.y = (_fullH - _local2);
if (_arg1 == 0){
_timeLbl.text = "";
_timeLeft = 0;
};
TweenLite.killTweensOf(_mask);
TweenLite.killTweensOf(_timeLbl);
}
}
}//package com.king.marble.gui
Section 26
//Debug (com.king.marble.utils.Debug)
package com.king.marble.utils {
import com.king.marble.gui.*;
import flash.system.*;
import flash.external.*;
public class Debug {
public static var enabled:Boolean = false;
public static var debugWindow:DebugWindow;
public static var useExternal:Boolean = false;
public static function printMem():void{
print((("MEM: " + (System.totalMemory / 1000000).toFixed(2)) + "mb"));
}
public static function printCapabilities():void{
print(("Capabilities.serverString: " + Capabilities.serverString), "AAAAFF");
}
public static function print(_arg1:String, _arg2:String=null):void{
if (!enabled){
return;
};
if (useExternal){
if (_arg2 == null){
ExternalInterface.call("jsPrintDebug", _arg1);
} else {
ExternalInterface.call("jsPrintDebug", _arg1, _arg2);
};
};
if (debugWindow != null){
debugWindow.print(_arg1, _arg2);
};
}
}
}//package com.king.marble.utils
Section 27
//Formatter (com.king.marble.utils.Formatter)
package com.king.marble.utils {
import flash.text.*;
public class Formatter {
public static var HOURS_PER_DAY:int = 8;
public static function formatDateNoTime(_arg1:Date):String{
return (((((_arg1.getFullYear() + "-") + addZero((_arg1.getMonth() + 1))) + "-") + addZero(_arg1.getDate())));
}
public static function formatTime(_arg1:Number):String{
return ("");
}
public static function shortenTextByLetters(_arg1:String, _arg2:int):String{
return ("");
}
public static function formatDate(_arg1:Date):String{
return (((((((((_arg1.getFullYear() + "-") + addZero((_arg1.getMonth() + 1))) + "-") + addZero(_arg1.getDate())) + " ") + addZero(_arg1.getHours())) + ":") + addZero(_arg1.getMinutes())));
}
public static function shortenTextByPixels(_arg1:TextField, _arg2:int):String{
return ("");
}
public static function addZero(_arg1:Number):String{
return (((_arg1 < 10)) ? ("0" + _arg1) : ("" + _arg1));
}
public static function formatDuration(_arg1:int):String{
var _local2:int = (_arg1 / HOURS_PER_DAY);
var _local3:int = (_arg1 - (_local2 * HOURS_PER_DAY));
return ((((_local2 + "d ") + _local3) + "h"));
}
}
}//package com.king.marble.utils
Section 28
//Integer64 (com.king.marble.utils.Integer64)
package com.king.marble.utils {
public class Integer64 {
private var p:Array;
private var r:Array;
private var s:Array;
public function Integer64(_arg1){
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (_arg1){
merge(_arg1);
};
}
public function binaryShiftRight(_arg1:Number):void{
var _local5:Number;
var _local6:Number;
var _local2:Number = ((_arg1 / 15) >> 0);
var _local3:Number = (_arg1 - (_local2 * 15));
var _local4:Number = (p.length - 1);
while (_local4 > 0) {
_local5 = 0;
while (_local5 < _local2) {
p[_local5] = p[(_local5 + 1)];
_local5++;
};
var _temp1 = _local4;
_local4 = (_local4 - 1);
var _local7 = _temp1;
p[_local7] = 0;
};
if (_local3 > 0){
_local6 = 0;
while (_local6 < _local3) {
shr();
_local6++;
};
};
}
public function mul32(_arg1:Number):void{
mul64(new Integer64(_arg1));
}
public function add32(_arg1:Number):void{
var _local2:Number = 0;
var _local3:Number = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
var _local4:Number = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
var _local5:Number = (_arg1 & 3);
_local2 = (_local2 + (p[0] + _local3));
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (p[1] + _local4));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (p[2] + _local5));
p[2] = (_local2 & 32767);
}
public function binaryShiftLeft(_arg1:Number):void{
var _local2:int;
while (_local2 < _arg1) {
shl();
_local2++;
};
}
public function mul64(_arg1:Integer64):void{
var _local4:Number;
var _local2:Number = 0;
var _local3:int;
while (_local3 < 5) {
_local4 = _arg1.p[_local3];
_local2 = (_local4 * p[0]);
r[_local3][0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[1]));
r[_local3][1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[2]));
r[_local3][2] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[3]));
r[_local3][3] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[4]));
r[_local3][4] = (_local2 & 32767);
_local3++;
};
_local2 = r[0][0];
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (r[0][1] + r[1][0]));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((r[0][2] + r[1][1]) + r[2][0]));
p[2] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]));
p[3] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]));
p[4] = (_local2 & 7);
}
private function shr():void{
var _local1:Number = 0;
var _local2:Number = 0;
var _local3:int = (p.length - 1);
while (_local3 >= 0) {
_local1 = ((p[_local3] & 1) << 14);
p[_local3] = (p[_local3] >> 1);
p[_local3] = ((p[_local3] | _local2) & 32767);
_local3--;
_local2 = _local1;
};
}
public function init32(_arg1:Number):void{
p[0] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
p[1] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
p[2] = (_arg1 & 3);
p[3] = 0;
p[4] = 0;
}
public function init(_arg1:Integer64):void{
var _local2:int;
while (_local2 < p.length) {
p[_local2] = _arg1.p[_local2];
_local2++;
};
}
private function merge(_arg1:Number):Number{
var _local2:int;
while (_local2 < 3) {
p[_local2] = (p[_local2] + (_arg1 & 32767));
_arg1 = (_arg1 >>> 15);
_local2++;
};
return (_arg1);
}
public function binaryNot(_arg1:Integer64):void{
p[0] = (p[0] ^ _arg1.p[0]);
p[1] = (p[1] ^ _arg1.p[1]);
p[2] = (p[2] ^ _arg1.p[2]);
p[3] = (p[3] ^ _arg1.p[3]);
p[4] = (p[4] ^ _arg1.p[4]);
}
public function get lsb():Number{
return (((p[0] | (p[1] << 15)) | ((p[2] & 3) << 30)));
}
public function get msb():Number{
return (((((p[2] >> 2) | ((p[3] << 15) >> 2)) | ((p[4] << (15 * 2)) >> 2)) & 2147483647));
}
public function mulu32(_arg1:Number):void{
var _local4:Number;
var _local2:Number = 0;
s[0] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[1] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[2] = (_arg1 & 3);
var _local3:int;
while (_local3 < 3) {
_local4 = s[_local3];
_local2 = (_local4 * p[0]);
r[_local3][0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[1]));
r[_local3][1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[2]));
r[_local3][2] = (_local2 & 3);
_local3++;
};
_local2 = r[0][0];
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (r[0][1] + r[1][0]));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((r[0][2] + r[1][1]) + r[2][0]));
p[2] = (_local2 & 3);
p[3] = 0;
p[4] = 0;
}
private function shl():void{
var _local1:Number = 0;
var _local2:Number = 0;
var _local3:int;
var _local4:int = p.length;
while (_local3 < _local4) {
_local1 = ((p[_local3] & 0x4000) >> 14);
p[_local3] = (p[_local3] << 1);
p[_local3] = ((p[_local3] | _local2) & 32767);
_local3++;
_local2 = _local1;
};
}
public function add64(_arg1:Integer64):void{
var _local2:Number = 0;
var _local3:Number = 1;
var _local4:Number = 0;
while ((((_local3 < p.length)) && (!((_arg1.p[_local4] == 0))))) {
_local3++;
};
_local4 = 0;
while (_local4 < _local3) {
_local2 = (_local2 + (p[_local4] + _arg1.p[_local4]));
p[_local4] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local4++;
};
}
}
}//package com.king.marble.utils
Section 29
//MathExtra (com.king.marble.utils.MathExtra)
package com.king.marble.utils {
import flash.geom.*;
public class MathExtra {
public static function degreesToRads(_arg1:Number):Number{
return ((_arg1 * (Math.PI / 180)));
}
public static function roundInt(_arg1:Number, _arg2:int):int{
var _local3:int = Math.round((_arg1 / _arg2));
return ((_local3 * _arg2));
}
public static function radsToDegrees(_arg1:Number):Number{
return ((_arg1 * (180 / Math.PI)));
}
public static function getDistanceBetweenPoints(_arg1:Point, _arg2:Point):Number{
var _local3:Number = (_arg2.x - _arg1.x);
var _local4:Number = (_arg2.y - _arg1.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function getPointByAngleAndDistance(_arg1:Number, _arg2:Number, _arg3:Point=null):Point{
if (_arg3 == null){
_arg3 = new Point(0, 0);
};
_arg2 = degreesToRads(_arg2);
var _local4:Number = (Math.cos(_arg2) * _arg1);
var _local5:Number = (Math.sin(_arg2) * _arg1);
return (new Point((_local4 + _arg3.x), (_local5 + _arg3.y)));
}
public static function getAngleBetweenPoints(_arg1:Point, _arg2:Point):Number{
return (((XPMath.atan2((_arg2.y - _arg1.y), (_arg2.x - _arg1.x)) * 180) / Math.PI));
}
}
}//package com.king.marble.utils
Section 30
//Random (com.king.marble.utils.Random)
package com.king.marble.utils {
import flash.utils.*;
public class Random {
private var mta:Array;
private var mti:Number;
private var lastSeed:Number;
private static var MATRIX_A:Number = 2567483615;
private static var UPPER_MASK:Number = 2147483648;
private static var LOWER_MASK:Number = 2147483647;
private static var M:Number = 397;
private static var N:Number = 624;
private static var mag01:Array = [0, 2567483615];
public function Random(_arg1:Number){
mta = new Array(N);
mti = (N + 1);
if (_arg1){
init_genrand(_arg1);
};
}
private function init_genrand(_arg1:Number):void{
_arg1 = int(_arg1);
var _local2:int = getTimer();
lastSeed = _arg1;
mta[0] = _arg1;
var _local3:Number = _arg1;
var _local4:Integer64 = new Integer64(null);
var _local5:Number = N;
mti = 1;
while (mti < _local5) {
_local4.init32(((_local3 >>> 30) ^ _local3));
_local4.mulu32(1812433253);
_local3 = (mta[mti] = int((_local4.lsb + mti)));
mti++;
};
var _local6:uint = getTimer();
}
public function nextFloat():Number{
return ((next(24) / (1 << 24)));
}
public function nextDouble():Number{
return ((next(24) / (1 << 24)));
}
public function get seed():Number{
return (lastSeed);
}
public function next(_arg1:Number):Number{
if (_arg1 < 32){
return ((genrand_int32() & ((1 << _arg1) - 1)));
};
return (genrand_int32());
}
public function set seed(_arg1:Number):void{
init_genrand(_arg1);
}
public function nextInt(_arg1:Number):Number{
return (((genrand_int32() & 2147483647) % _arg1));
}
private function genrand_int32():Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Array;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:int;
var _local1:Number = N;
var _local2:Number = 0;
if (mti >= _local1){
if (mti == (_local1 + 1)){
init_genrand(5489);
};
_local3 = M;
_local4 = UPPER_MASK;
_local5 = LOWER_MASK;
_local6 = mag01;
_local7 = getTimer();
_local8 = 0;
_local9 = (_local1 - _local3);
_local10 = (_local3 - _local1);
_local8 = 0;
while (_local8 < _local9) {
_local2 = ((mta[_local8] & _local4) | (mta[(_local8 + 1)] & _local5));
mta[_local8] = ((mta[(_local8 + _local3)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
_local8++;
};
_local9 = (_local1 - 1);
while (_local8 < _local9) {
_local2 = ((mta[_local8] & _local4) | (mta[(_local8 + 1)] & _local5));
mta[_local8] = ((mta[(_local8 + _local10)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
_local8++;
};
_local2 = ((mta[(_local1 - 1)] & _local4) | (mta[0] & _local5));
mta[(_local1 - 1)] = ((mta[(_local3 - 1)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
mti = 0;
_local11 = getTimer();
};
_local2 = mta[mti++];
_local2 = (_local2 ^ (_local2 >>> 11));
_local2 = (_local2 ^ ((_local2 << 7) & 2636928640));
_local2 = (_local2 ^ ((_local2 << 15) & 4022730752));
_local2 = (_local2 ^ (_local2 >>> 18));
return (_local2);
}
}
}//package com.king.marble.utils
Section 31
//XPMath (com.king.marble.utils.XPMath)
package com.king.marble.utils {
public class XPMath {
public static function sin(_arg1:Number):Number{
_arg1 = (_arg1 - 1.5707963267949);
var _local2:Number = 0;
var _local3:Number = ((_arg1 > 0)) ? _arg1 : -(_arg1);
if (_local3 >= (12.5663706143592 + 1.5707963267949)){
_local2 = int((_local3 * 0.636619772367581));
if ((_local2 & 1) != 0){
_local2++;
};
_local3 = (_local3 - (_local2 * 1.5707963267949));
} else {
if (_local3 < 1.5707963267949){
} else {
if (_local3 < (1.5707963267949 + 3.14159265358979)){
_local3 = (_local3 - 3.14159265358979);
_local2 = 2;
} else {
if (_local3 < (6.28318530717959 + 1.5707963267949)){
_local3 = (_local3 - 6.28318530717959);
} else {
if (_local3 < (9.42477796076938 + 1.5707963267949)){
_local3 = (_local3 - 9.42477796076938);
_local2 = 2;
} else {
_local3 = (_local3 - 12.5663706143592);
};
};
};
};
};
var _local4:Number = (_local3 * _local3);
var _local5:Number = (0.999999953027512 + (_local4 * (-0.499999047777921 + (_local4 * (0.041663573160188 + (_local4 * (-0.0013853629536173 + (_local4 * 2.31524166599385E-5))))))));
return ((((_local2 & 2))!=0) ? -(_local5) : _local5);
}
public static function atan2(_arg1:Number, _arg2:Number):Number{
var _local5:Number;
var _local3:Number = 3.14159265358979;
var _local4:Number = 1.5707963267949;
if (_arg2 == 0){
if (_arg1 > 0){
return (_local4);
};
if (_arg1 == 0){
return (0);
};
return (-(_local4));
};
var _local6:Number = (_arg1 / _arg2);
if (Math.abs(_local6) < 1){
_local5 = (_local6 / (1 + ((0.28 * _local6) * _local6)));
if (_arg2 < 0){
if (_arg1 < 0){
return ((_local5 - _local3));
};
return ((_local5 + _local3));
};
} else {
_local5 = (_local4 - (_local6 / ((_local6 * _local6) + 0.28)));
if (_arg1 < 0){
return ((_local5 - _local3));
};
};
return (_local5);
}
public static function cos(_arg1:Number):Number{
var _local2:Number = 0;
var _local3:Number = ((_arg1 > 0)) ? _arg1 : -(_arg1);
var _local4:Number = 1.5707963267949;
if (_local3 >= (12.5663706143592 + _local4)){
_local2 = int((_local3 * 0.636619772367581));
if ((_local2 & 1) != 0){
_local2++;
};
_local3 = (_local3 - (_local2 * _local4));
} else {
if (_local3 < _local4){
} else {
if (_local3 < (_local4 + 3.14159265358979)){
_local3 = (_local3 - 3.14159265358979);
_local2 = 2;
} else {
if (_local3 < (6.28318530717959 + _local4)){
_local3 = (_local3 - 6.28318530717959);
} else {
if (_local3 < (9.42477796076938 + _local4)){
_local3 = (_local3 - 9.42477796076938);
_local2 = 2;
} else {
_local3 = (_local3 - 12.5663706143592);
};
};
};
};
};
var _local5:Number = (_local3 * _local3);
var _local6:Number = (0.999999953027512 + (_local5 * (-0.499999047777921 + (_local5 * (0.041663573160188 + (_local5 * (-0.0013853629536173 + (_local5 * 2.31524166599385E-5))))))));
return ((((_local2 & 2))!=0) ? -(_local6) : _local6);
}
}
}//package com.king.marble.utils
Section 32
//Comm (com.king.marble.Comm)
package com.king.marble {
import com.king.marble.gui.*;
import com.king.marble.comm.*;
import flash.geom.*;
import flash.display.*;
import com.king.marble.game.*;
import flash.utils.*;
import com.king.marble.utils.*;
import com.king.marble.data.*;
public class Comm implements CommCallback, MarbleListener {
public var hasDisconnected:Boolean;// = false
private var _gameEndTimer:uint;
private var pauseCount:int;// = 0
public var playerSelf:Client;
public var gameHasEnded:Boolean;// = false
public var communicator:Communicator;
public var hasForfeited:Boolean;// = false
public var playerOpponent:Client;
public var mayDisconnect:Boolean;// = false
private var cmdQueue:Array;
public function Comm(){
cmdQueue = new Array();
super();
communicator = new Communicator(this);
MarbleEvents.addListener(this);
}
public function sendStartRound():void{
communicator.sendData("MSR resp");
}
public function clientConnected(_arg1:Client):void{
Debug.print(((((("Comm.Client connected.." + _arg1.id) + " , ") + _arg1.name) + " , ") + _arg1.avatarSlot), "ffffaa");
playerOpponent = _arg1;
}
public function onGameFinished():void{
}
public function forfeitGame():void{
communicator.sendData("MFG");
Debug.print("Comm.forfeitGame() ");
}
public function init(_arg1:String, _arg2:int, _arg3:String, _arg4:String):void{
communicator.connect(_arg1, _arg2, _arg3, _arg4);
}
public function clientAccepted(_arg1:Client):void{
Debug.print(("Comm.Client accepted.. " + _arg1.id), "ffffaa");
Game.playerId = (_arg1.id + 1);
Game.opponentId = ((Game.playerId == 1)) ? 2 : 1;
playerSelf = _arg1;
communicator.sendData("CIR");
}
public function sendLog(_arg1:String):void{
communicator.sendData(("LOG " + _arg1));
}
public function sendAim(_arg1:int, _arg2:Point):void{
communicator.sendData(((((("AIM " + _arg1) + " ") + _arg2.x) + " ") + _arg2.y));
}
public function sendEndRound():void{
communicator.sendData("MER resp");
}
public function tick():void{
communicator.tick();
}
public function clientDisconnected(_arg1:Number, _arg2:Number):void{
if (gameHasEnded){
return;
};
Debug.print(((("Comm.Client disconnected.. player:" + _arg1) + " , remaining: ") + _arg2), "ff3333");
var _local3:PopupMsg = PopupMsg.openPopupMsg(Main.getInstance(), TextMappings.get("disconnected_title"), TextMappings.get("opponent_disconnected_text"));
_local3.addDisplayObject(new Bitmap(BitmapDispenser.getBitmapData("disc_icon")), 190, 290);
Game.getInstance().enableBalls(false);
Game.getInstance().input.abortShooting();
Game.getInstance().removeReadyButton();
hasDisconnected = true;
}
private function handle(_arg1:Array):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Point;
var _local7:int;
var _local8:String;
var _local9:int;
var _local10:int;
var _local11:Point;
var _local12:ShortMessage;
var _local2:String = _arg1[0];
if (_local2 != "AIM"){
Debug.print(("Comm.handle(): " + _local2), "ffffaa");
};
if (_local2 == "MSS"){
_local4 = _arg1[1];
Debug.print(((("Comm.handle(): " + _local2) + " player id set: ") + _local4), "ffffaa");
MarbleEvents.onSkillShot();
} else {
if (_local2 == "MSB"){
_local5 = parseInt(_arg1[1]);
_local6 = new Point(parseFloat(_arg1[2]), parseFloat(_arg1[3]));
Game.getInstance().shootBallDo(_local5, _local6);
} else {
if (_local2 == "MES"){
MarbleEvents.cueEvent(MarbleEvents.onSkillShotEnd);
} else {
if (_local2 == "MSR"){
_local4 = parseInt(_arg1[1]);
Game.turnOwner = _local4;
setTimeout(MarbleEvents.onNewRound, 1200);
} else {
if (_local2 == "MST"){
_local4 = parseInt(_arg1[1]);
Game.turnOwner = _local4;
MarbleEvents.onNewTurn();
} else {
if (_local2 == "MET"){
MarbleEvents.cueEvent(MarbleEvents.onTurnEnd);
} else {
if (_local2 == "MER"){
MarbleEvents.onRoundEnd();
} else {
if (_local2 == "TCT"){
_local7 = parseInt(_arg1[1]);
_local8 = "";
_local3 = 2;
while (_local3 < _arg1.length) {
if (_local3 > 2){
_local8 = (_local8 + " ");
};
_local8 = (_local8 + _arg1[_local3]);
_local3++;
};
Game.getInstance().chatMessage(_local7, _local8);
} else {
if (_local2 == "DEB"){
} else {
if (_local2 == "MEM"){
PopupMsg.openPopupMsg(Main.getInstance(), TextMappings.get("error_title"), TextMappings.get(_arg1[1]));
} else {
if (_local2 == "MEG"){
Game.getInstance().stopGame();
_local9 = parseInt(_arg1[1]);
setTimeout(Main.getInstance().gameEnd, 4000, _local9);
gameHasEnded = true;
} else {
if (_local2 == "AIM"){
_local10 = parseInt(_arg1[1]);
_local11 = new Point(parseFloat(_arg1[2]), parseFloat(_arg1[3]));
Game.getInstance().input.setOpponentAim(_local10, _local11);
} else {
if (_local2 == "SAG"){
Game.getInstance().stopGame();
setTimeout(Main.getInstance().gameEnd, 3000);
gameHasEnded = true;
} else {
if (_local2 == "MFG"){
_local12 = new ShortMessage(TextMappings.get("your_opponent_have_forfeited"));
_local12.x = (Main.W / 2);
_local12.y = (Main.H / 2);
_local12.show(false);
setTimeout(_local12.hide, 2000);
Game.getInstance().addChild(_local12);
Game.getInstance().enableBalls(false);
Game.getInstance().input.abortShooting();
hasForfeited = true;
gameHasEnded = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
private function handleAllQueued():void{
var _local1:int;
while (_local1 < cmdQueue.length) {
handle(cmdQueue[_local1]);
_local1++;
};
cmdQueue = new Array();
}
public function resume():void{
communicator.resume();
pauseCount--;
if (pauseCount == 0){
handleAllQueued();
};
}
public function unableToConnect():void{
Debug.print("Comm.Unable to connect..", "ff3333");
Main.doLog("Comm.unableToConnect()");
}
public function shootBall(_arg1:int, _arg2:Point):void{
var _local3:String = ((((("MSB " + _arg1) + " ") + _arg2.x) + " ") + _arg2.y);
communicator.sendData(_local3);
Debug.print(("Comm.shotBall() sent: " + _local3));
}
public function connecting():void{
Debug.print("Comm.Connecting..", "ffffaa");
}
public function broadcast(_arg1:String):void{
communicator.sendData(_arg1);
}
public function log(_arg1:String):void{
Debug.print(("Comm: " + _arg1), "ffffaa");
}
public function sendEndGame():void{
communicator.sendData("MEG");
}
public function onTurnEnd():void{
}
public function onSkillShot():void{
}
public function sendEndGameScore(_arg1:int, _arg2:int):void{
var _local3:String = ((("MPS " + _arg1) + " ") + _arg2);
communicator.sendData(_local3);
Debug.print(("Comm.sendEndGameScore() sent: " + _local3));
}
public function sendStartTurn():void{
communicator.sendData(("MST resp " + Game.getInstance().getChecksum()));
}
public function onInitData():void{
}
public function onNewRound():void{
}
public function sendChatMsg(_arg1:String):void{
communicator.sendData(((("TCT " + Game.playerId) + " ") + _arg1));
Debug.print(("Comm.sendChatMsg() " + _arg1));
}
public function onRoundEnd():void{
}
public function onNewTurn():void{
}
public function localDisconnect():void{
if (mayDisconnect){
return;
};
Debug.print("Comm.Local disconnect..", "ff3333");
Main.doLog("Comm.localDisconnect()");
var _local1:PopupMsg = PopupMsg.openPopupMsg(Main.getInstance(), TextMappings.get("disconnected_title"), TextMappings.get("disconnected_text"));
setTimeout(Main.getInstance().gameQuit, 5000);
clearTimeout(_gameEndTimer);
}
public function onSkillShotEnd():void{
communicator.sendData("MES resp");
}
public function pause():void{
communicator.pause();
pauseCount++;
}
public function gameCommand(_arg1:String):void{
var i:int;
var cmds:Array;
var clientId:int;
var msg:String;
var cmd = _arg1;
try {
cmds = cmd.split(" ");
if (cmds[0].indexOf("T") == 0){
clientId = parseInt(cmds[1]);
if (cmds[0] == "TCT"){
msg = "";
i = 2;
while (i < cmds.length) {
if (i > 2){
msg = (msg + " ");
};
msg = (msg + cmds[i]);
i = (i + 1);
};
Game.getInstance().chatMessage(clientId, msg);
} else {
if (cmds[0] == "TOP"){
Debug.print(("Comm.gameCommand() log : " + cmd), "ddddff");
};
};
} else {
if (pauseCount > 0){
cmdQueue.push(cmds);
} else {
handle(cmds);
};
};
} catch(e:Error) {
Debug.print((((("Comm.gameCommand: " + cmd) + " ") + e) + " "), "ff3333");
Main.doLog(((("Comm.gameCommand() exception : " + cmd) + " ") + e.toString()));
};
}
public function startGame():void{
Debug.print("Comm.Startgame()..", "ffffaa");
Debug.print((("Comm.startGame() send: " + "SRS ") + Main.getInstance().parsedGameData.randomSeed));
MarbleEvents.onInitData();
}
public function sendRandomSeed():void{
communicator.sendData(("SRS " + Main.getInstance().parsedGameData.randomSeed));
}
}
}//package com.king.marble
Section 33
//Config (com.king.marble.Config)
package com.king.marble {
import com.king.marble.utils.*;
import flash.system.*;
public class Config {
public static const ROOT_LOAD_PATH:String = "";
public static const SECURE_ROOT_LOAD_PATH:String = "";
public static function init():void{
}
public static function checkEnviroment():void{
Debug.print(("Config.checkEnviroment() : " + Capabilities.playerType), "33FF55");
}
}
}//package com.king.marble
Section 34
//IntroAnimation (com.king.marble.IntroAnimation)
package com.king.marble {
import flash.events.*;
import com.king.marble.gui.*;
import com.king.marble.comm.*;
import flash.display.*;
import com.midasplayer.sound.*;
import gs.*;
import flash.utils.*;
import com.king.marble.utils.*;
public class IntroAnimation extends Sprite {
private var _introSound:ManagedSoundChannel;
private var _callBack:Function;
private var _textBg:Shape;
private var _subs:StdLabel;
private var _gfx:MovieClip;
public function IntroAnimation(_arg1:MovieClip){
_gfx = _arg1;
_gfx.gotoAndStop(1);
_textBg = new Shape();
_textBg.x = 80;
_textBg.y = 405;
_textBg.alpha = 0;
addChild(_textBg);
_subs = new StdLabel(StdLabel.font2, 18, 0);
_subs.multiline = true;
_subs.wordWrap = true;
_subs.width = 560;
_subs.x = (_textBg.x + 20);
_subs.y = 465;
_subs.alpha = 0;
addChild(_subs);
}
public function onFinished():void{
Debug.print("IntroAnimation.onFinished()");
if (_gfx.parent){
_gfx.parent.removeChild(_gfx);
};
if (parent){
parent.removeChild(this);
};
_callBack();
}
private function abortIntro(_arg1:MouseEvent):void{
_gfx.gotoAndStop(_gfx.totalFrames);
_introSound.fadeToAndStop(0, 1000);
}
private function onUpdate(_arg1:Event):void{
if (_gfx.currentFrame == 25){
addEventListener(MouseEvent.CLICK, abortIntro, false, 0, true);
buttonMode = true;
};
if (_gfx.currentFrame == 80){
showSubs("intro_1_maingame", 6000);
};
if (_gfx.currentFrame == 250){
showSubs("intro_2_timeout", 3500);
};
if (_gfx.currentFrame == 375){
showSubs("intro_3_skillshot", 10000);
};
if (_gfx.currentFrame == _gfx.totalFrames){
_gfx.stop();
TweenLite.to(this, 0.5, {alpha:0, onComplete:this.onFinished});
removeEventListener(Event.ENTER_FRAME, onUpdate);
removeEventListener(MouseEvent.CLICK, abortIntro);
} else {
_gfx.gotoAndStop((_gfx.currentFrame + 1));
};
}
private function showSubs(_arg1:String, _arg2:int):void{
_subs.text = TextMappings.get(_arg1);
TweenLite.to(_textBg, 0.5, {alpha:1});
TweenLite.to(_subs, 0.5, {alpha:1});
setTimeout(hideSubs, _arg2);
}
private function hideSubs():void{
TweenLite.to(_textBg, 0.5, {alpha:0});
TweenLite.to(_subs, 0.5, {alpha:0});
}
public function playIntro(_arg1:Function):void{
addChild(_gfx);
addChild(_textBg);
addChild(_subs);
_callBack = _arg1;
addEventListener(Event.ENTER_FRAME, onUpdate, false, 0, true);
_introSound = Main.getInstance().soundManager.getByClass(Main.getInstance().SndIntro, "snd_intro").play(0.25, 0);
}
}
}//package com.king.marble
Section 35
//Main (com.king.marble.Main)
package com.king.marble {
import flash.events.*;
import com.king.marble.gui.*;
import com.king.marble.comm.*;
import flash.display.*;
import com.midasplayer.sound.*;
import gs.*;
import com.king.marble.game.*;
import flash.utils.*;
import mx.events.*;
import com.king.marble.utils.*;
import flash.system.*;
import com.king.marble.data.*;
import flash.external.*;
public class Main extends MovieClip {
private var _1973599538BradhitcFont:Class;
public var comm:Comm;
private var _soundOn:Boolean;// = true
private var _623143390SndEndPos:Class;
private var _1934228608SndBallsLeftScore:Class;
private var _2108255287SndNewRound:Class;
private var _exitBtn:BitmapButton;
private var _1187964571SndBackgroundLoop:Class;
private var _soundBtn:BitmapButton;
private var _1888362474MarbleIntroGfx:Class;
private var _488801944SndCollision1:Class;
private var _1554985609SndRoundLost:Class;
private var _1688688384SndFailedShot:Class;
private var _399251107SndIntro:Class;
private var _gameEnded:Boolean;// = false
private var _60924857SndYourTurn:Class;
private var _623145634SndEndNeg:Class;
private var _bgSound:ManagedSoundChannel;
private var _742908049SndRoundWon:Class;
private var _introAnimation:IntroAnimation;
public var soundManager:SoundManager;
private var _1666576108SndBallOutScore:Class;
private var _488801943SndCollision2:Class;
private var _1844130856SndTimeout:Class;
private var _26038573MarbleArrowGfx:Class;
public var gameData:String;
private var _gameQuit:Boolean;// = false
private var _818519772MarbleGfx:Class;
private var _2057970183MarbleLoseGfx:Class;
private var _146241835ImpactFont:Class;
private var _game:Game;
public var parsedGameData:GameData;
private var _488801942SndCollision3:Class;
private var _1841168454MarbleWinGfx:Class;
public static var random:Random;
public static var H:int = 576;
private static var _this:Main;
public static var isHost:Boolean;
public static var W:int = 755;
public static var tick:uint = 0;
public function Main(){
_818519772MarbleGfx = Main_MarbleGfx;
_26038573MarbleArrowGfx = Main_MarbleArrowGfx;
_1841168454MarbleWinGfx = Main_MarbleWinGfx;
_2057970183MarbleLoseGfx = Main_MarbleLoseGfx;
_1888362474MarbleIntroGfx = Main_MarbleIntroGfx;
_1973599538BradhitcFont = Main_BradhitcFont;
_146241835ImpactFont = Main_ImpactFont;
_399251107SndIntro = Main_SndIntro;
_1666576108SndBallOutScore = Main_SndBallOutScore;
_1934228608SndBallsLeftScore = Main_SndBallsLeftScore;
_1187964571SndBackgroundLoop = Main_SndBackgroundLoop;
_1688688384SndFailedShot = Main_SndFailedShot;
_2108255287SndNewRound = Main_SndNewRound;
_1554985609SndRoundLost = Main_SndRoundLost;
_742908049SndRoundWon = Main_SndRoundWon;
_1844130856SndTimeout = Main_SndTimeout;
_60924857SndYourTurn = Main_SndYourTurn;
_623145634SndEndNeg = Main_SndEndNeg;
_623143390SndEndPos = Main_SndEndPos;
_488801944SndCollision1 = Main_SndCollision1;
_488801943SndCollision2 = Main_SndCollision2;
_488801942SndCollision3 = Main_SndCollision3;
super();
_this = this;
init();
}
public function set SndBallsLeftScore(_arg1:Class):void{
var _local2:Object = this._1934228608SndBallsLeftScore;
if (_local2 !== _arg1){
this._1934228608SndBallsLeftScore = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndBallsLeftScore", _local2, _arg1));
};
}
public function get MarbleLoseGfx():Class{
return (this._2057970183MarbleLoseGfx);
}
public function destroyGame():void{
_this = null;
}
public function set MarbleLoseGfx(_arg1:Class):void{
var _local2:Object = this._2057970183MarbleLoseGfx;
if (_local2 !== _arg1){
this._2057970183MarbleLoseGfx = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "MarbleLoseGfx", _local2, _arg1));
};
}
public function init():void{
var _local1:MovieClip = (new MarbleGfx() as MovieClip);
BitmapDispenser.generateBitmaps(_local1, init2);
}
public function set SndRoundLost(_arg1:Class):void{
var _local2:Object = this._1554985609SndRoundLost;
if (_local2 !== _arg1){
this._1554985609SndRoundLost = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndRoundLost", _local2, _arg1));
};
}
private function init2(_arg1:Event=null):void{
var _local3:Object;
var _local4:StdLabel;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.LEFT;
stage.frameRate = 25;
Debug.print("Main.init() entry point ", "33FF55");
Config.checkEnviroment();
Config.init();
comm = new Comm();
if (((!((Capabilities.playerType == "External"))) && (!((Capabilities.playerType == "StandAlone"))))){
_local3 = ExternalInterface.call("getGameData");
if ((((_local3 == null)) || (!(_local3.success)))){
Debug.print("getGameData returned null", "ff3333");
} else {
gameData = _local3.message;
Debug.print(("Got gamedata " + gameData), "FFFFFF");
};
};
if (gameData != null){
parsedGameData = GameDataParser.parseGameData(gameData);
comm.init(parsedGameData.hostName, parsedGameData.port, parsedGameData.slotId, parsedGameData.magic);
} else {
parsedGameData = new GameData();
parsedGameData.randomSeed = int((Math.random() * 9999));
Debug.print("gameData is null!", "ff3333");
_local4 = new StdLabel(StdLabel.font1, 12, 16724787);
_local4.text = "gameData is null!";
_local4.x = (_local4.y = 50);
addChild(_local4);
return;
};
random = new Random(parsedGameData.randomSeed);
_game = new Game();
_game.init();
_game.alpha = 0;
soundManager = new SoundManager();
var _local2:MovieClip = (new MarbleIntroGfx() as MovieClip);
_introAnimation = new IntroAnimation(_local2);
_introAnimation.playIntro(afterIntro);
addChild(_introAnimation);
addEventListener(Event.ENTER_FRAME, enterFrame, false, 0, true);
_soundBtn = new BitmapButton();
_soundBtn.setBitmap(BitmapDispenser.getBitmapData("btn_sound_on"));
_soundBtn.setActive(true, onSoundBtn);
_soundBtn.x = 710;
_soundBtn.y = 520;
addChild(_soundBtn);
}
public function set SndRoundWon(_arg1:Class):void{
var _local2:Object = this._742908049SndRoundWon;
if (_local2 !== _arg1){
this._742908049SndRoundWon = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndRoundWon", _local2, _arg1));
};
}
public function get MarbleArrowGfx():Class{
return (this._26038573MarbleArrowGfx);
}
public function get SndEndPos():Class{
return (this._623143390SndEndPos);
}
public function set SndBackgroundLoop(_arg1:Class):void{
var _local2:Object = this._1187964571SndBackgroundLoop;
if (_local2 !== _arg1){
this._1187964571SndBackgroundLoop = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndBackgroundLoop", _local2, _arg1));
};
}
public function get SndNewRound():Class{
return (this._2108255287SndNewRound);
}
public function get BradhitcFont():Class{
return (this._1973599538BradhitcFont);
}
public function set SndEndPos(_arg1:Class):void{
var _local2:Object = this._623143390SndEndPos;
if (_local2 !== _arg1){
this._623143390SndEndPos = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndEndPos", _local2, _arg1));
};
}
public function set SndIntro(_arg1:Class):void{
var _local2:Object = this._399251107SndIntro;
if (_local2 !== _arg1){
this._399251107SndIntro = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndIntro", _local2, _arg1));
};
}
public function get SndFailedShot():Class{
return (this._1688688384SndFailedShot);
}
public function set MarbleArrowGfx(_arg1:Class):void{
var _local2:Object = this._26038573MarbleArrowGfx;
if (_local2 !== _arg1){
this._26038573MarbleArrowGfx = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "MarbleArrowGfx", _local2, _arg1));
};
}
public function get SndEndNeg():Class{
return (this._623145634SndEndNeg);
}
public function gameQuit(_arg1:Event=null):void{
if (_gameQuit){
return;
};
Debug.print("Main.gameQuit()");
_gameQuit = true;
fscommand("gameQuit", "");
}
public function get SndCollision3():Class{
return (this._488801942SndCollision3);
}
public function set BradhitcFont(_arg1:Class):void{
var _local2:Object = this._1973599538BradhitcFont;
if (_local2 !== _arg1){
this._1973599538BradhitcFont = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "BradhitcFont", _local2, _arg1));
};
}
public function set SndNewRound(_arg1:Class):void{
var _local2:Object = this._2108255287SndNewRound;
if (_local2 !== _arg1){
this._2108255287SndNewRound = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndNewRound", _local2, _arg1));
};
}
public function set SndYourTurn(_arg1:Class):void{
var _local2:Object = this._60924857SndYourTurn;
if (_local2 !== _arg1){
this._60924857SndYourTurn = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndYourTurn", _local2, _arg1));
};
}
public function set SndFailedShot(_arg1:Class):void{
var _local2:Object = this._1688688384SndFailedShot;
if (_local2 !== _arg1){
this._1688688384SndFailedShot = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndFailedShot", _local2, _arg1));
};
}
public function set MarbleWinGfx(_arg1:Class):void{
var _local2:Object = this._1841168454MarbleWinGfx;
if (_local2 !== _arg1){
this._1841168454MarbleWinGfx = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "MarbleWinGfx", _local2, _arg1));
};
}
private function enterFrame(_arg1:Event):void{
soundManager.update();
}
public function get SndCollision1():Class{
return (this._488801944SndCollision1);
}
public function onExitBtn(_arg1:BasicButton):void{
Game.getInstance().scoreCounter.playerDisconnectedOrForfeited(Game.playerId);
Main.getInstance().comm.forfeitGame();
var _local2:ShortMessage = new ShortMessage(TextMappings.get("your_have_forfeited"));
_local2.x = (Main.W / 2);
_local2.y = (Main.H / 2);
_local2.show();
addChild(_local2);
}
public function get SndCollision2():Class{
return (this._488801943SndCollision2);
}
public function get SndBallsLeftScore():Class{
return (this._1934228608SndBallsLeftScore);
}
public function gameEnd(_arg1:int):void{
var _local2:String;
var _local3:Boolean;
if (_gameEnded){
return;
};
_gameEnded = true;
if (!_game.getHasGameStarted()){
gameQuit();
return;
};
if (((comm.hasForfeited) || (comm.hasDisconnected))){
Game.getInstance().scoreCounter.playerDisconnectedOrForfeited(Game.opponentId, comm.hasDisconnected);
};
stage.frameRate = 25;
soundManager.stopAll();
fscommand("gameEnd", ("" + Game.getInstance().scoreCounter.getPlayerScore(Game.playerId)));
Debug.print(("Main.gameEnd() gameEnd" + Game.getInstance().scoreCounter.getPlayerScore(Game.playerId)));
var _local4:int = Game.getInstance().scoreCounter.getPlayerScore(Game.playerId);
var _local5:int = ((Game.playerId == 1)) ? 2 : 1;
var _local6:int = Game.getInstance().scoreCounter.getPlayerScore(_local5);
if (Game.getInstance().scoreCounter.hasPlayerDisconnectedOrForfeited){
if (Game.playerId == _arg1){
_local2 = TextMappings.get("game_over_win_walkover").split("{0}").join(("" + _local4)).split("{1}").join(("" + _local6));
_local3 = true;
} else {
_local2 = TextMappings.get("game_over_lose_walkover").split("{0}").join(("" + _local4)).split("{1}").join(("" + _local6));
_local3 = false;
};
} else {
if (_arg1 == 0){
_local2 = TextMappings.get("game_over_equal_score").split("{0}").join(("" + _local4)).split("{1}").join(("" + _local6));
} else {
if (Game.playerId == _arg1){
_local2 = TextMappings.get("game_over_win").split("{0}").join(("" + _local4)).split("{1}").join(("" + _local6));
_local3 = true;
} else {
_local2 = TextMappings.get("game_over_lose").split("{0}").join(("" + _local4)).split("{1}").join(("" + _local6));
_local3 = false;
};
};
};
var _local7:PopupMsg = PopupMsg.openPopupMsg(this, TextMappings.get("game_over"), _local2);
if (_arg1 == 0){
} else {
if (_local3){
_local7.addDisplayObject((new MarbleWinGfx() as MovieClip), 222, 132);
Main.getInstance().soundManager.getByClass(Main.getInstance().SndEndPos, "snd_end_pos").play(0.5);
} else {
_local7.addDisplayObject((new MarbleLoseGfx() as MovieClip), 240, 43);
Main.getInstance().soundManager.getByClass(Main.getInstance().SndEndNeg, "snd_end_neg").play(0.5);
};
};
_local7.mouseChildren = false;
_local7.closable = false;
comm.mayDisconnect = true;
Main.doLog("Main.gameEnd()");
setTimeout(makeClosable, (2 * 1000), _local7);
setTimeout(gameQuit, (20 * 1000));
}
public function get SndRoundLost():Class{
return (this._1554985609SndRoundLost);
}
public function get SndRoundWon():Class{
return (this._742908049SndRoundWon);
}
public function get SndBackgroundLoop():Class{
return (this._1187964571SndBackgroundLoop);
}
public function get SndIntro():Class{
return (this._399251107SndIntro);
}
public function set SndTimeout(_arg1:Class):void{
var _local2:Object = this._1844130856SndTimeout;
if (_local2 !== _arg1){
this._1844130856SndTimeout = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndTimeout", _local2, _arg1));
};
}
public function set ImpactFont(_arg1:Class):void{
var _local2:Object = this._146241835ImpactFont;
if (_local2 !== _arg1){
this._146241835ImpactFont = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "ImpactFont", _local2, _arg1));
};
}
public function set MarbleGfx(_arg1:Class):void{
var _local2:Object = this._818519772MarbleGfx;
if (_local2 !== _arg1){
this._818519772MarbleGfx = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "MarbleGfx", _local2, _arg1));
};
}
public function get SndYourTurn():Class{
return (this._60924857SndYourTurn);
}
public function get MarbleWinGfx():Class{
return (this._1841168454MarbleWinGfx);
}
public function set SndEndNeg(_arg1:Class):void{
var _local2:Object = this._623145634SndEndNeg;
if (_local2 !== _arg1){
this._623145634SndEndNeg = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndEndNeg", _local2, _arg1));
};
}
private function onSoundBtn(_arg1:BasicButton):void{
if (_soundOn){
soundManager.setVolume(0);
_soundOn = false;
_soundBtn.setBitmap(BitmapDispenser.getBitmapData("btn_sound_off"));
} else {
_soundOn = true;
soundManager.setVolume(1);
_soundBtn.setBitmap(BitmapDispenser.getBitmapData("btn_sound_on"));
};
}
public function set SndCollision1(_arg1:Class):void{
var _local2:Object = this._488801944SndCollision1;
if (_local2 !== _arg1){
this._488801944SndCollision1 = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndCollision1", _local2, _arg1));
};
}
public function get ImpactFont():Class{
return (this._146241835ImpactFont);
}
public function set SndCollision2(_arg1:Class):void{
var _local2:Object = this._488801943SndCollision2;
if (_local2 !== _arg1){
this._488801943SndCollision2 = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndCollision2", _local2, _arg1));
};
}
public function set MarbleIntroGfx(_arg1:Class):void{
var _local2:Object = this._1888362474MarbleIntroGfx;
if (_local2 !== _arg1){
this._1888362474MarbleIntroGfx = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "MarbleIntroGfx", _local2, _arg1));
};
}
public function get MarbleGfx():Class{
return (this._818519772MarbleGfx);
}
public function set SndBallOutScore(_arg1:Class):void{
var _local2:Object = this._1666576108SndBallOutScore;
if (_local2 !== _arg1){
this._1666576108SndBallOutScore = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndBallOutScore", _local2, _arg1));
};
}
public function set SndCollision3(_arg1:Class):void{
var _local2:Object = this._488801942SndCollision3;
if (_local2 !== _arg1){
this._488801942SndCollision3 = _arg1;
this.dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "SndCollision3", _local2, _arg1));
};
}
public function get SndTimeout():Class{
return (this._1844130856SndTimeout);
}
public function get MarbleIntroGfx():Class{
return (this._1888362474MarbleIntroGfx);
}
public function get SndBallOutScore():Class{
return (this._1666576108SndBallOutScore);
}
private function afterIntro():void{
stage.frameRate = 50;
addChild(_game);
_game.addChild(_soundBtn);
_soundBtn.x = (710 - 35);
_soundBtn.y = 535;
TweenLite.to(_game, 0.5, {alpha:1});
Main.getInstance().soundManager.getByClass(Main.getInstance().SndBackgroundLoop, "snd_bg_loop").loop(0.25);
}
private function makeClosable(_arg1:PopupMsg):void{
_arg1.closable = true;
_arg1.addEventListener(MouseEvent.CLICK, gameQuit, false, 0, true);
_arg1.buttonMode = true;
}
public static function getInstance():Main{
return (_this);
}
public static function doLog(_arg1:String):void{
fscommand("doLog", ((((("MarbleMatchup - " + _this.parsedGameData.slotId) + " - ") + _arg1) + " - ") + Capabilities.version));
}
}
}//package com.king.marble
Section 36
//Main_BradhitcFont (com.king.marble.Main_BradhitcFont)
package com.king.marble {
import mx.core.*;
public class Main_BradhitcFont extends FontAsset {
}
}//package com.king.marble
Section 37
//Main_ImpactFont (com.king.marble.Main_ImpactFont)
package com.king.marble {
import mx.core.*;
public class Main_ImpactFont extends FontAsset {
}
}//package com.king.marble
Section 38
//Main_MarbleArrowGfx (com.king.marble.Main_MarbleArrowGfx)
package com.king.marble {
import mx.core.*;
public class Main_MarbleArrowGfx extends SpriteAsset {
}
}//package com.king.marble
Section 39
//Main_MarbleGfx (com.king.marble.Main_MarbleGfx)
package com.king.marble {
import mx.core.*;
public class Main_MarbleGfx extends MovieClipAsset {
}
}//package com.king.marble
Section 40
//Main_MarbleIntroGfx (com.king.marble.Main_MarbleIntroGfx)
package com.king.marble {
import mx.core.*;
public class Main_MarbleIntroGfx extends MovieClipAsset {
}
}//package com.king.marble
Section 41
//Main_MarbleLoseGfx (com.king.marble.Main_MarbleLoseGfx)
package com.king.marble {
import mx.core.*;
import flash.utils.*;
public class Main_MarbleLoseGfx extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Main_MarbleLoseGfx(){
dataClass = Main_MarbleLoseGfx_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package com.king.marble
Section 42
//Main_MarbleLoseGfx_dataClass (com.king.marble.Main_MarbleLoseGfx_dataClass)
package com.king.marble {
import mx.core.*;
public class Main_MarbleLoseGfx_dataClass extends ByteArrayAsset {
}
}//package com.king.marble
Section 43
//Main_MarbleWinGfx (com.king.marble.Main_MarbleWinGfx)
package com.king.marble {
import mx.core.*;
import flash.utils.*;
public class Main_MarbleWinGfx extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Main_MarbleWinGfx(){
dataClass = Main_MarbleWinGfx_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package com.king.marble
Section 44
//Main_MarbleWinGfx_dataClass (com.king.marble.Main_MarbleWinGfx_dataClass)
package com.king.marble {
import mx.core.*;
public class Main_MarbleWinGfx_dataClass extends ByteArrayAsset {
}
}//package com.king.marble
Section 45
//Main_SndBackgroundLoop (com.king.marble.Main_SndBackgroundLoop)
package com.king.marble {
import mx.core.*;
public class Main_SndBackgroundLoop extends SoundAsset {
}
}//package com.king.marble
Section 46
//Main_SndBallOutScore (com.king.marble.Main_SndBallOutScore)
package com.king.marble {
import mx.core.*;
public class Main_SndBallOutScore extends SoundAsset {
}
}//package com.king.marble
Section 47
//Main_SndBallsLeftScore (com.king.marble.Main_SndBallsLeftScore)
package com.king.marble {
import mx.core.*;
public class Main_SndBallsLeftScore extends SoundAsset {
}
}//package com.king.marble
Section 48
//Main_SndCollision1 (com.king.marble.Main_SndCollision1)
package com.king.marble {
import mx.core.*;
public class Main_SndCollision1 extends SoundAsset {
}
}//package com.king.marble
Section 49
//Main_SndCollision2 (com.king.marble.Main_SndCollision2)
package com.king.marble {
import mx.core.*;
public class Main_SndCollision2 extends SoundAsset {
}
}//package com.king.marble
Section 50
//Main_SndCollision3 (com.king.marble.Main_SndCollision3)
package com.king.marble {
import mx.core.*;
public class Main_SndCollision3 extends SoundAsset {
}
}//package com.king.marble
Section 51
//Main_SndEndNeg (com.king.marble.Main_SndEndNeg)
package com.king.marble {
import mx.core.*;
public class Main_SndEndNeg extends SoundAsset {
}
}//package com.king.marble
Section 52
//Main_SndEndPos (com.king.marble.Main_SndEndPos)
package com.king.marble {
import mx.core.*;
public class Main_SndEndPos extends SoundAsset {
}
}//package com.king.marble
Section 53
//Main_SndFailedShot (com.king.marble.Main_SndFailedShot)
package com.king.marble {
import mx.core.*;
public class Main_SndFailedShot extends SoundAsset {
}
}//package com.king.marble
Section 54
//Main_SndIntro (com.king.marble.Main_SndIntro)
package com.king.marble {
import mx.core.*;
public class Main_SndIntro extends SoundAsset {
}
}//package com.king.marble
Section 55
//Main_SndNewRound (com.king.marble.Main_SndNewRound)
package com.king.marble {
import mx.core.*;
public class Main_SndNewRound extends SoundAsset {
}
}//package com.king.marble
Section 56
//Main_SndRoundLost (com.king.marble.Main_SndRoundLost)
package com.king.marble {
import mx.core.*;
public class Main_SndRoundLost extends SoundAsset {
}
}//package com.king.marble
Section 57
//Main_SndRoundWon (com.king.marble.Main_SndRoundWon)
package com.king.marble {
import mx.core.*;
public class Main_SndRoundWon extends SoundAsset {
}
}//package com.king.marble
Section 58
//Main_SndTimeout (com.king.marble.Main_SndTimeout)
package com.king.marble {
import mx.core.*;
public class Main_SndTimeout extends SoundAsset {
}
}//package com.king.marble
Section 59
//Main_SndYourTurn (com.king.marble.Main_SndYourTurn)
package com.king.marble {
import mx.core.*;
public class Main_SndYourTurn extends SoundAsset {
}
}//package com.king.marble
Section 60
//MarbleEvents (com.king.marble.MarbleEvents)
package com.king.marble {
import com.king.marble.utils.*;
public class MarbleEvents {
private static var _listeners:Array = [];
private static var _cuedEvents:Array = [];
private static var _doCueAtOnce:Boolean = false;
public static function onGameFinished():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onTurnEnd()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onGameFinished();
_local1++;
};
}
public static function onNewTurn():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onNewTurn()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onNewTurn();
_local1++;
};
}
public static function onSkillShot():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onSkillShot()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onSkillShot();
_local1++;
};
}
public static function onNewRound():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onNewRound()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onNewRound();
_local1++;
};
}
public static function cueEvent(_arg1:Function):void{
Debug.print("MarbleEvents.cueEvent()", "ffffff");
_cuedEvents.push(_arg1);
if (_doCueAtOnce){
executeCue();
};
}
public static function onSkillShotEnd():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onSkillShotEnd()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onSkillShotEnd();
_local1++;
};
}
public static function onRoundEnd():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onRoundEnd()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onRoundEnd();
_local1++;
};
}
public static function addListener(_arg1:MarbleListener):void{
_listeners.push(_arg1);
}
public static function onInitData():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onInitData()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onInitData();
_local1++;
};
}
public static function executeCue():void{
Debug.print("MarbleEvents.executeCue()", "ffffff");
if (_cuedEvents.length == 0){
_doCueAtOnce = true;
} else {
_doCueAtOnce = false;
};
var _local1:int;
while (_local1 < _cuedEvents.length) {
var _local2 = _cuedEvents;
_local2[_local1]();
_local1++;
};
_cuedEvents = [];
}
public static function onTurnEnd():void{
var _local2:MarbleListener;
Debug.print("MarbleEvents.onTurnEnd()", "ffffff");
var _local1:int;
while (_local1 < _listeners.length) {
_local2 = _listeners[_local1];
_local2.onTurnEnd();
_local1++;
};
}
}
}//package com.king.marble
Section 61
//MarbleListener (com.king.marble.MarbleListener)
package com.king.marble {
public interface MarbleListener {
function onSkillShot():void;
function onTurnEnd():void;
function onInitData():void;
function onGameFinished():void;
function onRoundEnd():void;
function onNewRound():void;
function onNewTurn():void;
function onSkillShotEnd():void;
}
}//package com.king.marble
Section 62
//ScoreCounter (com.king.marble.ScoreCounter)
package com.king.marble {
import com.king.marble.gui.*;
import flash.geom.*;
import com.king.marble.game.*;
import flash.utils.*;
import com.king.marble.utils.*;
import com.midasplayer.avatar.*;
public class ScoreCounter implements MarbleListener {
private var _player2Score:int;
private var _ballsOutThisTurn:int;// = 0
public var hasPlayerDisconnectedOrForfeited:Boolean;// = false
private var _player1Score:int;
public var pl1Wins:int;// = 0
public var pl2Wins:int;// = 0
private var _roundScorePl1:int;// = 0
private var _roundScorePl2:int;// = 0
public function ScoreCounter():void{
MarbleEvents.addListener(this);
}
private function maybePlayBadShot():void{
if (_ballsOutThisTurn == 0){
Main.getInstance().soundManager.getByClass(Main.getInstance().SndFailedShot, "snd_failed_shot").play(0.5);
};
}
public function onRoundEnd():void{
var _local4:int;
var _local5:Ball;
var _local1:int;
var _local2:int;
var _local3:int;
var _local6:Array = Game.getInstance().getBalls();
var _local7:int;
while (_local7 < _local6.length) {
_local5 = _local6[_local7];
if (_local5.isOut){
} else {
if (_local5.ownerId == 1){
_local1++;
};
if (_local5.ownerId == 2){
_local2++;
};
};
_local7++;
};
if ((((_local1 == 0)) && ((_local2 == 0)))){
if (_roundScorePl1 == _roundScorePl2){
Debug.print("both players win! ", "99FFFF");
_local4 = 0;
pl1Wins++;
pl2Wins++;
} else {
if (_roundScorePl1 > _roundScorePl2){
pl1Wins++;
_local4 = 1;
Debug.print("Player 1 wins! ", "99FFFF");
} else {
pl2Wins++;
_local4 = 2;
Debug.print("Player 2 wins! ", "99FFFF");
};
};
} else {
if (_local1 == 0){
Debug.print("Player 2 wins! ", "99FFFF");
pl2Wins++;
_local4 = 2;
} else {
if (_local2 == 0){
Debug.print("Player 1 wins! ", "99FFFF");
pl1Wins++;
_local4 = 1;
} else {
Debug.print("ScoreCounter.onRoundEnd, both players have balls left, something went wrong!", "ff3333");
return;
};
};
};
var _local8 = 50;
var _local9:int;
var _local10:int;
while (_local10 < _local6.length) {
_local5 = _local6[_local10];
if (_local5.isOut){
} else {
Game.getInstance().showScorePop(_local8, _local5, _local9);
setTimeout(playBallLeftSound, _local9);
_local9 = (_local9 + 200);
_local3 = (_local3 + _local8);
_local8 = (_local8 + 50);
};
_local10++;
};
getPlayerScoreBoard(1).setWins(pl1Wins);
getPlayerScoreBoard(2).setWins(pl2Wins);
if (_local4 > 0){
getPlayerScoreBoard(_local4).addScore(_local3);
getPlayerScoreBoard(_local4).setAvatarMood(AvatarMood.MOOD_HAPPY);
addPlayerScore(_local4, _local3);
};
if (_local4 == Game.playerId){
Main.getInstance().soundManager.getByClass(Main.getInstance().SndRoundWon, "snd_round_won").play(0.5);
} else {
Main.getInstance().soundManager.getByClass(Main.getInstance().SndRoundLost, "snd_round_lost").play(0.5);
};
_roundScorePl1 = 0;
_roundScorePl2 = 0;
Main.getInstance().comm.sendEndGameScore(getPlayerScore(1), getPlayerScore(2));
}
public function onGameFinished():void{
}
public function onSkillShot():void{
}
public function onNewRound():void{
Main.getInstance().comm.sendEndGameScore(getPlayerScore(1), getPlayerScore(2));
}
public function ballOut(_arg1:Ball):void{
if (_arg1.ownerId == Game.turnOwner){
Debug.print(((("ScoreCounter.ballOut() player pushed own ball out.. " + _arg1.ownerId) + " == ") + Game.turnOwner));
getPlayerScoreBoard(_arg1.ownerId).setAvatarMood(AvatarMood.MOOD_ASHAMED);
setTimeout(maybePlayBadShot, 1000);
return;
};
Main.getInstance().soundManager.getByClass(Main.getInstance().SndBallOutScore, "snd_ball_out_score").play(0.5);
getPlayerScoreBoard(_arg1.ownerId).setAvatarMood(AvatarMood.MOOD_ANGRY);
getPlayerScoreBoard(Game.turnOwner).setAvatarMood(AvatarMood.MOOD_HAPPY);
var _local2:int = (10 + (_ballsOutThisTurn * 10));
getPlayerScoreBoard(Game.turnOwner).addScore(_local2);
addPlayerScore(Game.turnOwner, _local2);
Game.getInstance().showScorePop(_local2, _arg1);
if (Game.turnOwner == 1){
_roundScorePl1 = (_roundScorePl1 + _local2);
} else {
_roundScorePl2 = (_roundScorePl2 + _local2);
};
_ballsOutThisTurn++;
}
public function addPlayerScore(_arg1:int, _arg2:int):void{
if (hasPlayerDisconnectedOrForfeited){
return;
};
if (_arg1 == 1){
_player1Score = (_player1Score + _arg2);
} else {
_player2Score = (_player2Score + _arg2);
};
}
public function playerDisconnectedOrForfeited(_arg1:int, _arg2:Boolean=false):void{
var _local3:int = (_arg2) ? 0 : 100;
setPlayerScore(_arg1, _local3);
getPlayerScoreBoard(_arg1).setTotalScore(_local3);
var _local4:int = ((_arg1 == 1)) ? 2 : 1;
setPlayerScore(_local4, 200);
getPlayerScoreBoard(_local4).setTotalScore(200);
hasPlayerDisconnectedOrForfeited = true;
}
public function onNewTurn():void{
_ballsOutThisTurn = 0;
}
public function onInitData():void{
}
private function getBallByOwner(_arg1:int):Ball{
var _local4:Ball;
var _local2:Array = Game.getInstance().getBalls();
var _local3:int;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
if (_local4.ownerId == _arg1){
return (_local4);
};
_local3++;
};
return (null);
}
public function getPlayerScoreBoard(_arg1:int):ScoreBoard{
return (((_arg1 == 1)) ? Game.getInstance().player1Score : Game.getInstance().player2Score);
}
public function setPlayerScore(_arg1:int, _arg2:int):void{
if (_arg1 == 1){
_player1Score = _arg2;
} else {
_player2Score = _arg2;
};
}
private function playBallLeftSound():void{
Main.getInstance().soundManager.getByClass(Main.getInstance().SndBallsLeftScore, "snd_balls_left_score").play(0.5);
}
public function onSkillShotEnd():void{
var _local1:Ball;
var _local2:Number;
var _local6:Ball;
var _local3:Number = 200;
_local2 = getBallDistanceToTargetByOwner(1);
var _local4:int = (Math.max((_local3 - _local2), 0) / 2);
_local2 = getBallDistanceToTargetByOwner(2);
var _local5:int = (Math.max((_local3 - _local2), 0) / 2);
_local6 = getBallByOwner((1 + 2));
if (_local6 != null){
if (!_local6.isOut){
_local4 = 0;
};
};
_local6 = getBallByOwner((2 + 2));
if (_local6 != null){
if (!_local6.isOut){
_local5 = 0;
};
};
getPlayerScoreBoard(1).addScore(_local4);
getPlayerScoreBoard(2).addScore(_local5);
addPlayerScore(1, _local4);
addPlayerScore(2, _local5);
_local1 = getBallByOwner(1);
if (_local1 != null){
Game.getInstance().showScorePop(_local4, _local1);
Main.getInstance().soundManager.getByClass(Main.getInstance().SndBallOutScore, "snd_ball_out_score").play(0.5);
};
_local1 = getBallByOwner(2);
if (_local1 != null){
Game.getInstance().showScorePop(_local5, _local1);
Main.getInstance().soundManager.getByClass(Main.getInstance().SndBallOutScore, "snd_ball_out_score").play(0.5);
};
Debug.print(((("ScoreCounter.onSkillShotEnd() pl1 " + _local4) + " pl2 ") + _local5));
var _local7:int = ((_local4 > _local5)) ? 1 : 2;
getPlayerScoreBoard(_local7).setAvatarMood(AvatarMood.MOOD_HAPPY);
Main.getInstance().comm.sendEndGameScore(getPlayerScore(1), getPlayerScore(2));
}
public function getPlayerScore(_arg1:int):int{
return (((_arg1 == 1)) ? _player1Score : _player2Score);
}
private function getBallDistanceToTargetByOwner(_arg1:int):Number{
var _local2:Ball = getBallByOwner(_arg1);
if ((((_local2 == null)) || (_local2.isOut))){
return (9999);
};
var _local3:SkillShotTarget = ((_arg1 == 1)) ? Game.getInstance().board.targetPl1 : Game.getInstance().board.targetPl2;
var _local4:Number = MathExtra.getDistanceBetweenPoints(new Point(_local2.px, _local2.py), new Point(_local3.px, _local3.py));
return (_local4);
}
public function onTurnEnd():void{
var _local6:Ball;
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Array = Game.getInstance().getBalls();
var _local5:int;
while (_local5 < _local4.length) {
_local6 = _local4[_local5];
if (!_local6.isOut){
_local3++;
};
if (_local6.ownerId == 1){
_local1++;
};
if (_local6.ownerId == 2){
_local2++;
};
_local5++;
};
Main.getInstance().comm.sendLog(("number of balls on the board: " + _local3));
if ((((_local1 == 0)) || ((_local2 == 0)))){
Main.getInstance().comm.sendEndRound();
} else {
Main.getInstance().comm.sendStartTurn();
};
Debug.print(((("ScoreCounter.onTurnEnd() " + _local1) + " ") + _local2));
}
}
}//package com.king.marble
Section 63
//AvatarLoader (com.midasplayer.avatar.AvatarLoader)
package com.midasplayer.avatar {
import flash.events.*;
import flash.display.*;
import com.king.marble.utils.*;
import mx.rpc.soap.*;
import flash.system.*;
import flash.net.*;
import flash.external.*;
public class AvatarLoader {
private var path:String;
private var isMoneyGame:Boolean;
private var loaderId:int;
private var progressCallback:Function;
private var completeCallback:Function;
public function AvatarLoader(){
path = "AvatarManager.swf";
progressCallback = null;
completeCallback = null;
isMoneyGame = false;
var _local1:Object = ExternalInterface.call("isMoneyGame");
if (_local1 != null){
isMoneyGame = (_local1.message == 1);
};
}
public function load(_arg1:Function, _arg2:Function=null):void{
this.completeCallback = _arg1;
this.progressCallback = _arg2;
if (isMoneyGame){
moneyLoad();
} else {
simpleLoad();
};
}
private function onLoad(_arg1:LoadEvent):void{
Debug.print(("AvatarLoader.onLoad() " + _arg1));
}
private function moneyLoad():void{
ExternalInterface.addCallback("onSwfProgress", onSwfProgress);
var _local1:Object = ExternalInterface.call("preloadSwf", path);
if (_local1 != null){
loaderId = _local1.message;
};
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
Debug.print(("AvatarLoader.ioErrorHandler() err " + _arg1), "ff3333");
}
private function onLoadInit(_arg1:Event):void{
Debug.print(("AvatarLoader.onLoadInit() complete! ap1 " + _arg1));
}
public function onSwfProgress(_arg1:int, _arg2:int, _arg3:String):void{
Debug.print(((("AvatarLoader.onSwfProgress() status: " + _arg2) + " , ") + _arg3), "99FFFF");
if (_arg2 < 100){
};
if (_arg2 == 100){
path = _arg3;
simpleLoad();
} else {
if (_arg2 < 0){
};
};
}
private function simpleLoad():void{
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = ApplicationDomain.currentDomain;
var _local2:URLRequest = new URLRequest(path);
var _local3:Loader = new Loader();
if (((!(isMoneyGame)) && (!((progressCallback == null))))){
_local3.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressCallback);
};
if (completeCallback != null){
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, completeCallback);
};
_local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
_local3.contentLoaderInfo.addEventListener(LoadEvent.LOAD, onLoad, false, 0, true);
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadInit, false, 0, true);
_local3.load(_local2, _local1);
}
}
}//package com.midasplayer.avatar
Section 64
//AvatarMood (com.midasplayer.avatar.AvatarMood)
package com.midasplayer.avatar {
public class AvatarMood {
public static const MOOD_ANGRY:String = "angry";
public static const AVATAR_CROWN_URL:String = "/images/games/crowns/";
public static const MOOD_MAD:String = "mad";
public static const MOOD_TEASING:String = "teasing";
public static const MOOD_SUPERIOR:String = "superior";
public static const MOOD_SURPRISED:String = "surprised";
public static const MOOD_TIRED:String = "tired";
public static const MOOD_HAPPY:String = "happy";
public static const MOOD_ASHAMED:String = "ashamed";
public static const AVATAR_EXTERNAL_URL:String = "/avatar/external/";
public static const MOOD_NEUTRAL:String = "neutral";
}
}//package com.midasplayer.avatar
Section 65
//ManagedSound (com.midasplayer.sound.ManagedSound)
package com.midasplayer.sound {
import flash.media.*;
public class ManagedSound {
public var activeSounds:Array;
private var manager:SoundManager;
private var ClassReference:Class;
public function ManagedSound(_arg1:SoundManager, _arg2:Class){
activeSounds = new Array();
super();
this.manager = _arg1;
this.ClassReference = _arg2;
}
public function stop():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].stop();
_local1++;
};
}
public function play(_arg1:Number=1, _arg2:Number=0):ManagedSoundChannel{
if (!manager.enabled){
_arg1 = 0;
};
var _local3:SoundChannel = new ClassReference().play(0, 0, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
public function loop(_arg1:Number=1, _arg2:Number=0):ManagedSoundChannel{
if (!manager.enabled){
_arg1 = 0;
};
var _local3:SoundChannel = new ClassReference().play(0, 999999999, new SoundTransform(_arg1, _arg2));
return (new ManagedSoundChannel(manager, this, _local3));
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeToAndStop(_arg1, _arg2);
_local3++;
};
}
public function isPlaying():Boolean{
return ((activeSounds.length > 0));
}
public function update():void{
var _local1:int;
while (_local1 < activeSounds.length) {
activeSounds[_local1].update();
_local1++;
};
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].fadeTo(_arg1, _arg2);
_local3++;
};
}
public function panTo(_arg1:Number, _arg2:Number):void{
var _local3:int;
while (_local3 < activeSounds.length) {
activeSounds[_local3].panTo(_arg1, _arg2);
_local3++;
};
}
public function setPan(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setPan(_arg1);
_local2++;
};
}
public function setVolume(_arg1:Number):void{
var _local2:int;
while (_local2 < activeSounds.length) {
activeSounds[_local2].setVolume(_arg1);
_local2++;
};
}
}
}//package com.midasplayer.sound
Section 66
//ManagedSoundChannel (com.midasplayer.sound.ManagedSoundChannel)
package com.midasplayer.sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class ManagedSoundChannel {
private var fadeStartVolume:Number;// = -1
private var channel:SoundChannel;
private var fadeEndVolume:Number;// = -1
private var targetVolume:Number;
private var targetPan:Number;
private var sound:ManagedSound;
private var stopAfterFade:Boolean;// = false
private var panEndTime:Number;// = -1
private var fadeEndTime:Number;// = -1
private var manager:SoundManager;
private var playing:Boolean;// = true
private var panStartTime:Number;// = -1
private var fadeStartTime:Number;// = -1
private var panEndVolume:Number;// = -1
private var panStartVolume:Number;// = -1
public function ManagedSoundChannel(_arg1:SoundManager, _arg2:ManagedSound, _arg3:SoundChannel){
this.manager = _arg1;
this.sound = _arg2;
this.channel = _arg3;
_arg2.activeSounds.push(this);
_arg3.addEventListener(Event.SOUND_COMPLETE, soundComplete);
targetVolume = _arg3.soundTransform.volume;
targetPan = _arg3.soundTransform.pan;
update();
}
public function stop():void{
if (!playing){
return;
};
channel.stop();
soundComplete(null);
}
public function update():void{
var _local1:Number;
if (!playing){
return;
};
if (fadeStartTime >= 0){
_local1 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetVolume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local1));
targetVolume = (targetVolume * targetVolume);
if (_local1 == 1){
fadeStartTime = -1;
};
if ((((_local1 == 1)) && (stopAfterFade))){
stop();
};
};
if (panStartTime >= 0){
_local1 = ((getTimer() - panStartTime) / (panEndTime - panStartTime));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
targetPan = (panStartVolume + ((panEndVolume - panStartVolume) * _local1));
if (_local1 == 1){
panStartTime = -1;
};
};
var _local2:Number = (targetVolume * manager.volume);
var _local3:Number = targetPan;
if (((!((_local2 == channel.soundTransform.volume))) || (!((_local3 == channel.soundTransform.pan))))){
channel.soundTransform = new SoundTransform(_local2, _local3);
};
}
public function panTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
panStartVolume = targetPan;
panEndVolume = _arg1;
panStartTime = getTimer();
panEndTime = (getTimer() + _arg2);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeStartVolume = Math.sqrt(targetVolume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
stopAfterFade = false;
}
public function setPan(_arg1:Number):void{
if (!playing){
return;
};
channel.soundTransform.pan = _arg1;
panStartTime = -1;
update();
}
public function fadeToAndStop(_arg1:Number, _arg2:Number):void{
if (!playing){
return;
};
fadeTo(_arg1, _arg2);
stopAfterFade = true;
}
public function setVolume(_arg1:Number):void{
if (!playing){
return;
};
stopAfterFade = false;
this.targetVolume = targetVolume;
fadeStartTime = -1;
update();
}
public function soundComplete(_arg1:Event):void{
if (!playing){
return;
};
sound.activeSounds.splice(sound.activeSounds.indexOf(this), 1);
playing = false;
}
public function isPlaying():Boolean{
return (playing);
}
}
}//package com.midasplayer.sound
Section 67
//SoundManager (com.midasplayer.sound.SoundManager)
package com.midasplayer.sound {
import flash.utils.*;
public class SoundManager {
private var fadeStartVolume:Number;// = -1
public var enabled:Boolean;// = true
private var lastTime:Number;// = -1
private var managedSounds:Array;
private var managedSoundMap:Object;
public var volume:Number;// = 1
private var fadeEndTime:Number;// = -1
private var fadeEndVolume:Number;// = -1
private var fadeStartTime:Number;// = -1
public function SoundManager(){
managedSoundMap = new Object();
managedSounds = new Array();
super();
}
public function update():void{
var _local3:Number;
var _local1:Number = getTimer();
if (lastTime < 0){
lastTime = _local1;
};
if (fadeStartTime >= 0){
_local3 = ((getTimer() - fadeStartTime) / (fadeEndTime - fadeStartTime));
if (_local3 < 0){
_local3 = 0;
};
if (_local3 > 1){
_local3 = 1;
};
volume = (fadeStartVolume + ((fadeEndVolume - fadeStartVolume) * _local3));
volume = (volume * volume);
if (_local3 == 1){
fadeStartTime = -1;
};
};
var _local2:int;
while (_local2 < managedSounds.length) {
managedSounds[_local2].update();
_local2++;
};
}
public function get(_arg1:String):ManagedSound{
var _local2:Class;
if (managedSoundMap[_arg1] == null){
_local2 = (getDefinitionByName(_arg1) as Class);
if (_local2 == null){
_local2 = (getDefinitionByName(("sound." + _arg1)) as Class);
};
if (_local2 == null){
_local2 = (getDefinitionByName(("snd." + _arg1)) as Class);
};
if (_local2 == null){
throw (new Error(("Failed to find sound " + _arg1)));
};
managedSoundMap[_arg1] = new ManagedSound(this, _local2);
managedSounds.push(managedSoundMap[_arg1]);
};
return (managedSoundMap[_arg1]);
}
public function fadeTo(_arg1:Number, _arg2:Number):void{
fadeStartVolume = Math.sqrt(volume);
fadeEndVolume = Math.sqrt(_arg1);
fadeStartTime = getTimer();
fadeEndTime = (getTimer() + _arg2);
}
public function setVolume(_arg1:Number):void{
this.volume = _arg1;
fadeStartTime = -1;
}
public function getByClass(_arg1:Class, _arg2:String):ManagedSound{
if (managedSoundMap[_arg2] == null){
managedSoundMap[_arg2] = new ManagedSound(this, _arg1);
managedSounds.push(managedSoundMap[_arg2]);
};
return (managedSoundMap[_arg2]);
}
public function stopAll():void{
var _local1:int;
while (_local1 < managedSounds.length) {
managedSounds[_local1].stop();
_local1++;
};
}
}
}//package com.midasplayer.sound
Section 68
//Elastic (gs.easing.Elastic)
package gs.easing {
public class Elastic {
private static const _2PI:Number = 6.28318530717959;
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) * 0.5) + _arg3) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) + _arg3) + _arg2));
}
}
}//package gs.easing
Section 69
//TweenLite (gs.TweenLite)
package gs {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
public class TweenLite {
public var delay:Number;
protected var _hasUpdate:Boolean;
protected var _subTweens:Array;
protected var _initted:Boolean;
public var startTime:int;
public var target:Object;
public var duration:Number;
protected var _hst:Boolean;
protected var _isDisplayObject:Boolean;
protected var _active:Boolean;
public var tweens:Array;
public var vars:Object;
public var initTime:int;
protected var _timeScale:Number;
private static var _timer:Timer = new Timer(2000);
private static var _classInitted:Boolean;
public static var defaultEase:Function = TweenLite.easeOut;
public static var version:Number = 8.16;
protected static var _all:Dictionary = new Dictionary();
private static var _sprite:Sprite = new Sprite();
protected static var _curTime:uint;
public static var overwriteManager:Object;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _listening:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local5:*;
super();
if (_arg1 == null){
return;
};
if (!_classInitted){
_curTime = getTimer();
_sprite.addEventListener(Event.ENTER_FRAME, executeAll);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_classInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
_timeScale = ((_arg3.timeScale) || (1));
_active = (((_arg2 == 0)) && ((this.delay == 0)));
this.target = _arg1;
_isDisplayObject = (_arg1 is DisplayObject);
if (!(this.vars.ease is Function)){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
if (!isNaN(Number(this.vars.autoAlpha))){
this.vars.alpha = Number(this.vars.autoAlpha);
this.vars.visible = (this.vars.alpha > 0);
};
this.tweens = [];
_subTweens = [];
_hst = (_initted = false);
this.initTime = _curTime;
this.startTime = (this.initTime + (this.delay * 1000));
var _local4:int = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if ((((_all[_arg1] == undefined)) || (((!((_arg1 == null))) && ((_local4 == 1)))))){
delete _all[_arg1];
_all[_arg1] = new Dictionary(true);
} else {
if ((((_local4 > 1)) && ((this.delay == 0)))){
overwriteManager.manageOverwrites(this, _all[_arg1]);
};
};
_all[_arg1][this] = this;
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (_active))){
initTweenVals();
if (_active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
_local5 = this.vars.visible;
if (this.vars.isTV == true){
_local5 = this.vars.exposedProps.visible;
};
if (((((!((_local5 == null))) && ((this.vars.runBackwards == true)))) && (_isDisplayObject))){
this.target.visible = Boolean(_local5);
};
};
if (((!(_listening)) && (!(_active)))){
_timer.addEventListener("timer", killGarbage);
_timer.start();
_listening = true;
};
}
protected function addSubTween(_arg1:String, _arg2:Function, _arg3:Object, _arg4:Object, _arg5:Object=null):void{
var _local7:String;
var _local6:Object = {name:_arg1, proxy:_arg2, target:_arg3, info:_arg5};
_subTweens[_subTweens.length] = _local6;
for (_local7 in _arg4) {
if (typeof(_arg4[_local7]) == "number"){
this.tweens[this.tweens.length] = {o:_arg3, p:_local7, s:_arg3[_local7], c:(_arg4[_local7] - _arg3[_local7]), sub:_local6, name:_arg1};
} else {
this.tweens[this.tweens.length] = {o:_arg3, p:_local7, s:_arg3[_local7], c:Number(_arg4[_local7]), sub:_local6, name:_arg1};
};
};
_hst = true;
}
public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{
var _local3:String;
var _local4:int;
var _local6:Array;
var _local7:ColorTransform;
var _local8:ColorTransform;
var _local9:Object;
var _local5:Object = this.vars;
if (_local5.isTV == true){
_local5 = _local5.exposedProps;
};
if (((((!(_arg1)) && (!((this.delay == 0))))) && (overwriteManager.enabled))){
overwriteManager.manageOverwrites(this, _all[this.target]);
};
if ((this.target is Array)){
_local6 = ((this.vars.endArray) || ([]));
_local4 = 0;
while (_local4 < _local6.length) {
if (((!((this.target[_local4] == _local6[_local4]))) && (!((this.target[_local4] == undefined))))){
this.tweens[this.tweens.length] = {o:this.target, p:_local4.toString(), s:this.target[_local4], c:(_local6[_local4] - this.target[_local4]), name:_local4.toString()};
};
_local4++;
};
} else {
if (((((!((typeof(_local5.tint) == "undefined"))) || ((this.vars.removeTint == true)))) && (_isDisplayObject))){
_local7 = this.target.transform.colorTransform;
_local8 = new ColorTransform();
if (_local5.alpha != undefined){
_local8.alphaMultiplier = _local5.alpha;
delete _local5.alpha;
} else {
_local8.alphaMultiplier = this.target.alpha;
};
if (((!((this.vars.removeTint == true))) && (((((!((_local5.tint == null))) && (!((_local5.tint == ""))))) || ((_local5.tint == 0)))))){
_local8.color = _local5.tint;
};
addSubTween("tint", tintProxy, {progress:0}, {progress:1}, {target:this.target, color:_local7, endColor:_local8});
};
if (((!((_local5.frame == null))) && (_isDisplayObject))){
addSubTween("frame", frameProxy, {frame:this.target.currentFrame}, {frame:_local5.frame}, {target:this.target});
};
if (((!(isNaN(this.vars.volume))) && (this.target.hasOwnProperty("soundTransform")))){
addSubTween("volume", volumeProxy, this.target.soundTransform, {volume:this.vars.volume}, {target:this.target});
};
for (_local3 in _local5) {
if ((((((((((((((((((((((((((((((((((((((_local3 == "ease")) || ((_local3 == "delay")))) || ((_local3 == "overwrite")))) || ((_local3 == "onComplete")))) || ((_local3 == "onCompleteParams")))) || ((_local3 == "runBackwards")))) || ((_local3 == "visible")))) || ((_local3 == "autoOverwrite")))) || ((_local3 == "persist")))) || ((_local3 == "onUpdate")))) || ((_local3 == "onUpdateParams")))) || ((_local3 == "autoAlpha")))) || ((((_local3 == "timeScale")) && (!((this.target is TweenLite))))))) || ((_local3 == "onStart")))) || ((_local3 == "onStartParams")))) || ((_local3 == "renderOnStart")))) || ((_local3 == "proxiedEase")))) || ((_local3 == "easeParams")))) || (((_arg1) && (!((_arg2.indexOf(((" " + _local3) + " ")) == -1))))))){
} else {
if (((!(((_isDisplayObject) && ((((((_local3 == "tint")) || ((_local3 == "removeTint")))) || ((_local3 == "frame"))))))) && (!((((_local3 == "volume")) && (this.target.hasOwnProperty("soundTransform"))))))){
if (typeof(_local5[_local3]) == "number"){
this.tweens[this.tweens.length] = {o:this.target, p:_local3, s:this.target[_local3], c:(_local5[_local3] - this.target[_local3]), name:_local3};
} else {
this.tweens[this.tweens.length] = {o:this.target, p:_local3, s:this.target[_local3], c:Number(_local5[_local3]), name:_local3};
};
};
};
};
};
if (this.vars.runBackwards == true){
_local4 = (this.tweens.length - 1);
while (_local4 > -1) {
_local9 = this.tweens[_local4];
this.tweens[_local4].s = (_local9.s + _local9.c);
_local9.c = (_local9.c * -1);
_local4--;
};
};
if ((((_local5.visible == true)) && (_isDisplayObject))){
this.target.visible = true;
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
_initted = true;
}
public function get active():Boolean{
if (_active){
return (true);
};
if (_curTime >= this.startTime){
_active = true;
if (!_initted){
initTweenVals();
} else {
if (((!((this.vars.visible == undefined))) && (_isDisplayObject))){
this.target.visible = true;
};
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
return (true);
//unresolved jump
};
return (false);
}
public function render(_arg1:uint):void{
var _local3:Number;
var _local4:Object;
var _local5:int;
var _local2:Number = ((_arg1 - this.startTime) / 1000);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = 1;
} else {
_local3 = this.vars.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.o[_local4.p] = (_local4.s + (_local3 * _local4.c));
_local5--;
};
if (_hst){
_local5 = (_subTweens.length - 1);
while (_local5 > -1) {
_subTweens[_local5].proxy(_subTweens[_local5]);
_local5--;
};
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.vars, this.tweens, _subTweens, []);
};
}
public function complete(_arg1:Boolean=false):void{
if (!_arg1){
if (!_initted){
initTweenVals();
};
this.startTime = (_curTime - ((this.duration * 1000) / _timeScale));
render(_curTime);
return;
};
if (((!((this.vars.visible == undefined))) && (_isDisplayObject))){
if (((!(isNaN(this.vars.autoAlpha))) && ((this.target.alpha == 0)))){
this.target.visible = false;
} else {
if (this.vars.runBackwards != true){
this.target.visible = this.vars.visible;
};
};
};
if (this.vars.persist != true){
removeTween(this);
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function frameProxy(_arg1:Object):void{
_arg1.info.target.gotoAndStop(Math.round(_arg1.target.frame));
}
public static function removeTween(_arg1:TweenLite=null):void{
if (((!((_arg1 == null))) && (!((_all[_arg1.target] == undefined))))){
_all[_arg1.target][_arg1] = null;
delete _all[_arg1.target][_arg1];
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Object;
var _local4:*;
if (((!((_arg1 == null))) && (!((_all[_arg1] == undefined))))){
if (_arg2){
_local3 = _all[_arg1];
for (_local4 in _local3) {
_local3[_local4].complete(false);
};
};
delete _all[_arg1];
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function executeAll(_arg1:Event=null):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:Object;
var _local2:uint = (_curTime = getTimer());
if (_listening){
_local3 = _all;
for each (_local4 in _local3) {
for (_local5 in _local4) {
if (((!((_local4[_local5] == undefined))) && (_local4[_local5].active))){
_local4[_local5].render(_local2);
};
};
};
};
}
public static function volumeProxy(_arg1:Object):void{
_arg1.info.target.soundTransform = _arg1.target;
}
public static function killGarbage(_arg1:TimerEvent):void{
var _local3:Boolean;
var _local4:Object;
var _local5:Object;
var _local6:Object;
var _local2:uint;
for (_local4 in _all) {
_local3 = false;
for (_local5 in _all[_local4]) {
_local3 = true;
break;
};
if (!_local3){
delete _all[_local4];
} else {
_local2++;
};
};
if (_local2 == 0){
_timer.removeEventListener("timer", killGarbage);
_timer.stop();
_listening = false;
};
}
public static function tintProxy(_arg1:Object):void{
var _local2:Number = _arg1.target.progress;
var _local3:Number = (1 - _local2);
var _local4:Object = _arg1.info.color;
var _local5:Object = _arg1.info.endColor;
_arg1.info.target.transform.colorTransform = new ColorTransform(((_local4.redMultiplier * _local3) + (_local5.redMultiplier * _local2)), ((_local4.greenMultiplier * _local3) + (_local5.greenMultiplier * _local2)), ((_local4.blueMultiplier * _local3) + (_local5.blueMultiplier * _local2)), ((_local4.alphaMultiplier * _local3) + (_local5.alphaMultiplier * _local2)), ((_local4.redOffset * _local3) + (_local5.redOffset * _local2)), ((_local4.greenOffset * _local3) + (_local5.greenOffset * _local2)), ((_local4.blueOffset * _local3) + (_local5.blueOffset * _local2)), ((_local4.alphaOffset * _local3) + (_local5.alphaOffset * _local2)));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 70
//BindabilityInfo (mx.binding.BindabilityInfo)
package mx.binding {
import mx.core.*;
import mx.events.*;
public class BindabilityInfo {
private var classChangeEvents:Object;
private var typeDescription:XML;
private var childChangeEvents:Object;
public static const METHOD:String = "method";
public static const ACCESSOR:String = "accessor";
public static const CHANGE_EVENT:String = "ChangeEvent";
public static const NON_COMMITTING_CHANGE_EVENT:String = "NonCommittingChangeEvent";
public static const BINDABLE:String = "Bindable";
mx_internal static const VERSION:String = "3.0.0.0";
public static const MANAGED:String = "Managed";
public function BindabilityInfo(_arg1:XML){
childChangeEvents = {};
super();
this.typeDescription = _arg1;
}
private function addChangeEvents(_arg1:XMLList, _arg2:Object, _arg3:Boolean):void{
var _local4:XML;
var _local5:XMLList;
var _local6:String;
for each (_local4 in _arg1) {
_local5 = _local4.arg;
if (_local5.length() > 0){
_local6 = _local5[0].@value;
_arg2[_local6] = _arg3;
} else {
trace((("warning: unconverted Bindable metadata in class '" + typeDescription.@name) + "'"));
};
};
}
private function getClassChangeEvents():Object{
if (!classChangeEvents){
classChangeEvents = {};
addBindabilityEvents(typeDescription.metadata, classChangeEvents);
if (typeDescription.metadata.(@name == MANAGED).length() > 0){
classChangeEvents[PropertyChangeEvent.PROPERTY_CHANGE] = true;
};
};
return (classChangeEvents);
}
private function addBindabilityEvents(_arg1:XMLList, _arg2:Object):void{
var metadata = _arg1;
var eventListObj = _arg2;
addChangeEvents(metadata.(@name == BINDABLE), eventListObj, true);
addChangeEvents(metadata.(@name == CHANGE_EVENT), eventListObj, true);
addChangeEvents(metadata.(@name == NON_COMMITTING_CHANGE_EVENT), eventListObj, false);
}
private function copyProps(_arg1:Object, _arg2:Object):Object{
var _local3:String;
for (_local3 in _arg1) {
_arg2[_local3] = _arg1[_local3];
};
return (_arg2);
}
public function getChangeEvents(_arg1:String):Object{
var childDesc:XMLList;
var numChildren:int;
var childName = _arg1;
var changeEvents:Object = childChangeEvents[childName];
if (!changeEvents){
changeEvents = copyProps(getClassChangeEvents(), {});
childDesc = (typeDescription.accessor.(@name == childName) + typeDescription.method.(@name == childName));
numChildren = childDesc.length();
if (numChildren == 0){
if (!typeDescription.@dynamic){
trace((((("warning: no describeType entry for '" + childName) + "' on non-dynamic type '") + typeDescription.@name) + "'"));
};
} else {
if (numChildren > 1){
trace(((((("warning: multiple describeType entries for '" + childName) + "' on type '") + typeDescription.@name) + "':\n") + childDesc));
};
addBindabilityEvents(childDesc.metadata, changeEvents);
};
childChangeEvents[childName] = changeEvents;
};
return (changeEvents);
}
}
}//package mx.binding
Section 71
//CollectionViewError (mx.collections.errors.CollectionViewError)
package mx.collections.errors {
import mx.core.*;
public class CollectionViewError extends Error {
mx_internal static const VERSION:String = "3.0.0.0";
public function CollectionViewError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 72
//CursorError (mx.collections.errors.CursorError)
package mx.collections.errors {
import mx.core.*;
public class CursorError extends Error {
mx_internal static const VERSION:String = "3.0.0.0";
public function CursorError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 73
//ItemPendingError (mx.collections.errors.ItemPendingError)
package mx.collections.errors {
import mx.core.*;
import mx.rpc.*;
public class ItemPendingError extends Error {
private var _responders:Array;
mx_internal static const VERSION:String = "3.0.0.0";
public function ItemPendingError(_arg1:String){
super(_arg1);
}
public function get responders():Array{
return (_responders);
}
public function addResponder(_arg1:IResponder):void{
if (!_responders){
_responders = [];
};
_responders.push(_arg1);
}
}
}//package mx.collections.errors
Section 74
//SortError (mx.collections.errors.SortError)
package mx.collections.errors {
import mx.core.*;
public class SortError extends Error {
mx_internal static const VERSION:String = "3.0.0.0";
public function SortError(_arg1:String){
super(_arg1);
}
}
}//package mx.collections.errors
Section 75
//ArrayCollection (mx.collections.ArrayCollection)
package mx.collections {
import mx.core.*;
import flash.utils.*;
public class ArrayCollection extends ListCollectionView implements IExternalizable {
mx_internal static const VERSION:String = "3.0.0.0";
public function ArrayCollection(_arg1:Array=null){
this.source = _arg1;
}
public function set source(_arg1:Array):void{
list = new ArrayList(_arg1);
}
public function readExternal(_arg1:IDataInput):void{
if ((list is IExternalizable)){
IExternalizable(list).readExternal(_arg1);
} else {
source = (_arg1.readObject() as Array);
};
}
public function writeExternal(_arg1:IDataOutput):void{
if ((list is IExternalizable)){
IExternalizable(list).writeExternal(_arg1);
} else {
_arg1.writeObject(source);
};
}
public function get source():Array{
if (((list) && ((list is ArrayList)))){
return (ArrayList(list).source);
};
return (null);
}
}
}//package mx.collections
Section 76
//ArrayList (mx.collections.ArrayList)
package mx.collections {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import mx.events.*;
import mx.resources.*;
import mx.utils.*;
public class ArrayList extends EventDispatcher implements IList, IExternalizable, IPropertyChangeNotifier {
private var _source:Array;
private var _dispatchEvents:int;// = 0
private var _uid:String;
private var resourceManager:IResourceManager;
mx_internal static const VERSION:String = "3.0.0.0";
public function ArrayList(_arg1:Array=null){
resourceManager = ResourceManager.getInstance();
super();
disableEvents();
this.source = _arg1;
enableEvents();
_uid = UIDUtil.createUID();
}
public function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
var _local5:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.UPDATE;
_local5.source = _arg1;
_local5.property = _arg2;
_local5.oldValue = _arg3;
_local5.newValue = _arg4;
itemUpdateHandler(_local5);
}
public function readExternal(_arg1:IDataInput):void{
source = _arg1.readObject();
}
private function internalDispatchEvent(_arg1:String, _arg2:Object=null, _arg3:int=-1):void{
var _local4:CollectionEvent;
var _local5:PropertyChangeEvent;
if (_dispatchEvents == 0){
if (hasEventListener(CollectionEvent.COLLECTION_CHANGE)){
_local4 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local4.kind = _arg1;
_local4.items.push(_arg2);
_local4.location = _arg3;
dispatchEvent(_local4);
};
if (((hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)) && ((((_arg1 == CollectionEventKind.ADD)) || ((_arg1 == CollectionEventKind.REMOVE)))))){
_local5 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.property = _arg3;
if (_arg1 == CollectionEventKind.ADD){
_local5.newValue = _arg2;
} else {
_local5.oldValue = _arg2;
};
dispatchEvent(_local5);
};
};
}
public function removeAll():void{
var _local1:int;
var _local2:int;
if (length > 0){
_local1 = length;
_local2 = 0;
while (_local2 < _local1) {
stopTrackUpdates(source[_local2]);
_local2++;
};
source.splice(0, length);
internalDispatchEvent(CollectionEventKind.RESET);
};
}
public function removeItemAt(_arg1:int):Object{
var _local3:String;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
_local3 = resourceManager.getString("collections", "outOfBounds", [_arg1]);
throw (new RangeError(_local3));
};
var _local2:Object = source.splice(_arg1, 1)[0];
stopTrackUpdates(_local2);
internalDispatchEvent(CollectionEventKind.REMOVE, _local2, _arg1);
return (_local2);
}
public function get uid():String{
return (_uid);
}
public function getItemIndex(_arg1:Object):int{
return (ArrayUtil.getItemIndex(_arg1, source));
}
public function writeExternal(_arg1:IDataOutput):void{
_arg1.writeObject(_source);
}
public function addItem(_arg1:Object):void{
addItemAt(_arg1, length);
}
public function toArray():Array{
return (source.concat());
}
private function disableEvents():void{
_dispatchEvents--;
}
public function get source():Array{
return (_source);
}
public function getItemAt(_arg1:int, _arg2:int=0):Object{
var _local3:String;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
_local3 = resourceManager.getString("collections", "outOfBounds", [_arg1]);
throw (new RangeError(_local3));
};
return (source[_arg1]);
}
public function set uid(_arg1:String):void{
_uid = _arg1;
}
public function setItemAt(_arg1:Object, _arg2:int):Object{
var _local4:String;
var _local5:Boolean;
var _local6:Boolean;
var _local7:PropertyChangeEvent;
var _local8:CollectionEvent;
if ((((_arg2 < 0)) || ((_arg2 >= length)))){
_local4 = resourceManager.getString("collections", "outOfBounds", [_arg2]);
throw (new RangeError(_local4));
};
var _local3:Object = source[_arg2];
source[_arg2] = _arg1;
stopTrackUpdates(_local3);
startTrackUpdates(_arg1);
if (_dispatchEvents == 0){
_local5 = hasEventListener(CollectionEvent.COLLECTION_CHANGE);
_local6 = hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
if (((_local5) || (_local6))){
_local7 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local7.kind = PropertyChangeEventKind.UPDATE;
_local7.oldValue = _local3;
_local7.newValue = _arg1;
_local7.property = _arg2;
};
if (_local5){
_local8 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local8.kind = CollectionEventKind.REPLACE;
_local8.location = _arg2;
_local8.items.push(_local7);
dispatchEvent(_local8);
};
if (_local6){
dispatchEvent(_local7);
};
};
return (_local3);
}
public function get length():int{
if (source){
return (source.length);
};
return (0);
}
protected function stopTrackUpdates(_arg1:Object):void{
if (((_arg1) && ((_arg1 is IEventDispatcher)))){
IEventDispatcher(_arg1).removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, itemUpdateHandler);
};
}
protected function itemUpdateHandler(_arg1:PropertyChangeEvent):void{
var _local2:PropertyChangeEvent;
var _local3:uint;
internalDispatchEvent(CollectionEventKind.UPDATE, _arg1);
if ((((_dispatchEvents == 0)) && (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)))){
_local2 = PropertyChangeEvent(_arg1.clone());
_local3 = getItemIndex(_arg1.target);
_local2.property = ((_local3.toString() + ".") + _arg1.property);
dispatchEvent(_local2);
};
}
public function addItemAt(_arg1:Object, _arg2:int):void{
var _local3:String;
if ((((_arg2 < 0)) || ((_arg2 > length)))){
_local3 = resourceManager.getString("collections", "outOfBounds", [_arg2]);
throw (new RangeError(_local3));
};
source.splice(_arg2, 0, _arg1);
startTrackUpdates(_arg1);
internalDispatchEvent(CollectionEventKind.ADD, _arg1, _arg2);
}
public function removeItem(_arg1:Object):Boolean{
var _local2:int = getItemIndex(_arg1);
var _local3 = (_local2 >= 0);
if (_local3){
removeItemAt(_local2);
};
return (_local3);
}
protected function startTrackUpdates(_arg1:Object):void{
if (((_arg1) && ((_arg1 is IEventDispatcher)))){
IEventDispatcher(_arg1).addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, itemUpdateHandler, false, 0, true);
};
}
override public function toString():String{
if (source){
return (source.toString());
};
return (getQualifiedClassName(this));
}
private function enableEvents():void{
_dispatchEvents++;
if (_dispatchEvents > 0){
_dispatchEvents = 0;
};
}
public function set source(_arg1:Array):void{
var _local2:int;
var _local3:int;
var _local4:CollectionEvent;
if (((_source) && (_source.length))){
_local3 = _source.length;
_local2 = 0;
while (_local2 < _local3) {
stopTrackUpdates(_source[_local2]);
_local2++;
};
};
_source = (_arg1) ? _arg1 : [];
_local3 = _source.length;
_local2 = 0;
while (_local2 < _local3) {
startTrackUpdates(_source[_local2]);
_local2++;
};
if (_dispatchEvents == 0){
_local4 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local4.kind = CollectionEventKind.RESET;
dispatchEvent(_local4);
};
}
}
}//package mx.collections
Section 77
//CursorBookmark (mx.collections.CursorBookmark)
package mx.collections {
import mx.core.*;
public class CursorBookmark {
private var _value:Object;
mx_internal static const VERSION:String = "3.0.0.0";
private static var _first:CursorBookmark;
private static var _last:CursorBookmark;
private static var _current:CursorBookmark;
public function CursorBookmark(_arg1:Object){
_value = _arg1;
}
public function get value():Object{
return (_value);
}
public function getViewIndex():int{
return (-1);
}
public static function get LAST():CursorBookmark{
if (!_last){
_last = new CursorBookmark("${L}");
};
return (_last);
}
public static function get FIRST():CursorBookmark{
if (!_first){
_first = new CursorBookmark("${F}");
};
return (_first);
}
public static function get CURRENT():CursorBookmark{
if (!_current){
_current = new CursorBookmark("${C}");
};
return (_current);
}
}
}//package mx.collections
Section 78
//ICollectionView (mx.collections.ICollectionView)
package mx.collections {
import flash.events.*;
public interface ICollectionView extends IEventDispatcher {
function set filterFunction(_arg1:Function):void;
function enableAutoUpdate():void;
function get length():int;
function disableAutoUpdate():void;
function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void;
function get filterFunction():Function;
function createCursor():IViewCursor;
function refresh():Boolean;
function set sort(_arg1:Sort):void;
function get sort():Sort;
function contains(_arg1:Object):Boolean;
}
}//package mx.collections
Section 79
//IList (mx.collections.IList)
package mx.collections {
import flash.events.*;
public interface IList extends IEventDispatcher {
function addItem(_arg1:Object):void;
function get length():int;
function addItemAt(_arg1:Object, _arg2:int):void;
function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void;
function getItemIndex(_arg1:Object):int;
function removeItemAt(_arg1:int):Object;
function getItemAt(_arg1:int, _arg2:int=0):Object;
function removeAll():void;
function toArray():Array;
function setItemAt(_arg1:Object, _arg2:int):Object;
}
}//package mx.collections
Section 80
//ItemResponder (mx.collections.ItemResponder)
package mx.collections {
import mx.core.*;
import mx.rpc.*;
public class ItemResponder implements IResponder {
private var _faultHandler:Function;
private var _token:Object;
private var _resultHandler:Function;
mx_internal static const VERSION:String = "3.0.0.0";
public function ItemResponder(_arg1:Function, _arg2:Function, _arg3:Object=null){
_resultHandler = _arg1;
_faultHandler = _arg2;
_token = _arg3;
}
public function result(_arg1:Object):void{
_resultHandler(_arg1, _token);
}
public function fault(_arg1:Object):void{
_faultHandler(_arg1, _token);
}
}
}//package mx.collections
Section 81
//IViewCursor (mx.collections.IViewCursor)
package mx.collections {
import flash.events.*;
public interface IViewCursor extends IEventDispatcher {
function get current():Object;
function moveNext():Boolean;
function get view():ICollectionView;
function movePrevious():Boolean;
function remove():Object;
function findLast(_arg1:Object):Boolean;
function get beforeFirst():Boolean;
function get afterLast():Boolean;
function findAny(_arg1:Object):Boolean;
function get bookmark():CursorBookmark;
function findFirst(_arg1:Object):Boolean;
function seek(_arg1:CursorBookmark, _arg2:int=0, _arg3:int=0):void;
function insert(_arg1:Object):void;
}
}//package mx.collections
Section 82
//ListCollectionView (mx.collections.ListCollectionView)
package mx.collections {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import mx.events.*;
import mx.resources.*;
import mx.utils.*;
import mx.collections.errors.*;
public class ListCollectionView extends Proxy implements ICollectionView, IList, IMXMLObject {
private var autoUpdateCounter:int;
private var _list:IList;
private var _filterFunction:Function;
protected var localIndex:Array;
mx_internal var dispatchResetEvent:Boolean;// = true
private var pendingUpdates:Array;
private var resourceManager:IResourceManager;
private var eventDispatcher:EventDispatcher;
private var revision:int;
private var _sort:Sort;
mx_internal static const VERSION:String = "3.0.0.0";
public function ListCollectionView(_arg1:IList=null){
resourceManager = ResourceManager.getInstance();
super();
eventDispatcher = new EventDispatcher(this);
this.list = _arg1;
}
private function handlePendingUpdates():void{
var _local1:Array;
var _local2:CollectionEvent;
var _local3:int;
var _local4:CollectionEvent;
var _local5:int;
if (pendingUpdates){
_local1 = pendingUpdates;
pendingUpdates = null;
_local3 = 0;
while (_local3 < _local1.length) {
_local4 = _local1[_local3];
if (_local4.kind == CollectionEventKind.UPDATE){
if (!_local2){
_local2 = _local4;
} else {
_local5 = 0;
while (_local5 < _local4.items.length) {
_local2.items.push(_local4.items[_local5]);
_local5++;
};
};
} else {
listChangeHandler(_local4);
};
_local3++;
};
if (_local2){
listChangeHandler(_local2);
};
};
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
private function replaceItemsInView(_arg1:Array, _arg2:int, _arg3:Boolean=true):void{
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:int;
var _local8:PropertyChangeEvent;
var _local9:CollectionEvent;
if (localIndex){
_local4 = _arg1.length;
_local5 = [];
_local6 = [];
_local7 = 0;
while (_local7 < _local4) {
_local8 = _arg1[_local7];
_local5.push(_local8.oldValue);
_local6.push(_local8.newValue);
_local7++;
};
removeItemsFromView(_local5, _arg2, _arg3);
addItemsToView(_local6, _arg2, _arg3);
} else {
_local9 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local9.kind = CollectionEventKind.REPLACE;
_local9.location = _arg2;
_local9.items = _arg1;
dispatchEvent(_local9);
};
}
public function willTrigger(_arg1:String):Boolean{
return (eventDispatcher.willTrigger(_arg1));
}
private function getFilteredItemIndex(_arg1:Object):int{
var _local4:Object;
var _local5:int;
var _local6:int;
var _local2:int = list.getItemIndex(_arg1);
if (_local2 == 0){
return (0);
};
var _local3:int = (_local2 - 1);
while (_local3 >= 0) {
_local4 = list.getItemAt(_local3);
if (filterFunction(_local4)){
_local5 = localIndex.length;
_local6 = 0;
while (_local6 < _local5) {
if (localIndex[_local6] == _local4){
return ((_local6 + 1));
};
_local6++;
};
};
_local3--;
};
return (0);
}
mx_internal function findItem(_arg1:Object, _arg2:String, _arg3:Boolean=false):int{
var _local4:String;
if (!sort){
_local4 = resourceManager.getString("collections", "itemNotFound");
throw (new CollectionViewError(_local4));
};
if (localIndex.length == 0){
return ((_arg3) ? 0 : -1);
};
return (sort.findItem(localIndex, _arg1, _arg2, _arg3));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return ((_arg1 - 1).toString());
}
public function removeAll():void{
var _local2:int;
var _local1:int = length;
if (_local1 > 0){
if (localIndex){
_local2 = (_local1 - 1);
while (_local2 >= 0) {
removeItemAt(_local2);
_local2--;
};
} else {
list.removeAll();
};
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
var n:Number;
var name = _arg1;
if ((name is QName)){
name = name.localName;
};
var index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
return (false);
};
return ((((index >= 0)) && ((index < length))));
}
public function getItemAt(_arg1:int, _arg2:int=0):Object{
var _local3:String;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
_local3 = resourceManager.getString("collections", "outOfBounds", [_arg1]);
throw (new RangeError(_local3));
};
if (localIndex){
return (localIndex[_arg1]);
};
if (list){
return (list.getItemAt(_arg1, _arg2));
};
return (null);
}
private function moveItemInView(_arg1:Object, _arg2:Boolean=true, _arg3:Array=null):void{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:CollectionEvent;
if (localIndex){
_local4 = -1;
_local5 = 0;
while (_local5 < localIndex.length) {
if (localIndex[_local5] == _arg1){
_local4 = _local5;
break;
};
_local5++;
};
if (_local4 > -1){
localIndex.splice(_local4, 1);
};
_local6 = addItemsToView([_arg1], _local4, false);
if (_arg2){
_local7 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local7.items.push(_arg1);
if (((((_arg3) && ((_local6 == _local4)))) && ((_local6 > -1)))){
_arg3.push(_arg1);
return;
};
if ((((_local6 > -1)) && ((_local4 > -1)))){
_local7.kind = CollectionEventKind.MOVE;
_local7.location = _local6;
_local7.oldLocation = _local4;
} else {
if (_local6 > -1){
_local7.kind = CollectionEventKind.ADD;
_local7.location = _local6;
} else {
if (_local4 > -1){
_local7.kind = CollectionEventKind.REMOVE;
_local7.location = _local4;
} else {
_arg2 = false;
};
};
};
if (_arg2){
dispatchEvent(_local7);
};
};
};
}
public function contains(_arg1:Object):Boolean{
return (!((getItemIndex(_arg1) == -1)));
}
public function get sort():Sort{
return (_sort);
}
private function removeItemsFromView(_arg1:Array, _arg2:int, _arg3:Boolean=true):void{
var _local6:int;
var _local7:Object;
var _local8:int;
var _local9:CollectionEvent;
var _local4:Array = (localIndex) ? [] : _arg1;
var _local5:int = _arg2;
if (localIndex){
_local6 = 0;
while (_local6 < _arg1.length) {
_local7 = _arg1[_local6];
_local8 = getItemIndex(_local7);
if (_local8 > -1){
localIndex.splice(_local8, 1);
_local4.push(_local7);
_local5 = _local8;
};
_local6++;
};
};
if (((_arg3) && ((_local4.length > 0)))){
_local9 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local9.kind = CollectionEventKind.REMOVE;
_local9.location = (((!(localIndex)) || ((_local4.length == 1)))) ? _local5 : -1;
_local9.items = _local4;
dispatchEvent(_local9);
};
}
public function get list():IList{
return (_list);
}
public function addItemAt(_arg1:Object, _arg2:int):void{
var _local4:String;
if ((((((_arg2 < 0)) || (!(list)))) || ((_arg2 > length)))){
_local4 = resourceManager.getString("collections", "outOfBounds", [_arg2]);
throw (new RangeError(_local4));
};
var _local3:int = _arg2;
if (((localIndex) && (sort))){
_local3 = list.length;
} else {
if (((localIndex) && (!((filterFunction == null))))){
if (_local3 == localIndex.length){
_local3 = list.length;
} else {
_local3 = list.getItemIndex(localIndex[_arg2]);
};
};
};
list.addItemAt(_arg1, _local3);
}
public function itemUpdated(_arg1:Object, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
list.itemUpdated(_arg1, _arg2, _arg3, _arg4);
}
private function populateLocalIndex():void{
if (list){
localIndex = list.toArray();
} else {
localIndex = [];
};
}
private function handlePropertyChangeEvents(_arg1:Array):void{
var _local3:Array;
var _local4:Object;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:PropertyChangeEvent;
var _local9:Object;
var _local10:Boolean;
var _local11:int;
var _local12:int;
var _local13:CollectionEvent;
var _local2:Array = _arg1;
if (((sort) || (!((filterFunction == null))))){
_local3 = [];
_local5 = 0;
while (_local5 < _arg1.length) {
_local8 = _arg1[_local5];
if (_local8.target){
_local9 = _local8.target;
_local10 = !((_local8.target == _local8.source));
} else {
_local9 = _local8.source;
_local10 = false;
};
_local11 = 0;
while (_local11 < _local3.length) {
if (_local3[_local11].item == _local9){
break;
};
_local11++;
};
if (_local11 < _local3.length){
_local4 = _local3[_local11];
} else {
_local4 = {item:_local9, move:_local10, event:_local8};
_local3.push(_local4);
};
_local4.move = ((((((_local4.move) || (filterFunction))) || (!(_local8.property)))) || (((sort) && (sort.propertyAffectsSort(String(_local8.property))))));
_local5++;
};
_local2 = [];
_local5 = 0;
while (_local5 < _local3.length) {
_local4 = _local3[_local5];
if (_local4.move){
moveItemInView(_local4.item, _local4.item, _local2);
} else {
_local2.push(_local4.item);
};
_local5++;
};
_local6 = [];
_local7 = 0;
while (_local7 < _local2.length) {
_local12 = 0;
while (_local12 < _local3.length) {
if (_local2[_local7] == _local3[_local12].item){
_local6.push(_local3[_local12].event);
};
_local12++;
};
_local7++;
};
_local2 = _local6;
};
if (_local2.length > 0){
_local13 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local13.kind = CollectionEventKind.UPDATE;
_local13.items = _local2;
dispatchEvent(_local13);
};
}
public function set sort(_arg1:Sort):void{
_sort = _arg1;
dispatchEvent(new Event("sortChanged"));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
return (getItemAt((_arg1 - 1)));
}
public function setItemAt(_arg1:Object, _arg2:int):Object{
var _local4:String;
var _local5:Object;
if ((((((_arg2 < 0)) || (!(list)))) || ((_arg2 >= length)))){
_local4 = resourceManager.getString("collections", "outOfBounds", [_arg2]);
throw (new RangeError(_local4));
};
var _local3:int = _arg2;
if (localIndex){
if (_arg2 > localIndex.length){
_local3 = list.length;
} else {
_local5 = localIndex[_arg2];
_local3 = list.getItemIndex(_local5);
};
};
return (list.setItemAt(_arg1, _local3));
}
mx_internal function getBookmark(_arg1:int):ListCollectionViewBookmark{
var value:Object;
var message:String;
var index = _arg1;
if ((((index < 0)) || ((index > length)))){
message = resourceManager.getString("collections", "invalidIndex", [index]);
throw (new CollectionViewError(message));
};
try {
value = getItemAt(index);
} catch(e:Error) {
value = null;
};
return (new ListCollectionViewBookmark(value, this, revision, index));
}
private function addItemsToView(_arg1:Array, _arg2:int, _arg3:Boolean=true):int{
var _local7:int;
var _local8:int;
var _local9:Object;
var _local10:String;
var _local11:CollectionEvent;
var _local4:Array = (localIndex) ? [] : _arg1;
var _local5:int = _arg2;
var _local6:Boolean;
if (localIndex){
_local7 = _arg2;
_local8 = 0;
while (_local8 < _arg1.length) {
_local9 = _arg1[_local8];
if ((((filterFunction == null)) || (filterFunction(_local9)))){
if (sort){
_local7 = findItem(_local9, Sort.ANY_INDEX_MODE, true);
if (_local6){
_local5 = _local7;
_local6 = false;
};
} else {
_local7 = getFilteredItemIndex(_local9);
if (_local6){
_local5 = _local7;
_local6 = false;
};
};
if (((((sort) && (sort.unique))) && ((sort.compareFunction(_local9, localIndex[_local7]) == 0)))){
_local10 = resourceManager.getString("collections", "incorrectAddition");
throw (new CollectionViewError(_local10));
};
var _temp1 = _local7;
_local7 = (_local7 + 1);
localIndex.splice(_temp1, 0, _local9);
_local4.push(_local9);
} else {
_local5 = -1;
};
_local8++;
};
};
if (((localIndex) && ((_local4.length > 1)))){
_local5 = -1;
};
if (((_arg3) && ((_local4.length > 0)))){
_local11 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local11.kind = CollectionEventKind.ADD;
_local11.location = _local5;
_local11.items = _local4;
dispatchEvent(_local11);
};
return (_local5);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (eventDispatcher.dispatchEvent(_arg1));
}
public function set list(_arg1:IList):void{
var _local2:Boolean;
var _local3:Boolean;
if (_list != _arg1){
if (_list){
_list.removeEventListener(CollectionEvent.COLLECTION_CHANGE, listChangeHandler);
_local2 = (_list.length > 0);
};
_list = _arg1;
if (_list){
_list.addEventListener(CollectionEvent.COLLECTION_CHANGE, listChangeHandler, false, 0, true);
_local3 = (_list.length > 0);
};
if (((_local2) || (_local3))){
reset();
};
dispatchEvent(new Event("listChanged"));
};
}
mx_internal function getBookmarkIndex(_arg1:CursorBookmark):int{
var _local3:String;
if (((!((_arg1 is ListCollectionViewBookmark))) || (!((ListCollectionViewBookmark(_arg1).view == this))))){
_local3 = resourceManager.getString("collections", "bookmarkNotFound");
throw (new CollectionViewError(_local3));
};
var _local2:ListCollectionViewBookmark = ListCollectionViewBookmark(_arg1);
if (_local2.viewRevision != revision){
if ((((((_local2.index < 0)) || ((_local2.index >= length)))) || (!((getItemAt(_local2.index) == _local2.value))))){
_local2.index = getItemIndex(_local2.value);
};
_local2.viewRevision = revision;
};
return (_local2.index);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function getItemIndex(_arg1:Object):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
if (sort){
_local3 = sort.findItem(localIndex, _arg1, Sort.FIRST_INDEX_MODE);
if (_local3 == -1){
return (-1);
};
_local4 = sort.findItem(localIndex, _arg1, Sort.LAST_INDEX_MODE);
_local2 = _local3;
while (_local2 <= _local4) {
if (localIndex[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
} else {
if (filterFunction != null){
_local5 = localIndex.length;
_local2 = 0;
while (_local2 < _local5) {
if (localIndex[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
};
};
return (list.getItemIndex(_arg1));
}
public function removeItemAt(_arg1:int):Object{
var _local3:String;
var _local4:Object;
if ((((_arg1 < 0)) || ((_arg1 >= length)))){
_local3 = resourceManager.getString("collections", "outOfBounds", [_arg1]);
throw (new RangeError(_local3));
};
var _local2:int = _arg1;
if (localIndex){
_local4 = localIndex[_arg1];
_local2 = list.getItemIndex(_local4);
};
return (list.removeItemAt(_local2));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var n:Number;
var message:String;
var name = _arg1;
if ((name is QName)){
name = name.localName;
};
var index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
message = resourceManager.getString("collections", "unknownProperty", [name]);
throw (new Error(message));
};
return (getItemAt(index));
}
public function enableAutoUpdate():void{
if (autoUpdateCounter > 0){
autoUpdateCounter--;
if (autoUpdateCounter == 0){
handlePendingUpdates();
};
};
}
mx_internal function reset():void{
var _local1:CollectionEvent;
internalRefresh(false);
if (dispatchResetEvent){
_local1 = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
_local1.kind = CollectionEventKind.RESET;
dispatchEvent(_local1);
};
}
public function toArray():Array{
var _local1:Array;
if (localIndex){
_local1 = localIndex.concat();
} else {
_local1 = list.toArray();
};
return (_local1);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
return (null);
}
public function initialized(_arg1:Object, _arg2:String):void{
refresh();
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var n:Number;
var message:String;
var name = _arg1;
var value = _arg2;
if ((name is QName)){
name = name.localName;
};
var index = -1;
try {
n = parseInt(String(name));
if (!isNaN(n)){
index = int(n);
};
} catch(e:Error) {
};
if (index == -1){
message = resourceManager.getString("collections", "unknownProperty", [name]);
throw (new Error(message));
};
setItemAt(value, index);
}
public function addItem(_arg1:Object):void{
addItemAt(_arg1, length);
}
private function internalRefresh(_arg1:Boolean):Boolean{
var tmp:Array;
var len:int;
var i:int;
var item:Object;
var refreshEvent:CollectionEvent;
var dispatch = _arg1;
if (((sort) || (!((filterFunction == null))))){
try {
populateLocalIndex();
} catch(pending:ItemPendingError) {
pending.addResponder(new ItemResponder(function (_arg1:Object, _arg2:Object=null):void{
internalRefresh(dispatch);
}, function (_arg1:Object, _arg2:Object=null):void{
}));
return (false);
};
if (filterFunction != null){
tmp = [];
len = localIndex.length;
i = 0;
while (i < len) {
item = localIndex[i];
if (filterFunction(item)){
tmp.push(item);
};
i = (i + 1);
};
localIndex = tmp;
};
if (sort){
sort.sort(localIndex);
dispatch = true;
};
} else {
if (localIndex){
localIndex = null;
};
};
revision++;
pendingUpdates = null;
if (dispatch){
refreshEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
refreshEvent.kind = CollectionEventKind.REFRESH;
dispatchEvent(refreshEvent);
};
return (true);
}
public function set filterFunction(_arg1:Function):void{
_filterFunction = _arg1;
dispatchEvent(new Event("filterFunctionChanged"));
}
public function refresh():Boolean{
return (internalRefresh(true));
}
public function get filterFunction():Function{
return (_filterFunction);
}
public function createCursor():IViewCursor{
return (new ListCollectionViewCursor(this));
}
public function hasEventListener(_arg1:String):Boolean{
return (eventDispatcher.hasEventListener(_arg1));
}
public function get length():int{
if (localIndex){
return (localIndex.length);
};
if (list){
return (list.length);
};
return (0);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1 < length)) ? (_arg1 + 1) : 0);
}
public function disableAutoUpdate():void{
autoUpdateCounter++;
}
public function toString():String{
if (localIndex){
return (ObjectUtil.toString(localIndex));
};
if (((list) && (Object(list).toString))){
return (Object(list).toString());
};
return (getQualifiedClassName(this));
}
private function listChangeHandler(_arg1:CollectionEvent):void{
if (autoUpdateCounter > 0){
if (!pendingUpdates){
pendingUpdates = [];
};
pendingUpdates.push(_arg1);
} else {
switch (_arg1.kind){
case CollectionEventKind.ADD:
addItemsToView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.RESET:
reset();
break;
case CollectionEventKind.REMOVE:
removeItemsFromView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.REPLACE:
replaceItemsInView(_arg1.items, _arg1.location);
break;
case CollectionEventKind.UPDATE:
handlePropertyChangeEvents(_arg1.items);
break;
default:
dispatchEvent(_arg1);
};
};
}
}
}//package mx.collections
import flash.events.*;
import mx.core.*;
import mx.events.*;
import mx.resources.*;
import mx.collections.errors.*;
class ListCollectionViewBookmark extends CursorBookmark {
mx_internal var viewRevision:int;
mx_internal var index:int;
mx_internal var view:ListCollectionView;
private function ListCollectionViewBookmark(_arg1:Object, _arg2:ListCollectionView, _arg3:int, _arg4:int){
super(_arg1);
this.view = _arg2;
this.viewRevision = _arg3;
this.index = _arg4;
}
override public function getViewIndex():int{
return (view.getBookmarkIndex(this));
}
}
class ListCollectionViewCursor extends EventDispatcher implements IViewCursor {
private var _view:ListCollectionView;
private var invalid:Boolean;
private var resourceManager:IResourceManager;
private var currentIndex:int;
private var currentValue:Object;
private static const BEFORE_FIRST_INDEX:int = -1;
private static const AFTER_LAST_INDEX:int = -2;
private function ListCollectionViewCursor(_arg1:ListCollectionView){
var view = _arg1;
resourceManager = ResourceManager.getInstance();
super();
_view = view;
_view.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionEventHandler, false, 0, true);
currentIndex = ((view.length > 0)) ? 0 : AFTER_LAST_INDEX;
if (currentIndex == 0){
try {
setCurrent(view.getItemAt(0), false);
} catch(e:ItemPendingError) {
currentIndex = BEFORE_FIRST_INDEX;
setCurrent(null, false);
};
};
}
public function findAny(_arg1:Object):Boolean{
var index:int;
var values = _arg1;
checkValid();
var lcView:ListCollectionView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.ANY_INDEX_MODE);
} catch(e:SortError) {
throw (new CursorError(e.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
public function remove():Object{
var oldIndex:int;
var message:String;
if (((beforeFirst) || (afterLast))){
message = resourceManager.getString("collections", "invalidRemove");
throw (new CursorError(message));
};
oldIndex = currentIndex;
currentIndex++;
if (currentIndex >= view.length){
currentIndex = AFTER_LAST_INDEX;
setCurrent(null);
} else {
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(e:ItemPendingError) {
setCurrent(null, false);
ListCollectionView(view).removeItemAt(oldIndex);
throw (e);
};
};
var removed:Object = ListCollectionView(view).removeItemAt(oldIndex);
return (removed);
}
private function setCurrent(_arg1:Object, _arg2:Boolean=true):void{
currentValue = _arg1;
if (_arg2){
dispatchEvent(new FlexEvent(FlexEvent.CURSOR_UPDATE));
};
}
public function seek(_arg1:CursorBookmark, _arg2:int=0, _arg3:int=0):void{
var message:String;
var bookmark = _arg1;
var offset = _arg2;
var prefetch = _arg3;
checkValid();
if (view.length == 0){
currentIndex = AFTER_LAST_INDEX;
setCurrent(null, false);
return;
};
var newIndex:int = currentIndex;
if (bookmark == CursorBookmark.FIRST){
newIndex = 0;
} else {
if (bookmark == CursorBookmark.LAST){
newIndex = (view.length - 1);
} else {
if (bookmark != CursorBookmark.CURRENT){
try {
newIndex = ListCollectionView(view).getBookmarkIndex(bookmark);
if (newIndex < 0){
setCurrent(null);
message = resourceManager.getString("collections", "bookmarkInvalid");
throw (new CursorError(message));
};
} catch(bmError:CollectionViewError) {
message = resourceManager.getString("collections", "bookmarkInvalid");
throw (new CursorError(message));
};
};
};
};
newIndex = (newIndex + offset);
var newCurrent:Object;
if (newIndex >= view.length){
currentIndex = AFTER_LAST_INDEX;
} else {
if (newIndex < 0){
currentIndex = BEFORE_FIRST_INDEX;
} else {
newCurrent = ListCollectionView(view).getItemAt(newIndex, prefetch);
currentIndex = newIndex;
};
};
setCurrent(newCurrent);
}
public function insert(_arg1:Object):void{
var _local2:int;
var _local3:String;
if (afterLast){
_local2 = view.length;
} else {
if (beforeFirst){
if (view.length > 0){
_local3 = resourceManager.getString("collections", "invalidInsert");
throw (new CursorError(_local3));
};
_local2 = 0;
} else {
_local2 = currentIndex;
};
};
ListCollectionView(view).addItemAt(_arg1, _local2);
}
public function get afterLast():Boolean{
checkValid();
return ((((currentIndex == AFTER_LAST_INDEX)) || ((view.length == 0))));
}
private function checkValid():void{
var _local1:String;
if (invalid){
_local1 = resourceManager.getString("collections", "invalidCursor");
throw (new CursorError(_local1));
};
}
private function collectionEventHandler(_arg1:CollectionEvent):void{
var event = _arg1;
switch (event.kind){
case CollectionEventKind.ADD:
if (event.location <= currentIndex){
currentIndex = (currentIndex + event.items.length);
};
break;
case CollectionEventKind.REMOVE:
if (event.location < currentIndex){
currentIndex = (currentIndex - event.items.length);
} else {
if (event.location == currentIndex){
if (currentIndex < view.length){
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(error:ItemPendingError) {
setCurrent(null, false);
};
} else {
currentIndex = AFTER_LAST_INDEX;
setCurrent(null);
};
};
};
break;
case CollectionEventKind.MOVE:
if (event.oldLocation == currentIndex){
currentIndex = event.location;
} else {
if (event.oldLocation < currentIndex){
currentIndex = (currentIndex - event.items.length);
};
if (event.location <= currentIndex){
currentIndex = (currentIndex + event.items.length);
};
};
break;
case CollectionEventKind.REFRESH:
if (!((beforeFirst) || (afterLast))){
currentIndex = ListCollectionView(view).getItemIndex(currentValue);
if (currentIndex == -1){
setCurrent(null);
};
};
break;
case CollectionEventKind.REPLACE:
if (event.location == currentIndex){
try {
setCurrent(ListCollectionView(view).getItemAt(currentIndex));
} catch(error:ItemPendingError) {
setCurrent(null, false);
};
};
break;
case CollectionEventKind.RESET:
currentIndex = BEFORE_FIRST_INDEX;
setCurrent(null);
break;
};
}
public function moveNext():Boolean{
if (afterLast){
return (false);
};
var _local1:int = (beforeFirst) ? 0 : (currentIndex + 1);
if (_local1 >= view.length){
_local1 = AFTER_LAST_INDEX;
setCurrent(null);
} else {
setCurrent(ListCollectionView(view).getItemAt(_local1));
};
currentIndex = _local1;
return (!(afterLast));
}
public function get view():ICollectionView{
checkValid();
return (_view);
}
public function movePrevious():Boolean{
if (beforeFirst){
return (false);
};
var _local1:int = (afterLast) ? (view.length - 1) : (currentIndex - 1);
if (_local1 == -1){
_local1 = BEFORE_FIRST_INDEX;
setCurrent(null);
} else {
setCurrent(ListCollectionView(view).getItemAt(_local1));
};
currentIndex = _local1;
return (!(beforeFirst));
}
public function findLast(_arg1:Object):Boolean{
var index:int;
var values = _arg1;
checkValid();
var lcView:ListCollectionView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.LAST_INDEX_MODE);
} catch(sortError:SortError) {
throw (new CursorError(sortError.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
public function get beforeFirst():Boolean{
checkValid();
return ((((currentIndex == BEFORE_FIRST_INDEX)) || ((view.length == 0))));
}
public function get bookmark():CursorBookmark{
checkValid();
if ((((view.length == 0)) || (beforeFirst))){
return (CursorBookmark.FIRST);
};
if (afterLast){
return (CursorBookmark.LAST);
};
return (ListCollectionView(view).getBookmark(currentIndex));
}
public function findFirst(_arg1:Object):Boolean{
var index:int;
var values = _arg1;
checkValid();
var lcView:ListCollectionView = ListCollectionView(view);
try {
index = lcView.findItem(values, Sort.FIRST_INDEX_MODE);
} catch(sortError:SortError) {
throw (new CursorError(sortError.message));
};
if (index > -1){
currentIndex = index;
setCurrent(lcView.getItemAt(currentIndex));
};
return ((index > -1));
}
public function get current():Object{
checkValid();
return (currentValue);
}
}
Section 83
//Sort (mx.collections.Sort)
package mx.collections {
import flash.events.*;
import mx.core.*;
import mx.resources.*;
import mx.utils.*;
import mx.collections.errors.*;
public class Sort extends EventDispatcher {
private var noFieldsDescending:Boolean;// = false
private var usingCustomCompareFunction:Boolean;
private var defaultEmptyField:SortField;
private var _fields:Array;
private var _compareFunction:Function;
private var _unique:Boolean;
private var fieldList:Array;
private var resourceManager:IResourceManager;
public static const ANY_INDEX_MODE:String = "any";
mx_internal static const VERSION:String = "3.0.0.0";
public static const LAST_INDEX_MODE:String = "last";
public static const FIRST_INDEX_MODE:String = "first";
public function Sort(){
resourceManager = ResourceManager.getInstance();
fieldList = [];
super();
}
public function get unique():Boolean{
return (_unique);
}
public function get compareFunction():Function{
return ((usingCustomCompareFunction) ? _compareFunction : internalCompare);
}
public function set unique(_arg1:Boolean):void{
_unique = _arg1;
}
public function sort(_arg1:Array):void{
var fixedCompareFunction:Function;
var message:String;
var uniqueRet1:Object;
var fields:Array;
var i:int;
var sortArgs:Object;
var uniqueRet2:Object;
var items = _arg1;
if (((!(items)) || ((items.length <= 1)))){
return;
};
if (usingCustomCompareFunction){
fixedCompareFunction = function (_arg1:Object, _arg2:Object):int{
return (compareFunction(_arg1, _arg2, _fields));
};
if (unique){
uniqueRet1 = items.sort(fixedCompareFunction, Array.UNIQUESORT);
if (uniqueRet1 == 0){
message = resourceManager.getString("collections", "nonUnique");
throw (new SortError(message));
};
} else {
items.sort(fixedCompareFunction);
};
} else {
fields = this.fields;
if (((fields) && ((fields.length > 0)))){
sortArgs = initSortFields(items[0], true);
if (unique){
if (((sortArgs) && ((fields.length == 1)))){
uniqueRet2 = items.sortOn(sortArgs.fields[0], (sortArgs.options[0] | Array.UNIQUESORT));
} else {
uniqueRet2 = items.sort(internalCompare, Array.UNIQUESORT);
};
if (uniqueRet2 == 0){
message = resourceManager.getString("collections", "nonUnique");
throw (new SortError(message));
};
} else {
if (sortArgs){
items.sortOn(sortArgs.fields, sortArgs.options);
} else {
items.sort(internalCompare);
};
};
} else {
items.sort(internalCompare);
};
};
}
public function propertyAffectsSort(_arg1:String):Boolean{
var _local3:SortField;
if (((usingCustomCompareFunction) || (!(fields)))){
return (true);
};
var _local2:int;
while (_local2 < fields.length) {
_local3 = fields[_local2];
if ((((_local3.name == _arg1)) || (_local3.usingCustomCompareFunction))){
return (true);
};
_local2++;
};
return (false);
}
private function internalCompare(_arg1:Object, _arg2:Object, _arg3:Array=null):int{
var _local5:int;
var _local6:int;
var _local7:SortField;
var _local4:int;
if (!_fields){
_local4 = noFieldsCompare(_arg1, _arg2);
} else {
_local5 = 0;
_local6 = (_arg3) ? _arg3.length : _fields.length;
while ((((_local4 == 0)) && ((_local5 < _local6)))) {
_local7 = SortField(_fields[_local5]);
_local4 = _local7.internalCompare(_arg1, _arg2);
_local5++;
};
};
return (_local4);
}
public function reverse():void{
var _local1:int;
if (fields){
_local1 = 0;
while (_local1 < fields.length) {
SortField(fields[_local1]).reverse();
_local1++;
};
};
noFieldsDescending = !(noFieldsDescending);
}
private function noFieldsCompare(_arg1:Object, _arg2:Object, _arg3:Array=null):int{
var message:String;
var a = _arg1;
var b = _arg2;
var fields = _arg3;
if (!defaultEmptyField){
defaultEmptyField = new SortField();
try {
defaultEmptyField.initCompare(a);
} catch(e:SortError) {
message = resourceManager.getString("collections", "noComparator", [a]);
throw (new SortError(message));
};
};
var result:int = defaultEmptyField.compareFunction(a, b);
if (noFieldsDescending){
result = (result * -1);
};
return (result);
}
public function findItem(_arg1:Array, _arg2:Object, _arg3:String, _arg4:Boolean=false, _arg5:Function=null):int{
var compareForFind:Function;
var fieldsForCompare:Array;
var message:String;
var index:int;
var fieldName:String;
var hadPreviousFieldName:Boolean;
var i:int;
var hasFieldName:Boolean;
var objIndex:int;
var match:Boolean;
var prevCompare:int;
var nextCompare:int;
var items = _arg1;
var values = _arg2;
var mode = _arg3;
var returnInsertionIndex = _arg4;
var compareFunction = _arg5;
if (!items){
message = resourceManager.getString("collections", "noItems");
throw (new SortError(message));
};
if (items.length == 0){
return ((returnInsertionIndex) ? 1 : -1);
};
if (compareFunction == null){
compareForFind = this.compareFunction;
if (((values) && ((fieldList.length > 0)))){
fieldsForCompare = [];
hadPreviousFieldName = true;
i = 0;
while (i < fieldList.length) {
fieldName = fieldList[i];
if (fieldName){
try {
hasFieldName = !((values[fieldName] === undefined));
} catch(e:Error) {
hasFieldName = false;
};
if (hasFieldName){
if (!hadPreviousFieldName){
message = resourceManager.getString("collections", "findCondition", [fieldName]);
throw (new SortError(message));
};
fieldsForCompare.push(fieldName);
} else {
hadPreviousFieldName = false;
};
} else {
fieldsForCompare.push(null);
};
i = (i + 1);
};
if (fieldsForCompare.length == 0){
message = resourceManager.getString("collections", "findRestriction");
throw (new SortError(message));
};
try {
initSortFields(items[0]);
} catch(initSortError:SortError) {
};
};
} else {
compareForFind = compareFunction;
};
var found:Boolean;
var objFound:Boolean;
index = 0;
var lowerBound:int;
var upperBound:int = (items.length - 1);
var obj:Object;
var direction = 1;
while (((!(objFound)) && ((lowerBound <= upperBound)))) {
index = Math.round(((lowerBound + upperBound) / 2));
obj = items[index];
direction = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
switch (direction){
case -1:
upperBound = (index - 1);
break;
case 0:
objFound = true;
switch (mode){
case ANY_INDEX_MODE:
found = true;
break;
case FIRST_INDEX_MODE:
found = (index == lowerBound);
objIndex = (index - 1);
match = true;
while (((((match) && (!(found)))) && ((objIndex >= lowerBound)))) {
obj = items[objIndex];
prevCompare = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
match = (prevCompare == 0);
if (((!(match)) || (((match) && ((objIndex == lowerBound)))))){
found = true;
index = (objIndex + (match) ? 0 : 1);
};
objIndex = (objIndex - 1);
};
break;
case LAST_INDEX_MODE:
found = (index == upperBound);
objIndex = (index + 1);
match = true;
while (((((match) && (!(found)))) && ((objIndex <= upperBound)))) {
obj = items[objIndex];
nextCompare = (fieldsForCompare) ? compareForFind(values, obj, fieldsForCompare) : compareForFind(values, obj);
match = (nextCompare == 0);
if (((!(match)) || (((match) && ((objIndex == upperBound)))))){
found = true;
index = (objIndex - (match) ? 0 : 1);
};
objIndex = (objIndex + 1);
};
break;
default:
message = resourceManager.getString("collections", "unknownMode");
throw (new SortError(message));
};
break;
case 1:
lowerBound = (index + 1);
break;
};
};
if (((!(found)) && (!(returnInsertionIndex)))){
return (-1);
};
return (((direction)>0) ? (index + 1) : index);
}
private function initSortFields(_arg1:Object, _arg2:Boolean=false):Object{
var _local4:int;
var _local5:SortField;
var _local6:int;
var _local3:Object;
_local4 = 0;
while (_local4 < fields.length) {
SortField(fields[_local4]).initCompare(_arg1);
_local4++;
};
if (_arg2){
_local3 = {fields:[], options:[]};
_local4 = 0;
while (_local4 < fields.length) {
_local5 = fields[_local4];
_local6 = _local5.getArraySortOnOptions();
if (_local6 == -1){
return (null);
};
_local3.fields.push(_local5.name);
_local3.options.push(_local6);
_local4++;
};
};
return (_local3);
}
public function set fields(_arg1:Array):void{
var _local2:SortField;
var _local3:int;
_fields = _arg1;
fieldList = [];
if (_fields){
_local3 = 0;
while (_local3 < _fields.length) {
_local2 = SortField(_fields[_local3]);
fieldList.push(_local2.name);
_local3++;
};
};
dispatchEvent(new Event("fieldsChanged"));
}
public function get fields():Array{
return (_fields);
}
public function set compareFunction(_arg1:Function):void{
_compareFunction = _arg1;
usingCustomCompareFunction = !((_compareFunction == null));
}
override public function toString():String{
return (ObjectUtil.toString(this));
}
}
}//package mx.collections
Section 84
//SortField (mx.collections.SortField)
package mx.collections {
import flash.events.*;
import mx.core.*;
import mx.resources.*;
import mx.utils.*;
import mx.collections.errors.*;
public class SortField extends EventDispatcher {
private var _caseInsensitive:Boolean;
private var _numeric:Object;
private var _descending:Boolean;
private var _compareFunction:Function;
private var _usingCustomCompareFunction:Boolean;
private var _name:String;
private var resourceManager:IResourceManager;
mx_internal static const VERSION:String = "3.0.0.0";
public function SortField(_arg1:String=null, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Object=null){
resourceManager = ResourceManager.getInstance();
super();
_name = _arg1;
_caseInsensitive = _arg2;
_descending = _arg3;
_numeric = _arg4;
_compareFunction = stringCompare;
}
public function get caseInsensitive():Boolean{
return (_caseInsensitive);
}
mx_internal function get usingCustomCompareFunction():Boolean{
return (_usingCustomCompareFunction);
}
public function set caseInsensitive(_arg1:Boolean):void{
if (_arg1 != _caseInsensitive){
_caseInsensitive = _arg1;
dispatchEvent(new Event("caseInsensitiveChanged"));
};
}
public function get name():String{
return (_name);
}
public function get numeric():Object{
return (_numeric);
}
public function set name(_arg1:String):void{
_name = _arg1;
dispatchEvent(new Event("nameChanged"));
}
private function numericCompare(_arg1:Object, _arg2:Object):int{
var fa:Number;
var fb:Number;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? Number(a) : Number(a[_name]);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? Number(b) : Number(b[_name]);
} catch(error:Error) {
};
return (ObjectUtil.numericCompare(fa, fb));
}
public function set numeric(_arg1:Object):void{
if (_numeric != _arg1){
_numeric = _arg1;
dispatchEvent(new Event("numericChanged"));
};
}
private function stringCompare(_arg1:Object, _arg2:Object):int{
var fa:String;
var fb:String;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? String(a) : String(a[_name]);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? String(b) : String(b[_name]);
} catch(error:Error) {
};
return (ObjectUtil.stringCompare(fa, fb, _caseInsensitive));
}
public function get compareFunction():Function{
return (_compareFunction);
}
public function reverse():void{
descending = !(descending);
}
mx_internal function getArraySortOnOptions():int{
if (((((((usingCustomCompareFunction) || ((name == null)))) || ((_compareFunction == xmlCompare)))) || ((_compareFunction == dateCompare)))){
return (-1);
};
var _local1:int;
if (caseInsensitive){
_local1 = (_local1 | Array.CASEINSENSITIVE);
};
if (descending){
_local1 = (_local1 | Array.DESCENDING);
};
if ((((numeric == true)) || ((_compareFunction == numericCompare)))){
_local1 = (_local1 | Array.NUMERIC);
};
return (_local1);
}
private function dateCompare(_arg1:Object, _arg2:Object):int{
var fa:Date;
var fb:Date;
var a = _arg1;
var b = _arg2;
try {
fa = ((_name == null)) ? (a as Date) : (a[_name] as Date);
} catch(error:Error) {
};
try {
fb = ((_name == null)) ? (b as Date) : (b[_name] as Date);
} catch(error:Error) {
};
return (ObjectUtil.dateCompare(fa, fb));
}
mx_internal function internalCompare(_arg1:Object, _arg2:Object):int{
var _local3:int = compareFunction(_arg1, _arg2);
if (descending){
_local3 = (_local3 * -1);
};
return (_local3);
}
override public function toString():String{
return (ObjectUtil.toString(this));
}
private function nullCompare(_arg1:Object, _arg2:Object):int{
var value:Object;
var left:Object;
var right:Object;
var message:String;
var a = _arg1;
var b = _arg2;
var found:Boolean;
if ((((a == null)) && ((b == null)))){
return (0);
};
if (_name){
try {
left = a[_name];
} catch(error:Error) {
};
try {
right = b[_name];
} catch(error:Error) {
};
};
if ((((left == null)) && ((right == null)))){
return (0);
};
if (left == null){
left = a;
};
if (right == null){
right = b;
};
var typeLeft = typeof(left);
var typeRight = typeof(right);
if ((((typeLeft == "string")) || ((typeRight == "string")))){
found = true;
_compareFunction = stringCompare;
} else {
if ((((typeLeft == "object")) || ((typeRight == "object")))){
if ((((typeLeft is Date)) || ((typeRight is Date)))){
found = true;
_compareFunction = dateCompare;
};
} else {
if ((((typeLeft == "xml")) || ((typeRight == "xml")))){
found = true;
_compareFunction = xmlCompare;
} else {
if ((((((((typeLeft == "number")) || ((typeRight == "number")))) || ((typeLeft == "boolean")))) || ((typeRight == "boolean")))){
found = true;
_compareFunction = numericCompare;
};
};
};
};
if (found){
return (_compareFunction(left, right));
};
message = resourceManager.getString("collections", "noComparatorSortField", [name]);
throw (new SortError(message));
}
public function set descending(_arg1:Boolean):void{
if (_descending != _arg1){
_descending = _arg1;
dispatchEvent(new Event("descendingChanged"));
};
}
mx_internal function initCompare(_arg1:Object):void{
var value:Object;
var typ:String;
var test:String;
var obj = _arg1;
if (!usingCustomCompareFunction){
if (numeric == true){
_compareFunction = numericCompare;
} else {
if (((caseInsensitive) || ((numeric == false)))){
_compareFunction = stringCompare;
} else {
if (_name){
try {
value = obj[_name];
} catch(error:Error) {
};
};
if (value == null){
value = obj;
};
typ = typeof(value);
switch (typ){
case "string":
_compareFunction = stringCompare;
break;
case "object":
if ((value is Date)){
_compareFunction = dateCompare;
} else {
_compareFunction = stringCompare;
try {
test = value.toString();
} catch(error2:Error) {
};
if (((!(test)) || ((test == "[object Object]")))){
_compareFunction = nullCompare;
};
};
break;
case "xml":
_compareFunction = xmlCompare;
break;
case "boolean":
case "number":
_compareFunction = numericCompare;
break;
};
};
};
};
}
public function get descending():Boolean{
return (_descending);
}
public function set compareFunction(_arg1:Function):void{
_compareFunction = _arg1;
_usingCustomCompareFunction = !((_arg1 == null));
}
private function xmlCompare(_arg1:Object, _arg2:Object):int{
var sa:String;
var sb:String;
var a = _arg1;
var b = _arg2;
try {
sa = ((_name == null)) ? a.toString() : a[_name].toString();
} catch(error:Error) {
};
try {
sb = ((_name == null)) ? b.toString() : b[_name].toString();
} catch(error:Error) {
};
if (numeric == true){
return (ObjectUtil.numericCompare(parseFloat(sa), parseFloat(sb)));
};
return (ObjectUtil.stringCompare(sa, sb, _caseInsensitive));
}
}
}//package mx.collections
Section 85
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 86
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 87
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 88
//FlexSprite (mx.core.FlexSprite)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexSprite extends Sprite {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexSprite(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 89
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 90
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 91
//IButton (mx.core.IButton)
package mx.core {
public interface IButton extends IUIComponent {
function get emphasized():Boolean;
function set emphasized(_arg1:Boolean):void;
function callLater(_arg1:Function, _arg2:Array=null):void;
}
}//package mx.core
Section 92
//IChildList (mx.core.IChildList)
package mx.core {
import flash.geom.*;
import flash.display.*;
public interface IChildList {
function get numChildren():int;
function removeChild(_arg1:DisplayObject):DisplayObject;
function getChildByName(_arg1:String):DisplayObject;
function removeChildAt(_arg1:int):DisplayObject;
function getChildIndex(_arg1:DisplayObject):int;
function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject;
function getObjectsUnderPoint(_arg1:Point):Array;
function setChildIndex(_arg1:DisplayObject, _arg2:int):void;
function getChildAt(_arg1:int):DisplayObject;
function addChild(_arg1:DisplayObject):DisplayObject;
function contains(_arg1:DisplayObject):Boolean;
}
}//package mx.core
Section 93
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 94
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 95
//IFlexModuleFactory (mx.core.IFlexModuleFactory)
package mx.core {
public interface IFlexModuleFactory {
function create(... _args):Object;
function info():Object;
}
}//package mx.core
Section 96
//IMXMLObject (mx.core.IMXMLObject)
package mx.core {
public interface IMXMLObject {
function initialized(_arg1:Object, _arg2:String):void;
}
}//package mx.core
Section 97
//IPropertyChangeNotifier (mx.core.IPropertyChangeNotifier)
package mx.core {
import flash.events.*;
public interface IPropertyChangeNotifier extends IEventDispatcher, IUID {
}
}//package mx.core
Section 98
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 99
//IUIComponent (mx.core.IUIComponent)
package mx.core {
import flash.display.*;
import mx.managers.*;
public interface IUIComponent extends IFlexDisplayObject {
function set focusPane(_arg1:Sprite):void;
function get enabled():Boolean;
function set enabled(_arg1:Boolean):void;
function set isPopUp(_arg1:Boolean):void;
function get explicitMinHeight():Number;
function get percentWidth():Number;
function get isPopUp():Boolean;
function get owner():DisplayObjectContainer;
function get percentHeight():Number;
function get baselinePosition():Number;
function owns(_arg1:DisplayObject):Boolean;
function initialize():void;
function get maxWidth():Number;
function get minWidth():Number;
function getExplicitOrMeasuredWidth():Number;
function get explicitMaxWidth():Number;
function get explicitMaxHeight():Number;
function set percentHeight(_arg1:Number):void;
function get minHeight():Number;
function set percentWidth(_arg1:Number):void;
function get document():Object;
function get focusPane():Sprite;
function getExplicitOrMeasuredHeight():Number;
function set tweeningProperties(_arg1:Array):void;
function set explicitWidth(_arg1:Number):void;
function set measuredMinHeight(_arg1:Number):void;
function get explicitMinWidth():Number;
function get tweeningProperties():Array;
function get maxHeight():Number;
function set owner(_arg1:DisplayObjectContainer):void;
function set includeInLayout(_arg1:Boolean):void;
function setVisible(_arg1:Boolean, _arg2:Boolean=false):void;
function parentChanged(_arg1:DisplayObjectContainer):void;
function get explicitWidth():Number;
function get measuredMinHeight():Number;
function set measuredMinWidth(_arg1:Number):void;
function set explicitHeight(_arg1:Number):void;
function get includeInLayout():Boolean;
function get measuredMinWidth():Number;
function get explicitHeight():Number;
function set systemManager(_arg1:ISystemManager):void;
function set document(_arg1:Object):void;
function get systemManager():ISystemManager;
}
}//package mx.core
Section 100
//IUID (mx.core.IUID)
package mx.core {
public interface IUID {
function get uid():String;
function set uid(_arg1:String):void;
}
}//package mx.core
Section 101
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 102
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in _local1)){
_local1["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 103
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 104
//Singleton (mx.core.Singleton)
package mx.core {
public class Singleton {
mx_internal static const VERSION:String = "3.0.0.0";
private static var classMap:Object = {};
public static function registerClass(_arg1:String, _arg2:Class):void{
var _local3:Class = classMap[_arg1];
if (!_local3){
classMap[_arg1] = _arg2;
};
}
public static function getClass(_arg1:String):Class{
return (classMap[_arg1]);
}
public static function getInstance(_arg1:String):Object{
var _local2:Class = classMap[_arg1];
if (!_local2){
throw (new Error((("No class registered for interface '" + _arg1) + "'.")));
};
return (_local2["getInstance"]());
}
}
}//package mx.core
Section 105
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 106
//SpriteAsset (mx.core.SpriteAsset)
package mx.core {
public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function SpriteAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 107
//CollectionEvent (mx.events.CollectionEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class CollectionEvent extends Event {
public var kind:String;
public var location:int;
public var items:Array;
public var oldLocation:int;
mx_internal static const VERSION:String = "3.0.0.0";
public static const COLLECTION_CHANGE:String = "collectionChange";
public function CollectionEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:int=-1, _arg6:int=-1, _arg7:Array=null){
super(_arg1, _arg2, _arg3);
this.kind = _arg4;
this.location = _arg5;
this.oldLocation = _arg6;
this.items = (_arg7) ? _arg7 : [];
}
override public function toString():String{
return (formatToString("CollectionEvent", "kind", "location", "oldLocation", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new CollectionEvent(type, bubbles, cancelable, kind, location, oldLocation, items));
}
}
}//package mx.events
Section 108
//CollectionEventKind (mx.events.CollectionEventKind)
package mx.events {
import mx.core.*;
public final class CollectionEventKind {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const UPDATE:String = "update";
public static const MOVE:String = "move";
mx_internal static const EXPAND:String = "expand";
public static const REPLACE:String = "replace";
mx_internal static const VERSION:String = "3.0.0.0";
public static const REFRESH:String = "refresh";
public static const RESET:String = "reset";
}
}//package mx.events
Section 109
//FlexEvent (mx.events.FlexEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class FlexEvent extends Event {
public static const ADD:String = "add";
public static const TRANSFORM_CHANGE:String = "transformChange";
public static const INIT_COMPLETE:String = "initComplete";
public static const REMOVE:String = "remove";
public static const BUTTON_DOWN:String = "buttonDown";
public static const EXIT_STATE:String = "exitState";
public static const CREATION_COMPLETE:String = "creationComplete";
public static const REPEAT:String = "repeat";
public static const LOADING:String = "loading";
public static const REPEAT_START:String = "repeatStart";
public static const INITIALIZE:String = "initialize";
public static const ENTER_STATE:String = "enterState";
public static const URL_CHANGED:String = "urlChanged";
public static const REPEAT_END:String = "repeatEnd";
mx_internal static const VERSION:String = "3.0.0.0";
public static const HIDE:String = "hide";
public static const ENTER:String = "enter";
public static const PRELOADER_DONE:String = "preloaderDone";
public static const CURSOR_UPDATE:String = "cursorUpdate";
public static const PREINITIALIZE:String = "preinitialize";
public static const INVALID:String = "invalid";
public static const IDLE:String = "idle";
public static const VALID:String = "valid";
public static const DATA_CHANGE:String = "dataChange";
public static const APPLICATION_COMPLETE:String = "applicationComplete";
public static const VALUE_COMMIT:String = "valueCommit";
public static const UPDATE_COMPLETE:String = "updateComplete";
public static const INIT_PROGRESS:String = "initProgress";
public static const SHOW:String = "show";
public function FlexEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function clone():Event{
return (new FlexEvent(type, bubbles, cancelable));
}
}
}//package mx.events
Section 110
//ModuleEvent (mx.events.ModuleEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
import mx.modules.*;
public class ModuleEvent extends ProgressEvent {
public var errorText:String;
private var _module:IModuleInfo;
public static const READY:String = "ready";
public static const ERROR:String = "error";
public static const PROGRESS:String = "progress";
mx_internal static const VERSION:String = "3.0.0.0";
public static const SETUP:String = "setup";
public static const UNLOAD:String = "unload";
public function ModuleEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:String=null, _arg7:IModuleInfo=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.errorText = _arg6;
this._module = _arg7;
}
public function get module():IModuleInfo{
if (_module){
return (_module);
};
return ((target as IModuleInfo));
}
override public function clone():Event{
return (new ModuleEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText, module));
}
}
}//package mx.events
Section 111
//PropertyChangeEvent (mx.events.PropertyChangeEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class PropertyChangeEvent extends Event {
public var newValue:Object;
public var kind:String;
public var property:Object;
public var oldValue:Object;
public var source:Object;
mx_internal static const VERSION:String = "3.0.0.0";
public static const PROPERTY_CHANGE:String = "propertyChange";
public function PropertyChangeEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:Object=null, _arg6:Object=null, _arg7:Object=null, _arg8:Object=null){
super(_arg1, _arg2, _arg3);
this.kind = _arg4;
this.property = _arg5;
this.oldValue = _arg6;
this.newValue = _arg7;
this.source = _arg8;
}
override public function clone():Event{
return (new PropertyChangeEvent(type, bubbles, cancelable, kind, property, oldValue, newValue, source));
}
public static function createUpdateEvent(_arg1:Object, _arg2:Object, _arg3:Object, _arg4:Object):PropertyChangeEvent{
var _local5:PropertyChangeEvent = new PropertyChangeEvent(PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.UPDATE;
_local5.oldValue = _arg3;
_local5.newValue = _arg4;
_local5.source = _arg1;
_local5.property = _arg2;
return (_local5);
}
}
}//package mx.events
Section 112
//PropertyChangeEventKind (mx.events.PropertyChangeEventKind)
package mx.events {
import mx.core.*;
public final class PropertyChangeEventKind {
mx_internal static const VERSION:String = "3.0.0.0";
public static const UPDATE:String = "update";
public static const DELETE:String = "delete";
}
}//package mx.events
Section 113
//ResourceEvent (mx.events.ResourceEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class ResourceEvent extends ProgressEvent {
public var errorText:String;
mx_internal static const VERSION:String = "3.0.0.0";
public static const COMPLETE:String = "complete";
public static const PROGRESS:String = "progress";
public static const ERROR:String = "error";
public function ResourceEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:String=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.errorText = _arg6;
}
override public function clone():Event{
return (new ResourceEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText));
}
}
}//package mx.events
Section 114
//InvalidCategoryError (mx.logging.errors.InvalidCategoryError)
package mx.logging.errors {
import mx.core.*;
public class InvalidCategoryError extends Error {
mx_internal static const VERSION:String = "3.0.0.0";
public function InvalidCategoryError(_arg1:String){
super(_arg1);
}
public function toString():String{
return (String(message));
}
}
}//package mx.logging.errors
Section 115
//ILogger (mx.logging.ILogger)
package mx.logging {
import flash.events.*;
public interface ILogger extends IEventDispatcher {
function debug(_arg1:String, ... _args):void;
function fatal(_arg1:String, ... _args):void;
function get category():String;
function warn(_arg1:String, ... _args):void;
function error(_arg1:String, ... _args):void;
function log(_arg1:int, _arg2:String, ... _args):void;
function info(_arg1:String, ... _args):void;
}
}//package mx.logging
Section 116
//ILoggingTarget (mx.logging.ILoggingTarget)
package mx.logging {
public interface ILoggingTarget {
function addLogger(_arg1:ILogger):void;
function removeLogger(_arg1:ILogger):void;
function get level():int;
function set filters(_arg1:Array):void;
function set level(_arg1:int):void;
function get filters():Array;
}
}//package mx.logging
Section 117
//Log (mx.logging.Log)
package mx.logging {
import mx.core.*;
import mx.resources.*;
import mx.logging.errors.*;
public class Log {
mx_internal static const VERSION:String = "3.0.0.0";
private static var _resourceManager:IResourceManager;
private static var _targets:Array = [];
private static var _loggers:Array;
private static var NONE:int = 2147483647;
private static var _targetLevel:int = NONE;
private static function categoryMatchInFilterList(_arg1:String, _arg2:Array):Boolean{
var _local4:String;
var _local3:Boolean;
var _local5 = -1;
var _local6:uint;
while (_local6 < _arg2.length) {
_local4 = _arg2[_local6];
_local5 = _local4.indexOf("*");
if (_local5 == 0){
return (true);
};
_local5 = ((_local5 < 0)) ? _local5 = _arg1.length;
_local5 : (_local5 - 1);
if (_arg1.substring(0, _local5) == _local4.substring(0, _local5)){
return (true);
};
_local6++;
};
return (false);
}
public static function flush():void{
_loggers = [];
_targets = [];
_targetLevel = NONE;
}
public static function isDebug():Boolean{
return (((_targetLevel)<=LogEventLevel.DEBUG) ? true : false);
}
public static function getLogger(_arg1:String):ILogger{
var _local3:ILoggingTarget;
checkCategory(_arg1);
if (!_loggers){
_loggers = [];
};
var _local2:ILogger = _loggers[_arg1];
if (_local2 == null){
_local2 = new LogLogger(_arg1);
_loggers[_arg1] = _local2;
};
var _local4:int;
while (_local4 < _targets.length) {
_local3 = ILoggingTarget(_targets[_local4]);
if (categoryMatchInFilterList(_arg1, _local3.filters)){
_local3.addLogger(_local2);
};
_local4++;
};
return (_local2);
}
public static function isWarn():Boolean{
return (((_targetLevel)<=LogEventLevel.WARN) ? true : false);
}
public static function addTarget(_arg1:ILoggingTarget):void{
var _local2:Array;
var _local3:ILogger;
var _local4:String;
var _local5:String;
if (_arg1){
_local2 = _arg1.filters;
for (_local4 in _loggers) {
if (categoryMatchInFilterList(_local4, _local2)){
_arg1.addLogger(ILogger(_loggers[_local4]));
};
};
_targets.push(_arg1);
if (_targetLevel == NONE){
_targetLevel = _arg1.level;
} else {
if (_arg1.level < _targetLevel){
_targetLevel = _arg1.level;
};
};
} else {
_local5 = resourceManager.getString("logging", "invalidTarget");
throw (new ArgumentError(_local5));
};
}
public static function hasIllegalCharacters(_arg1:String):Boolean{
return (!((_arg1.search(/[\[\]\~\$\^\&\\(\)\{\}\+\?\/=`!@#%,:;'"<>\s]/) == -1)));
}
private static function checkCategory(_arg1:String):void{
var _local2:String;
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
_local2 = resourceManager.getString("logging", "invalidLen");
throw (new InvalidCategoryError(_local2));
};
if (((hasIllegalCharacters(_arg1)) || (!((_arg1.indexOf("*") == -1))))){
_local2 = resourceManager.getString("logging", "invalidChars");
throw (new InvalidCategoryError(_local2));
};
}
private static function resetTargetLevel():void{
var _local1:int = NONE;
var _local2:int;
while (_local2 < _targets.length) {
if ((((_local1 == NONE)) || ((_targets[_local2].level < _local1)))){
_local1 = _targets[_local2].level;
};
_local2++;
};
_targetLevel = _local1;
}
public static function removeTarget(_arg1:ILoggingTarget):void{
var _local2:Array;
var _local3:ILogger;
var _local4:String;
var _local5:int;
var _local6:String;
if (_arg1){
_local2 = _arg1.filters;
for (_local4 in _loggers) {
if (categoryMatchInFilterList(_local4, _local2)){
_arg1.removeLogger(ILogger(_loggers[_local4]));
};
};
_local5 = 0;
while (_local5 < _targets.length) {
if (_arg1 == _targets[_local5]){
_targets.splice(_local5, 1);
_local5--;
};
_local5++;
};
resetTargetLevel();
} else {
_local6 = resourceManager.getString("logging", "invalidTarget");
throw (new ArgumentError(_local6));
};
}
public static function isInfo():Boolean{
return (((_targetLevel)<=LogEventLevel.INFO) ? true : false);
}
public static function isFatal():Boolean{
return (((_targetLevel)<=LogEventLevel.FATAL) ? true : false);
}
public static function isError():Boolean{
return (((_targetLevel)<=LogEventLevel.ERROR) ? true : false);
}
private static function get resourceManager():IResourceManager{
if (!_resourceManager){
_resourceManager = ResourceManager.getInstance();
};
return (_resourceManager);
}
}
}//package mx.logging
Section 118
//LogEvent (mx.logging.LogEvent)
package mx.logging {
import flash.events.*;
import mx.core.*;
public class LogEvent extends Event {
public var level:int;
public var message:String;
mx_internal static const VERSION:String = "3.0.0.0";
public static const LOG:String = "log";
public function LogEvent(_arg1:String="", _arg2:int=0){
super(LogEvent.LOG, false, false);
this.message = _arg1;
this.level = _arg2;
}
override public function clone():Event{
return (new LogEvent(message, level));
}
public static function getLevelString(_arg1:uint):String{
switch (_arg1){
case LogEventLevel.INFO:
return ("INFO");
case LogEventLevel.DEBUG:
return ("DEBUG");
case LogEventLevel.ERROR:
return ("ERROR");
case LogEventLevel.WARN:
return ("WARN");
case LogEventLevel.FATAL:
return ("FATAL");
case LogEventLevel.ALL:
return ("ALL");
};
return ("UNKNOWN");
}
}
}//package mx.logging
Section 119
//LogEventLevel (mx.logging.LogEventLevel)
package mx.logging {
import mx.core.*;
public final class LogEventLevel {
public static const ALL:int = 0;
public static const FATAL:int = 1000;
public static const WARN:int = 6;
public static const INFO:int = 4;
public static const ERROR:int = 8;
public static const DEBUG:int = 2;
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.logging
Section 120
//LogLogger (mx.logging.LogLogger)
package mx.logging {
import flash.events.*;
import mx.core.*;
import mx.resources.*;
public class LogLogger extends EventDispatcher implements ILogger {
private var _category:String;
private var resourceManager:IResourceManager;
mx_internal static const VERSION:String = "3.0.0.0";
public function LogLogger(_arg1:String){
resourceManager = ResourceManager.getInstance();
super();
_category = _arg1;
}
public function log(_arg1:int, _arg2:String, ... _args):void{
var _local4:String;
var _local5:int;
if (_arg1 < LogEventLevel.DEBUG){
_local4 = resourceManager.getString("logging", "levelLimit");
throw (new ArgumentError(_local4));
};
if (hasEventListener(LogEvent.LOG)){
_local5 = 0;
while (_local5 < _args.length) {
_arg2 = _arg2.replace(new RegExp((("\\{" + _local5) + "\\}"), "g"), _args[_local5]);
_local5++;
};
dispatchEvent(new LogEvent(_arg2, _arg1));
};
}
public function error(_arg1:String, ... _args):void{
var _local3:int;
if (hasEventListener(LogEvent.LOG)){
_local3 = 0;
while (_local3 < _args.length) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local3) + "\\}"), "g"), _args[_local3]);
_local3++;
};
dispatchEvent(new LogEvent(_arg1, LogEventLevel.ERROR));
};
}
public function warn(_arg1:String, ... _args):void{
var _local3:int;
if (hasEventListener(LogEvent.LOG)){
_local3 = 0;
while (_local3 < _args.length) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local3) + "\\}"), "g"), _args[_local3]);
_local3++;
};
dispatchEvent(new LogEvent(_arg1, LogEventLevel.WARN));
};
}
public function get category():String{
return (_category);
}
public function info(_arg1:String, ... _args):void{
var _local3:int;
if (hasEventListener(LogEvent.LOG)){
_local3 = 0;
while (_local3 < _args.length) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local3) + "\\}"), "g"), _args[_local3]);
_local3++;
};
dispatchEvent(new LogEvent(_arg1, LogEventLevel.INFO));
};
}
public function debug(_arg1:String, ... _args):void{
var _local3:int;
if (hasEventListener(LogEvent.LOG)){
_local3 = 0;
while (_local3 < _args.length) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local3) + "\\}"), "g"), _args[_local3]);
_local3++;
};
dispatchEvent(new LogEvent(_arg1, LogEventLevel.DEBUG));
};
}
public function fatal(_arg1:String, ... _args):void{
var _local3:int;
if (hasEventListener(LogEvent.LOG)){
_local3 = 0;
while (_local3 < _args.length) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local3) + "\\}"), "g"), _args[_local3]);
_local3++;
};
dispatchEvent(new LogEvent(_arg1, LogEventLevel.FATAL));
};
}
}
}//package mx.logging
Section 121
//IFocusManager (mx.managers.IFocusManager)
package mx.managers {
import flash.display.*;
import mx.core.*;
public interface IFocusManager {
function get focusPane():Sprite;
function getFocus():IFocusManagerComponent;
function deactivate():void;
function set defaultButton(_arg1:IButton):void;
function set focusPane(_arg1:Sprite):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function findFocusManagerComponent(_arg1:InteractiveObject):IFocusManagerComponent;
function get nextTabIndex():int;
function get defaultButton():IButton;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:IFocusManagerComponent):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function getNextFocusManagerComponent(_arg1:Boolean=false):IFocusManagerComponent;
}
}//package mx.managers
Section 122
//IFocusManagerComponent (mx.managers.IFocusManagerComponent)
package mx.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 mx.managers
Section 123
//IFocusManagerContainer (mx.managers.IFocusManagerContainer)
package mx.managers {
import flash.events.*;
import flash.display.*;
public interface IFocusManagerContainer extends IEventDispatcher {
function set focusManager(_arg1:IFocusManager):void;
function get focusManager():IFocusManager;
function get systemManager():ISystemManager;
function contains(_arg1:DisplayObject):Boolean;
}
}//package mx.managers
Section 124
//ISystemManager (mx.managers.ISystemManager)
package mx.managers {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import mx.core.*;
import flash.text.*;
public interface ISystemManager extends IEventDispatcher, IChildList, IFlexModuleFactory {
function get focusPane():Sprite;
function get loaderInfo():LoaderInfo;
function get toolTipChildren():IChildList;
function set focusPane(_arg1:Sprite):void;
function isTopLevel():Boolean;
function get popUpChildren():IChildList;
function get screen():Rectangle;
function isFontFaceEmbedded(_arg1:TextFormat):Boolean;
function get rawChildren():IChildList;
function get topLevelSystemManager():ISystemManager;
function getDefinitionByName(_arg1:String):Object;
function activate(_arg1:IFocusManagerContainer):void;
function deactivate(_arg1:IFocusManagerContainer):void;
function get cursorChildren():IChildList;
function set document(_arg1:Object):void;
function get embeddedFontList():Object;
function set numModalWindows(_arg1:int):void;
function removeFocusManager(_arg1:IFocusManagerContainer):void;
function get document():Object;
function get numModalWindows():int;
function addFocusManager(_arg1:IFocusManagerContainer):void;
function get stage():Stage;
}
}//package mx.managers
Section 125
//LoaderConfig (mx.messaging.config.LoaderConfig)
package mx.messaging.config {
import mx.core.*;
public class LoaderConfig {
mx_internal static const VERSION:String = "3.0.0.0";
mx_internal static var _url:String = null;
mx_internal static var _parameters:Object;
public static function get url():String{
return (_url);
}
public static function get parameters():Object{
return (_parameters);
}
}
}//package mx.messaging.config
Section 126
//IModuleInfo (mx.modules.IModuleInfo)
package mx.modules {
import flash.events.*;
import mx.core.*;
import flash.system.*;
public interface IModuleInfo extends IEventDispatcher {
function get ready():Boolean;
function get loaded():Boolean;
function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void;
function release():void;
function get error():Boolean;
function get data():Object;
function publish(_arg1:IFlexModuleFactory):void;
function get factory():IFlexModuleFactory;
function set data(_arg1:Object):void;
function get url():String;
function get setup():Boolean;
function unload():void;
}
}//package mx.modules
Section 127
//ModuleManager (mx.modules.ModuleManager)
package mx.modules {
import mx.core.*;
public class ModuleManager {
mx_internal static const VERSION:String = "3.0.0.0";
public static function getModule(_arg1:String):IModuleInfo{
return (getSingleton().getModule(_arg1));
}
private static function getSingleton():Object{
if (!ModuleManagerGlobals.managerSingleton){
ModuleManagerGlobals.managerSingleton = new ModuleManagerImpl();
};
return (ModuleManagerGlobals.managerSingleton);
}
public static function getAssociatedFactory(_arg1:Object):IFlexModuleFactory{
return (getSingleton().getAssociatedFactory(_arg1));
}
}
}//package mx.modules
import flash.events.*;
import flash.display.*;
import mx.core.*;
import flash.utils.*;
import mx.events.*;
import flash.system.*;
import flash.net.*;
class ModuleInfoProxy extends EventDispatcher implements IModuleInfo {
private var _data:Object;
private var info:ModuleInfo;
private var referenced:Boolean;// = false
private function ModuleInfoProxy(_arg1:ModuleInfo){
this.info = _arg1;
_arg1.addEventListener(ModuleEvent.SETUP, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.PROGRESS, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.READY, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.ERROR, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.UNLOAD, moduleEventHandler, false, 0, true);
}
public function get loaded():Boolean{
return (info.loaded);
}
public function release():void{
if (referenced){
info.removeReference();
referenced = false;
};
}
public function get error():Boolean{
return (info.error);
}
public function get factory():IFlexModuleFactory{
return (info.factory);
}
public function publish(_arg1:IFlexModuleFactory):void{
info.publish(_arg1);
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get ready():Boolean{
return (info.ready);
}
public function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void{
var _local3:ModuleEvent;
info.resurrect();
if (!referenced){
info.addReference();
referenced = true;
};
if (info.error){
dispatchEvent(new ModuleEvent(ModuleEvent.ERROR));
} else {
if (info.loaded){
if (info.setup){
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
if (info.ready){
_local3 = new ModuleEvent(ModuleEvent.PROGRESS);
_local3.bytesLoaded = info.size;
_local3.bytesTotal = info.size;
dispatchEvent(_local3);
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
};
};
} else {
info.load(_arg1, _arg2);
};
};
}
private function moduleEventHandler(_arg1:ModuleEvent):void{
dispatchEvent(_arg1);
}
public function get url():String{
return (info.url);
}
public function get data():Object{
return (_data);
}
public function get setup():Boolean{
return (info.setup);
}
public function unload():void{
info.unload();
info.removeEventListener(ModuleEvent.SETUP, moduleEventHandler);
info.removeEventListener(ModuleEvent.PROGRESS, moduleEventHandler);
info.removeEventListener(ModuleEvent.READY, moduleEventHandler);
info.removeEventListener(ModuleEvent.ERROR, moduleEventHandler);
info.removeEventListener(ModuleEvent.UNLOAD, moduleEventHandler);
}
}
class ModuleManagerImpl extends EventDispatcher {
private var moduleList:Object;
private function ModuleManagerImpl(){
moduleList = {};
super();
}
public function getModule(_arg1:String):IModuleInfo{
var _local2:ModuleInfo = (moduleList[_arg1] as ModuleInfo);
if (!_local2){
_local2 = new ModuleInfo(_arg1);
moduleList[_arg1] = _local2;
};
return (new ModuleInfoProxy(_local2));
}
public function getAssociatedFactory(_arg1:Object):IFlexModuleFactory{
var m:Object;
var info:ModuleInfo;
var domain:ApplicationDomain;
var cls:Class;
var object = _arg1;
var className:String = getQualifiedClassName(object);
for each (m in moduleList) {
info = (m as ModuleInfo);
if (!info.ready){
} else {
domain = info.applicationDomain;
try {
cls = Class(domain.getDefinition(className));
if ((object is cls)){
return (info.factory);
};
} catch(error:Error) {
};
};
};
return (null);
}
}
class ModuleInfo extends EventDispatcher {
private var _error:Boolean;// = false
private var loader:Loader;
private var factoryInfo:FactoryInfo;
private var limbo:Dictionary;
private var _loaded:Boolean;// = false
private var _ready:Boolean;// = false
private var numReferences:int;// = 0
private var _url:String;
private var _setup:Boolean;// = false
private function ModuleInfo(_arg1:String){
_url = _arg1;
}
private function clearLoader():void{
if (loader){
if (loader.contentLoaderInfo){
loader.contentLoaderInfo.removeEventListener(Event.INIT, initHandler);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
};
try {
if (loader.content){
loader.content.removeEventListener("ready", readyHandler);
};
} catch(error:Error) {
};
if (_loaded){
try {
loader.close();
} catch(error:Error) {
};
};
try {
loader.unload();
} catch(error:Error) {
};
loader = null;
};
}
public function get size():int{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.bytesTotal : 0);
}
public function get loaded():Boolean{
return ((limbo) ? false : _loaded);
}
public function release():void{
if (((_ready) && (!(limbo)))){
limbo = new Dictionary(true);
limbo[factoryInfo] = 1;
factoryInfo = null;
} else {
unload();
};
}
public function get error():Boolean{
return ((limbo) ? false : _error);
}
public function get factory():IFlexModuleFactory{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.factory : null);
}
public function completeHandler(_arg1:Event):void{
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = loader.contentLoaderInfo.bytesLoaded;
_local2.bytesTotal = loader.contentLoaderInfo.bytesTotal;
dispatchEvent(_local2);
}
public function publish(_arg1:IFlexModuleFactory):void{
if (factoryInfo){
return;
};
if (_url.indexOf("published://") != 0){
return;
};
factoryInfo = new FactoryInfo();
factoryInfo.factory = _arg1;
_loaded = true;
_setup = true;
_ready = true;
_error = false;
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
dispatchEvent(new ModuleEvent(ModuleEvent.PROGRESS));
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
}
public function initHandler(_arg1:Event):void{
var moduleEvent:ModuleEvent;
var event = _arg1;
factoryInfo = new FactoryInfo();
try {
factoryInfo.factory = (loader.content as IFlexModuleFactory);
} catch(error:Error) {
};
if (!factoryInfo.factory){
moduleEvent = new ModuleEvent(ModuleEvent.ERROR, event.bubbles, event.cancelable);
moduleEvent.bytesLoaded = 0;
moduleEvent.bytesTotal = 0;
moduleEvent.errorText = "SWF is not a loadable module";
dispatchEvent(moduleEvent);
return;
};
loader.content.addEventListener("ready", readyHandler);
try {
factoryInfo.applicationDomain = loader.contentLoaderInfo.applicationDomain;
} catch(error:Error) {
};
_setup = true;
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
}
public function resurrect():void{
var _local1:Object;
if (((!(factoryInfo)) && (limbo))){
for (_local1 in limbo) {
factoryInfo = (_local1 as FactoryInfo);
break;
};
limbo = null;
};
if (!factoryInfo){
if (_loaded){
dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
};
loader = null;
_loaded = false;
_setup = false;
_ready = false;
_error = false;
};
}
public function errorHandler(_arg1:ErrorEvent):void{
_error = true;
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = 0;
_local2.bytesTotal = 0;
_local2.errorText = _arg1.text;
dispatchEvent(_local2);
}
public function get ready():Boolean{
return ((limbo) ? false : _ready);
}
public function removeReference():void{
numReferences--;
if (numReferences == 0){
release();
};
}
public function addReference():void{
numReferences++;
}
public function progressHandler(_arg1:ProgressEvent):void{
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
dispatchEvent(_local2);
}
public function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void{
if (_loaded){
return;
};
_loaded = true;
limbo = null;
if (_url.indexOf("published://") == 0){
return;
};
var _local3:URLRequest = new URLRequest(_url);
var _local4:LoaderContext = new LoaderContext();
_local4.applicationDomain = (_arg1) ? _arg1 : new ApplicationDomain(ApplicationDomain.currentDomain);
_local4.securityDomain = _arg2;
if ((((_arg2 == null)) && ((Security.sandboxType == Security.REMOTE)))){
_local4.securityDomain = SecurityDomain.currentDomain;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
loader.load(_local3, _local4);
}
public function get url():String{
return (_url);
}
public function get applicationDomain():ApplicationDomain{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.applicationDomain : null);
}
public function readyHandler(_arg1:Event):void{
_ready = true;
factoryInfo.bytesTotal = loader.contentLoaderInfo.bytesTotal;
clearLoader();
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
}
public function get setup():Boolean{
return ((limbo) ? false : _setup);
}
public function unload():void{
clearLoader();
if (_loaded){
dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
};
limbo = null;
factoryInfo = null;
_loaded = false;
_setup = false;
_ready = false;
_error = false;
}
}
class FactoryInfo {
public var bytesTotal:int;// = 0
public var factory:IFlexModuleFactory;
public var applicationDomain:ApplicationDomain;
private function FactoryInfo(){
}
}
Section 128
//ModuleManagerGlobals (mx.modules.ModuleManagerGlobals)
package mx.modules {
public class ModuleManagerGlobals {
public static var managerSingleton:Object = null;
}
}//package mx.modules
Section 129
//IResourceBundle (mx.resources.IResourceBundle)
package mx.resources {
public interface IResourceBundle {
function get content():Object;
function get locale():String;
function get bundleName():String;
}
}//package mx.resources
Section 130
//IResourceManager (mx.resources.IResourceManager)
package mx.resources {
import flash.events.*;
import flash.system.*;
public interface IResourceManager extends IEventDispatcher {
function loadResourceModule(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher;
function getBoolean(_arg1:String, _arg2:String, _arg3:String=null):Boolean;
function getClass(_arg1:String, _arg2:String, _arg3:String=null):Class;
function getLocales():Array;
function removeResourceBundlesForLocale(_arg1:String):void;
function getResourceBundle(_arg1:String, _arg2:String):IResourceBundle;
function get localeChain():Array;
function getInt(_arg1:String, _arg2:String, _arg3:String=null):int;
function update():void;
function set localeChain(_arg1:Array):void;
function getUint(_arg1:String, _arg2:String, _arg3:String=null):uint;
function addResourceBundle(_arg1:IResourceBundle):void;
function getStringArray(_arg1:String, _arg2:String, _arg3:String=null):Array;
function getBundleNamesForLocale(_arg1:String):Array;
function removeResourceBundle(_arg1:String, _arg2:String):void;
function getObject(_arg1:String, _arg2:String, _arg3:String=null);
function getString(_arg1:String, _arg2:String, _arg3:Array=null, _arg4:String=null):String;
function installCompiledResourceBundles(_arg1:ApplicationDomain, _arg2:Array, _arg3:Array):void;
function unloadResourceModule(_arg1:String, _arg2:Boolean=true):void;
function findResourceBundleWithResource(_arg1:String, _arg2:String):IResourceBundle;
function getNumber(_arg1:String, _arg2:String, _arg3:String=null):Number;
}
}//package mx.resources
Section 131
//IResourceModule (mx.resources.IResourceModule)
package mx.resources {
public interface IResourceModule {
function get resourceBundles():Array;
}
}//package mx.resources
Section 132
//ResourceBundle (mx.resources.ResourceBundle)
package mx.resources {
import mx.core.*;
import flash.system.*;
import mx.utils.*;
public class ResourceBundle implements IResourceBundle {
mx_internal var _locale:String;
private var _content:Object;
mx_internal var _bundleName:String;
mx_internal static const VERSION:String = "3.0.0.0";
mx_internal static var backupApplicationDomain:ApplicationDomain;
mx_internal static var locale:String;
public function ResourceBundle(_arg1:String=null, _arg2:String=null){
_content = {};
super();
mx_internal::_locale = _arg1;
mx_internal::_bundleName = _arg2;
_content = getContent();
}
protected function getContent():Object{
return ({});
}
public function getString(_arg1:String):String{
return (String(_getObject(_arg1)));
}
public function get content():Object{
return (_content);
}
public function getBoolean(_arg1:String, _arg2:Boolean=true):Boolean{
var _local3:String = _getObject(_arg1).toLowerCase();
if (_local3 == "false"){
return (false);
};
if (_local3 == "true"){
return (true);
};
return (_arg2);
}
public function getStringArray(_arg1:String):Array{
var _local2:Array = _getObject(_arg1).split(",");
var _local3:int = _local2.length;
var _local4:int;
while (_local4 < _local3) {
_local2[_local4] = StringUtil.trim(_local2[_local4]);
_local4++;
};
return (_local2);
}
public function getObject(_arg1:String):Object{
return (_getObject(_arg1));
}
private function _getObject(_arg1:String):Object{
var _local2:Object = content[_arg1];
if (!_local2){
throw (new Error(((("Key " + _arg1) + " was not found in resource bundle ") + bundleName)));
};
return (_local2);
}
public function get locale():String{
return (mx_internal::_locale);
}
public function get bundleName():String{
return (mx_internal::_bundleName);
}
public function getNumber(_arg1:String):Number{
return (Number(_getObject(_arg1)));
}
private static function getClassByName(_arg1:String, _arg2:ApplicationDomain):Class{
var _local3:Class;
if (_arg2.hasDefinition(_arg1)){
_local3 = (_arg2.getDefinition(_arg1) as Class);
};
return (_local3);
}
public static function getResourceBundle(_arg1:String, _arg2:ApplicationDomain=null):ResourceBundle{
var _local3:String;
var _local4:Class;
var _local5:Object;
var _local6:ResourceBundle;
if (!_arg2){
_arg2 = ApplicationDomain.currentDomain;
};
_local3 = (((mx_internal::locale + "$") + _arg1) + "_properties");
_local4 = getClassByName(_local3, _arg2);
if (!_local4){
_local3 = (_arg1 + "_properties");
_local4 = getClassByName(_local3, _arg2);
};
if (!_local4){
_local3 = _arg1;
_local4 = getClassByName(_local3, _arg2);
};
if (((!(_local4)) && (mx_internal::backupApplicationDomain))){
_local3 = (_arg1 + "_properties");
_local4 = getClassByName(_local3, mx_internal::backupApplicationDomain);
if (!_local4){
_local3 = _arg1;
_local4 = getClassByName(_local3, mx_internal::backupApplicationDomain);
};
};
if (_local4){
_local5 = new (_local4);
if ((_local5 is ResourceBundle)){
_local6 = ResourceBundle(_local5);
return (_local6);
};
};
throw (new Error(("Could not find resource bundle " + _arg1)));
}
}
}//package mx.resources
Section 133
//ResourceManager (mx.resources.ResourceManager)
package mx.resources {
import mx.core.*;
public class ResourceManager {
mx_internal static const VERSION:String = "3.0.0.0";
private static var implClassDependency:ResourceManagerImpl;
private static var instance:IResourceManager;
public static function getInstance():IResourceManager{
if (!instance){
instance = IResourceManager(Singleton.getInstance("mx.resources::IResourceManager"));
};
return (instance);
}
}
}//package mx.resources
Section 134
//ResourceManagerImpl (mx.resources.ResourceManagerImpl)
package mx.resources {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import mx.events.*;
import flash.system.*;
import mx.modules.*;
import mx.utils.*;
public class ResourceManagerImpl extends EventDispatcher implements IResourceManager {
private var resourceModules:Object;
private var initializedForNonFrameworkApp:Boolean;// = false
private var localeMap:Object;
private var _localeChain:Array;
mx_internal static const VERSION:String = "3.0.0.0";
private static var instance:IResourceManager;
public function ResourceManagerImpl(){
localeMap = {};
resourceModules = {};
super();
}
public function get localeChain():Array{
return (_localeChain);
}
public function set localeChain(_arg1:Array):void{
_localeChain = _arg1;
update();
}
public function getStringArray(_arg1:String, _arg2:String, _arg3:String=null):Array{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (null);
};
var _local5:* = _local4.content[_arg2];
var _local6:Array = String(_local5).split(",");
var _local7:int = _local6.length;
var _local8:int;
while (_local8 < _local7) {
_local6[_local8] = StringUtil.trim(_local6[_local8]);
_local8++;
};
return (_local6);
}
mx_internal function installCompiledResourceBundle(_arg1:ApplicationDomain, _arg2:String, _arg3:String):void{
var _local4:String;
var _local5:String = _arg3;
var _local6:int = _arg3.indexOf(":");
if (_local6 != -1){
_local4 = _arg3.substring(0, _local6);
_local5 = _arg3.substring((_local6 + 1));
};
if (getResourceBundle(_arg2, _arg3)){
return;
};
var _local7 = (((_arg2 + "$") + _local5) + "_properties");
if (_local4 != null){
_local7 = ((_local4 + ".") + _local7);
};
var _local8:Class;
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
if (!_local8){
_local7 = _arg3;
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
};
if (!_local8){
_local7 = (_arg3 + "_properties");
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
};
if (!_local8){
throw (new Error((((("Could not find compiled resource bundle '" + _arg3) + "' for locale '") + _arg2) + "'.")));
};
var _local9:ResourceBundle = ResourceBundle(new (_local8));
_local9.mx_internal::_locale = _arg2;
_local9.mx_internal::_bundleName = _arg3;
addResourceBundle(_local9);
}
public function getString(_arg1:String, _arg2:String, _arg3:Array=null, _arg4:String=null):String{
var _local5:IResourceBundle = findBundle(_arg1, _arg2, _arg4);
if (!_local5){
return (null);
};
var _local6:String = String(_local5.content[_arg2]);
if (_arg3){
_local6 = StringUtil.substitute(_local6, _arg3);
};
return (_local6);
}
public function loadResourceModule(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher{
var moduleInfo:IModuleInfo;
var resourceEventDispatcher:ResourceEventDispatcher;
var timer:Timer;
var timerHandler:Function;
var url = _arg1;
var updateFlag = _arg2;
var applicationDomain = _arg3;
var securityDomain = _arg4;
moduleInfo = ModuleManager.getModule(url);
resourceEventDispatcher = new ResourceEventDispatcher(moduleInfo);
var readyHandler:Function = function (_arg1:ModuleEvent):void{
var _local2:* = _arg1.module.factory.create();
resourceModules[_arg1.module.url].resourceModule = _local2;
if (updateFlag){
update();
};
};
moduleInfo.addEventListener(ModuleEvent.READY, readyHandler, false, 0, true);
var errorHandler:Function = function (_arg1:ModuleEvent):void{
var _local3:ResourceEvent;
var _local2:String = ("Unable to load resource module from " + url);
if (resourceEventDispatcher.willTrigger(ResourceEvent.ERROR)){
_local3 = new ResourceEvent(ResourceEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local3.bytesLoaded = 0;
_local3.bytesTotal = 0;
_local3.errorText = _local2;
resourceEventDispatcher.dispatchEvent(_local3);
} else {
throw (new Error(_local2));
};
};
moduleInfo.addEventListener(ModuleEvent.ERROR, errorHandler, false, 0, true);
resourceModules[url] = new ResourceModuleInfo(moduleInfo, readyHandler, errorHandler);
timer = new Timer(0);
timerHandler = function (_arg1:TimerEvent):void{
timer.removeEventListener(TimerEvent.TIMER, timerHandler);
timer.stop();
moduleInfo.load(applicationDomain, securityDomain);
};
timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true);
timer.start();
return (resourceEventDispatcher);
}
public function getLocales():Array{
var _local2:String;
var _local1:Array = [];
for (_local2 in localeMap) {
_local1.push(_local2);
};
return (_local1);
}
public function removeResourceBundlesForLocale(_arg1:String):void{
delete localeMap[_arg1];
}
public function getResourceBundle(_arg1:String, _arg2:String):IResourceBundle{
var _local3:Object = localeMap[_arg1];
if (!_local3){
return (null);
};
return (_local3[_arg2]);
}
private function dumpResourceModule(_arg1):void{
var _local2:ResourceBundle;
var _local3:String;
for each (_local2 in _arg1.resourceBundles) {
trace(_local2.locale, _local2.bundleName);
for (_local3 in _local2.content) {
};
};
}
public function getObject(_arg1:String, _arg2:String, _arg3:String=null){
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (undefined);
};
return (_local4.content[_arg2]);
}
public function addResourceBundle(_arg1:IResourceBundle):void{
var _local2:String = _arg1.locale;
var _local3:String = _arg1.bundleName;
if (!localeMap[_local2]){
localeMap[_local2] = {};
};
localeMap[_local2][_local3] = _arg1;
}
private function findBundle(_arg1:String, _arg2:String, _arg3:String):IResourceBundle{
supportNonFrameworkApps();
return (((_arg3)!=null) ? getResourceBundle(_arg3, _arg1) : findResourceBundleWithResource(_arg1, _arg2));
}
public function getInt(_arg1:String, _arg2:String, _arg3:String=null):int{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (0);
};
var _local5:* = _local4.content[_arg2];
return (int(_local5));
}
private function supportNonFrameworkApps():void{
if (initializedForNonFrameworkApp){
return;
};
initializedForNonFrameworkApp = true;
if (getLocales().length > 0){
return;
};
var _local1:ApplicationDomain = ApplicationDomain.currentDomain;
if (!_local1.hasDefinition("_CompiledResourceBundleInfo")){
return;
};
var _local2:Class = Class(_local1.getDefinition("_CompiledResourceBundleInfo"));
var _local3:Array = _local2.compiledLocales;
var _local4:Array = _local2.compiledResourceBundleNames;
installCompiledResourceBundles(_local1, _local3, _local4);
localeChain = _local3;
}
public function getClass(_arg1:String, _arg2:String, _arg3:String=null):Class{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (null);
};
var _local5:* = _local4.content[_arg2];
return ((_local5 as Class));
}
public function getNumber(_arg1:String, _arg2:String, _arg3:String=null):Number{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (NaN);
};
var _local5:* = _local4.content[_arg2];
return (Number(_local5));
}
public function update():void{
dispatchEvent(new Event(Event.CHANGE));
}
public function getBundleNamesForLocale(_arg1:String):Array{
var _local3:String;
var _local2:Array = [];
for (_local3 in localeMap[_arg1]) {
_local2.push(_local3);
};
return (_local2);
}
public function removeResourceBundle(_arg1:String, _arg2:String):void{
delete localeMap[_arg1][_arg2];
if (getBundleNamesForLocale(_arg1).length == 0){
delete localeMap[_arg1];
};
}
public function installCompiledResourceBundles(_arg1:ApplicationDomain, _arg2:Array, _arg3:Array):void{
var _local7:String;
var _local8:int;
var _local9:String;
var _local4:int = (_arg2) ? _arg2.length : 0;
var _local5:int = (_arg3) ? _arg3.length : 0;
var _local6:int;
while (_local6 < _local4) {
_local7 = _arg2[_local6];
_local8 = 0;
while (_local8 < _local5) {
_local9 = _arg3[_local8];
mx_internal::installCompiledResourceBundle(_arg1, _local7, _local9);
_local8++;
};
_local6++;
};
}
public function findResourceBundleWithResource(_arg1:String, _arg2:String):IResourceBundle{
var _local5:String;
var _local6:Object;
var _local7:ResourceBundle;
if (!_localeChain){
return (null);
};
var _local3:int = _localeChain.length;
var _local4:int;
while (_local4 < _local3) {
_local5 = localeChain[_local4];
_local6 = localeMap[_local5];
if (!_local6){
} else {
_local7 = _local6[_arg1];
if (!_local7){
} else {
if ((_arg2 in _local7.content)){
return (_local7);
};
};
};
_local4++;
};
return (null);
}
public function getUint(_arg1:String, _arg2:String, _arg3:String=null):uint{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (0);
};
var _local5:* = _local4.content[_arg2];
return (uint(_local5));
}
public function getBoolean(_arg1:String, _arg2:String, _arg3:String=null):Boolean{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (false);
};
var _local5:* = _local4.content[_arg2];
return ((String(_local5).toLowerCase() == "true"));
}
public function unloadResourceModule(_arg1:String, _arg2:Boolean=true):void{
throw (new Error("unloadResourceModule() is not yet implemented."));
}
public static function getInstance():IResourceManager{
if (!instance){
instance = new (ResourceManagerImpl);
};
return (instance);
}
}
}//package mx.resources
import flash.events.*;
import mx.events.*;
import mx.modules.*;
class ResourceModuleInfo {
public var resourceModule:IResourceModule;
public var errorHandler:Function;
public var readyHandler:Function;
public var moduleInfo:IModuleInfo;
private function ResourceModuleInfo(_arg1:IModuleInfo, _arg2:Function, _arg3:Function){
this.moduleInfo = _arg1;
this.readyHandler = _arg2;
this.errorHandler = _arg3;
}
}
class ResourceEventDispatcher extends EventDispatcher {
private function ResourceEventDispatcher(_arg1:IModuleInfo){
_arg1.addEventListener(ModuleEvent.ERROR, moduleInfo_errorHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.PROGRESS, moduleInfo_progressHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.READY, moduleInfo_readyHandler, false, 0, true);
}
private function moduleInfo_progressHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
dispatchEvent(_local2);
}
private function moduleInfo_readyHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.COMPLETE);
dispatchEvent(_local2);
}
private function moduleInfo_errorHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
_local2.errorText = _arg1.errorText;
dispatchEvent(_local2);
}
}
Section 135
//WSDLLoadEvent (mx.rpc.events.WSDLLoadEvent)
package mx.rpc.events {
import flash.events.*;
import mx.rpc.wsdl.*;
public class WSDLLoadEvent extends XMLLoadEvent {
public var wsdl:WSDL;
public static const LOAD:String = "wsdlLoad";
public function WSDLLoadEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=true, _arg4:WSDL=null, _arg5:String=null){
super(((_arg1 == null)) ? LOAD : _arg1, _arg2, _arg3, ((_arg4 == null)) ? null : _arg4.xml, _arg5);
this.wsdl = _arg4;
}
override public function clone():Event{
return (new WSDLLoadEvent(type, bubbles, cancelable, wsdl, location));
}
override public function toString():String{
return (formatToString("WSDLLoadEvent", "location", "type", "bubbles", "cancelable", "eventPhase"));
}
public static function createEvent(_arg1:WSDL, _arg2:String=null):WSDLLoadEvent{
return (new WSDLLoadEvent(LOAD, false, true, _arg1, _arg2));
}
}
}//package mx.rpc.events
Section 136
//XMLLoadEvent (mx.rpc.events.XMLLoadEvent)
package mx.rpc.events {
import flash.events.*;
public class XMLLoadEvent extends Event {
public var location:String;
public var xml:XML;
public static const LOAD:String = "xmlLoad";
public function XMLLoadEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=true, _arg4:XML=null, _arg5:String=null){
super(((_arg1 == null)) ? LOAD : _arg1, _arg2, _arg3);
this.xml = _arg4;
this.location = _arg5;
}
override public function toString():String{
return (formatToString("XMLLoadEvent", "location", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new XMLLoadEvent(type, bubbles, cancelable, xml, location));
}
public static function createEvent(_arg1:XML=null, _arg2:String=null):XMLLoadEvent{
return (new XMLLoadEvent(LOAD, false, true, _arg1, _arg2));
}
}
}//package mx.rpc.events
Section 137
//ApacheDocumentType (mx.rpc.soap.types.ApacheDocumentType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
public class ApacheDocumentType implements ICustomSOAPType {
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
_arg1.setValue(_arg2, _arg3, XML(_arg4).elements());
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
_arg1.setValue(_arg2, _arg4);
}
}
}//package mx.rpc.soap.types
Section 138
//DataSetType (mx.rpc.soap.types.DataSetType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
import mx.rpc.xml.*;
public class DataSetType implements ICustomSOAPType {
private var schemaConstants:SchemaConstants;
private function processColumns(_arg1:SOAPDecoder, _arg2:XML){
var _local5:XML;
var _local3:XMLList = _arg2.elements(schemaConstants.complexTypeQName)[0].elements(schemaConstants.sequenceQName)[0].elements(schemaConstants.elementTypeQName);
var _local4:* = _arg1.createIterableValue();
for each (_local5 in _local3) {
TypeIterator.push(_local4, _local5.attribute("name").toString());
};
return (_local4);
}
private function processTables(_arg1:XML):Object{
var _local4:XML;
var _local2:XMLList = _arg1.elements(schemaConstants.elementTypeQName)[0].elements(schemaConstants.complexTypeQName)[0].elements(schemaConstants.choiceQName)[0].elements(schemaConstants.elementTypeQName);
var _local3:Object = {};
for each (_local4 in _local2) {
_local3[_local4.attribute("name")] = _local4;
};
return (_local3);
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
throw (new Error("Unsupported operation - .NET DataSet diffgrams cannot be sent from client."));
}
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
var _local11:String;
var _local12:*;
var _local13:Schema;
var _local14:XML;
var _local15:*;
if ((_arg2 is ContentProxy)){
ContentProxy(_arg2).isSimple = false;
};
schemaConstants = _arg1.schemaConstants;
var _local6:XML = XML(_arg4).elements(schemaConstants.schemaQName)[0];
var _local7:XML = XML(_arg4).elements(SOAPConstants.diffgramQName)[0].elements()[0];
var _local8:* = _arg2;
var _local9:Object = processTables(_local6);
var _local10:* = _arg1.createContent();
if ((_local10 is ContentProxy)){
ContentProxy(_local10).isSimple = false;
};
for (_local11 in _local9) {
_local12 = _arg1.createContent();
if ((_local12 is ContentProxy)){
ContentProxy(_local12).isSimple = false;
};
_arg1.setValue(_local12, "Columns", processColumns(_arg1, _local9[_local11]));
_arg1.setValue(_local12, "Rows", _arg1.createIterableValue());
_arg1.setValue(_local10, _local11, _local12);
};
if (_local7 != null){
_local13 = new Schema(_local6);
_arg1.schemaManager.addSchema(_local13, false);
for (_local11 in _local10) {
for each (_local14 in _local7.elements(_local11)) {
_local15 = _arg1.decode(_local14, _local14.name(), null, _local9[_local11]);
TypeIterator.push(_local10[_local11]["Rows"], _local15);
};
};
_arg1.schemaManager.releaseScope();
};
_arg1.setValue(_local8, "Tables", _local10);
}
}
}//package mx.rpc.soap.types
Section 139
//ICustomSOAPType (mx.rpc.soap.types.ICustomSOAPType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
public interface ICustomSOAPType {
function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void;
function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void;
}
}//package mx.rpc.soap.types
Section 140
//MapType (mx.rpc.soap.types.MapType)
package mx.rpc.soap.types {
import flash.utils.*;
import mx.rpc.soap.*;
import mx.rpc.xml.*;
public class MapType implements ICustomSOAPType {
public static var itemQName:QName = new QName("", "item");
public static var valueQName:QName = new QName("", "value");
public static var keyQName:QName = new QName("", "key");
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
var _local8:XML;
var _local9:Object;
var _local10:Object;
var _local11:XML;
var _local12:String;
var _local13:QName;
if ((_arg2 is ContentProxy)){
_arg2.isSimple = false;
};
var _local6:SchemaConstants = _arg1.schemaManager.schemaConstants;
var _local7:XML = (_arg4 as XML);
for each (_local8 in _local7.elements()) {
for each (_local11 in _local8.elements()) {
_local12 = _local11.attribute(_local6.typeAttrQName);
if (((!((_local12 == null))) && (!((_local12 == ""))))){
_local13 = _arg1.schemaManager.getQNameForPrefixedName(_local12, _local11);
} else {
_local13 = _local6.anyTypeQName;
};
if (_local11.localName() == "key"){
_local9 = _arg1.createContent();
_arg1.decodeType(_local13, _local9, _local11.name(), _local11);
} else {
if (_local11.localName() == "value"){
_local10 = _arg1.createContent();
_arg1.decodeType(_local13, _local10, _local11.name(), _local11);
} else {
throw (new Error("Apache Map datatype must only contain key/value pairs."));
};
};
};
_arg1.setValue(_arg2, _local9, _local10);
};
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local7:String;
var _local8:XML;
var _local9:XML;
var _local10:XML;
var _local11:Object;
var _local12:String;
var _local13:SchemaConstants;
var _local14:QName;
var _local6:SchemaDatatypes = _arg1.schemaManager.schemaDatatypes;
for (_local7 in _arg4) {
_local8 = _arg1.createElement(itemQName);
_local9 = _arg1.createElement(keyQName);
_local10 = _arg1.createElement(valueQName);
if (_local7 != null){
_arg1.encodeType(_local6.stringQName, _local9, keyQName, _local7);
} else {
_arg1.setValue(_local9, null);
};
_arg1.setValue(_local8, _local9);
_local11 = _arg4[_local7];
if (_local11 != null){
_local12 = "string";
if ((_local11 is Number)){
if ((_local11 is uint)){
_local12 = "unsignedInt";
} else {
if ((_local11 is int)){
_local12 = "int";
} else {
_local12 = "double";
};
};
} else {
if ((_local11 is Boolean)){
_local12 = "boolean";
} else {
if ((_local11 is String)){
_local12 = "string";
} else {
if ((_local11 is ByteArray)){
if (SchemaMarshaller.byteArrayAsBase64Binary){
_local12 = "base64Binary";
} else {
_local12 = "hexBinary";
};
} else {
if ((_local11 is Date)){
_local12 = "dateTime";
};
};
};
};
};
_local13 = _arg1.schemaManager.schemaConstants;
_local14 = ((_local12)!=null) ? new QName(_local13.xsdURI, _local12) : null;
_arg1.encodeType(_local14, _local10, valueQName, _local11);
} else {
_arg1.setValue(_local10, null);
};
_arg1.setValue(_local8, _local10);
_arg1.setValue(_arg2, _local8);
};
}
}
}//package mx.rpc.soap.types
Section 141
//QueryBeanType (mx.rpc.soap.types.QueryBeanType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
import mx.rpc.xml.*;
import mx.utils.*;
public class QueryBeanType implements ICustomSOAPType {
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
var _local7:*;
var _local11:XML;
var _local12:XML;
var _local16:*;
var _local17:*;
var _local18:uint;
var _local6:XML = (_arg4 as XML);
if (_arg1.makeObjectsBindable){
_local7 = new XMLDecoder.listClass();
} else {
_local7 = [];
};
var _local8:XML = _local6.columnList[0];
if (_local8 == null){
return;
};
var _local9:XMLList = _local8.elements();
var _local10:Array = [];
for each (_local11 in _local9) {
_local10.push(_local11.toString());
};
_local12 = _local6.data[0];
if (_local12 == null){
return;
};
var _local13:SOAPArrayType = new SOAPArrayType();
var _local14:Array = [];
_local13.decode(_arg1, _local14, _arg3, _local12, _arg5);
var _local15:TypeIterator = new TypeIterator(_local14);
while (_local15.hasNext()) {
_local16 = _local15.next();
if (_arg1.makeObjectsBindable){
_local17 = new ObjectProxy();
} else {
_local17 = {};
};
_local18 = 0;
while (_local18 < _local10.length) {
_local17[_local10[_local18]] = _local16[_local18];
_local18++;
};
TypeIterator.push(_local7, _local17);
};
_arg1.setValue(_arg2, _arg3, _local7);
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
throw (new Error("Unsupported operation - Query Beans cannot be sent to ColdFusion."));
}
}
}//package mx.rpc.soap.types
Section 142
//RowSetType (mx.rpc.soap.types.RowSetType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
import mx.rpc.xml.*;
public class RowSetType implements ICustomSOAPType {
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
var _local11:uint;
var _local12:XML;
var _local13:XMLList;
var _local14:XML;
var _local15:String;
var _local16:QName;
var _local17:XMLList;
var _local18:*;
var _local19:uint;
var _local20:XML;
if ((_arg2 is ContentProxy)){
_arg2.isSimple = false;
};
var _local6:XML = (_arg4 as XML);
var _local7:Array = [];
var _local8:Array = [];
var _local9:Array = [];
var _local10:XMLList = _local6.elements()[0].elements();
for each (_local12 in _local10) {
_local15 = _local12.attribute("type").toString();
if (((!((_local15 == null))) && (!((_local15 == ""))))){
_local16 = _arg1.schemaManager.getQNameForPrefixedName(_local15, _local12);
};
if (_local16 == null){
_local16 = _arg1.schemaManager.schemaDatatypes.stringQName;
};
_local8[_local11] = _local16;
_local9[_local11] = _local12.text().toString();
_local11++;
};
_local13 = _local6.elements()[1].elements();
_local11 = 0;
for each (_local14 in _local13) {
_local17 = _local14.elements();
_local18 = _arg1.createContent();
_local19 = 0;
for each (_local20 in _local17) {
_local18[_local9[_local19]] = _arg1.decode(_local20, null, (_local8[_local19] as QName));
_local19++;
};
_local7[_local11] = _local18;
_local11++;
};
_arg1.setValue(_arg2, _arg3, _local7);
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
throw (new Error("Unsupported operation - RowSet cannot be sent to a server."));
}
}
}//package mx.rpc.soap.types
Section 143
//SOAPArrayType (mx.rpc.soap.types.SOAPArrayType)
package mx.rpc.soap.types {
import mx.rpc.soap.*;
import mx.rpc.wsdl.*;
import mx.rpc.xml.*;
import mx.collections.*;
import mx.utils.*;
public class SOAPArrayType implements ICustomSOAPType {
private var schemaType:QName;
private var soapConstants:SOAPConstants;
private var schemaManager:SchemaManager;
private var processor:SchemaProcessor;
private var dimensionString:String;
private var schemaTypeName:String;
private var _dimensions:Array;
private var schemaConstants:SchemaConstants;
private var itemName:QName;
public function SOAPArrayType(){
itemName = new QName("", "item");
}
private function determineWSDLArrayType(_arg1:XML, _arg2:WSDLConstants):String{
var _local5:String;
var _local6:QName;
var _local3 = "";
var _local4:XML = getSingleElementFromNode(_arg1, schemaConstants.attributeQName);
if (_local4 != null){
_local5 = _local4.@ref;
_local6 = schemaManager.getQNameForPrefixedName(_local5, _local4, true);
if (_local6 == soapConstants.soapencArrayTypeQName){
_local3 = _local4.attribute(_arg2.wsdlArrayTypeQName).toString();
};
};
return (_local3);
}
private function decodeArrayItem(_arg1, _arg2):void{
var _local3:SOAPDecoder = (processor as SOAPDecoder);
var _local4:* = _local3.createContent(schemaType);
_local3.decodeType(schemaType, _local4, itemName, _arg2);
_local3.setValue(_arg1, itemName, _local4, schemaType);
}
public function decode(_arg1:SOAPDecoder, _arg2, _arg3, _arg4, _arg5:XML=null):void{
var _local7:String;
var _local8:String;
var _local9:ContentProxy;
processor = _arg1;
soapConstants = _arg1.soapConstants;
schemaManager = _arg1.schemaManager;
schemaConstants = schemaManager.schemaConstants;
var _local6:XML = (_arg4 as XML);
if (_local6 != null){
_local7 = _local6.@[soapConstants.soapencArrayTypeQName];
if (((!((_local7 == null))) && (!((_local7 == ""))))){
parseWSDLArrayType(_local7);
schemaType = schemaManager.getQNameForPrefixedName(schemaTypeName, _local6);
};
};
if ((((schemaType == null)) && (!((_arg5 == null))))){
_local8 = determineWSDLArrayType(_arg5, _arg1.wsdlOperation.wsdlConstants);
parseWSDLArrayType(_local8);
schemaType = schemaManager.getQNameForPrefixedName(schemaTypeName, _arg5);
};
if (schemaType != null){
if ((_arg2 is ContentProxy)){
_local9 = (_arg2 as ContentProxy);
_local9.isSimple = false;
if (((!((_local9.content is IList))) && (!((_local9.content is Array))))){
_local9.content = _arg1.createIterableValue();
};
};
decodeArray(_arg2, dimensions, _arg4, _arg1.makeObjectsBindable);
};
}
private function getSingleElementFromNode(_arg1:XML, ... _args):XML{
var _local4:XML;
var _local5:QName;
var _local3:XMLList = _arg1.elements();
for each (_local4 in _local3) {
if (((!((_args == null))) && ((_args.length > 0)))){
for each (_local5 in _args) {
if (_local4.name() == _local5){
return (_local4);
};
};
} else {
return (_local4);
};
};
return (null);
}
private function decodeArray(_arg1, _arg2:Array, _arg3, _arg4:Boolean):void{
var _local7:XML;
var _local8:*;
var _local9:int;
var _local10:*;
var _local11:Array;
var _local12:*;
var _local13:uint;
if ((_arg3 is XML)){
_local7 = (_arg3 as XML);
_arg3 = _local7.elements();
};
if (!TypeIterator.isIterable(_arg3)){
_arg3 = [_arg3];
};
var _local5:TypeIterator = new TypeIterator(_arg3);
var _local6:uint;
if (_arg2.length > 0){
_local8 = _arg2[0];
if (!(_local8 is Array)){
_local8 = [_local8];
};
for each (_local9 in _local8) {
_local6++;
if (_local9 < 0){
if (_arg2.length == 1){
while (_local5.hasNext()) {
_local10 = _local5.next();
decodeArrayItem(_arg1, _local10);
};
} else {
if (_arg2.length > 1){
while (_local5.hasNext()) {
_local10 = _local5.next();
_local11 = _arg2[_local6];
_local12 = SOAPDecoder(processor).createIterableValue(schemaType);
decodeArray(_local12, _local11, _local10, _arg4);
TypeIterator.push(_arg1, _local12);
};
};
};
} else {
_local13 = 0;
while (_local13 < _local9) {
_local10 = TypeIterator.getItemAt(_local5.value, _local13);
if (_arg2.length == 1){
decodeArrayItem(_arg1, _local10);
} else {
if (_arg2.length > 1){
_local11 = _arg2[_local6];
_local12 = SOAPDecoder(processor).createIterableValue(schemaType);
decodeArray(_local12, _local11, _local10, _arg4);
TypeIterator.push(_arg1, _local12);
};
};
_local13++;
};
};
};
};
}
private function get dimensions():Array{
if (_dimensions == null){
_dimensions = [];
};
return (_dimensions);
}
public function encode(_arg1:SOAPEncoder, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local6:String;
processor = _arg1;
soapConstants = _arg1.soapConstants;
schemaManager = _arg1.schemaManager;
schemaConstants = schemaManager.schemaConstants;
_arg4 = unwrapMXMLArray(_arg4);
if (_arg5 != null){
_local6 = determineWSDLArrayType(_arg5, _arg1.wsdlOperation.wsdlConstants);
parseWSDLArrayType(_local6);
};
schemaType = schemaManager.getQNameForPrefixedName(schemaTypeName, _arg5);
_arg2.addNamespace(soapConstants.encodingNamespace);
encodeDimensionInformation(_arg2, dimensionString);
encodeArray(_arg2, dimensions, _arg4);
}
private function parseWSDLArrayType(_arg1:String):void{
var _local2:String;
var _local9:String;
var _local10:Array;
var _local3:int = _arg1.indexOf("[");
var _local4 = -1;
if (_local3 > 0){
dimensionString = _arg1.substring(_local3);
schemaTypeName = StringUtil.trim(_arg1.substring(0, _local3));
_local4 = _arg1.indexOf("]", _local3);
};
if ((((_local3 < 0)) || ((_local4 < 0)))){
throw (new Error((("Invalid SOAP-encoded Array type '" + _arg1) + "'.")));
};
var _local5:String = StringUtil.trim(_arg1.substring(_local3));
var _local6:Array = _local5.split("[");
var _local7:Array = dimensions;
var _local8:int = (_local6.length - 1);
while (_local8 >= 0) {
_local9 = (_local6[_local8] as String);
if (_local9.length > 0){
if (_local7.length > 0){
_local10 = [];
_local7.push(_local10);
_local7 = _local10;
};
parseDimensions(_arg1, _local9, _local7);
};
_local8--;
};
}
private function parseDimensions(_arg1:String, _arg2:String, _arg3:Array):void{
var _local4:Number;
var _local6:String;
if (_arg2.charAt(0) == "["){
_arg2 = _arg2.substring(1);
};
if (_arg2.charAt((_arg2.length - 1)) == "]"){
_arg2 = _arg2.substring(0, (_arg2.length - 1));
};
var _local5:Array = _arg2.split(",");
if (_local5.length > 0){
for each (_local6 in _local5) {
if (_local6.length > 0){
_local4 = parseInt(_local6);
if (((!(isNaN(_local4))) && ((_local4 < int.MAX_VALUE)))){
_arg3.push(int(_local4));
} else {
throw (new Error((((("Invalid dimension '" + _local6) + "' for SOAP encoded Array type '") + _arg1) + "'.")));
};
} else {
_arg3.push(-1);
};
};
};
}
private function encodeArray(_arg1:XML, _arg2:Array, _arg3):void{
var _local7:*;
var _local8:int;
var _local9:*;
var _local10:Array;
var _local11:String;
var _local12:XML;
var _local13:uint;
var _local4:String = schemaConstants.getXSIToken(schemaConstants.typeAttrQName);
_arg1.@[_local4] = soapConstants.getSOAPEncodingToken(soapConstants.soapencArrayQName);
if (!TypeIterator.isIterable(_arg3)){
_arg3 = [_arg3];
};
var _local5:TypeIterator = new TypeIterator(_arg3);
var _local6:uint;
if (_arg2.length > 0){
_local7 = _arg2[0];
if (!(_local7 is Array)){
_local7 = [_local7];
};
for each (_local8 in _local7) {
_local6++;
if (_local8 < 0){
if (_arg2.length == 1){
while (_local5.hasNext()) {
_local9 = _local5.next();
_local12 = new XML((("<" + itemName.localName) + "/>"));
encodeArrayItem(_local12, _local9);
_arg1.appendChild(_local12);
};
} else {
if (_arg2.length > 1){
_local11 = "[]";
while (_local5.hasNext()) {
_local9 = _local5.next();
_local10 = _arg2[_local6];
_local12 = new XML((("<" + itemName.localName) + "/>"));
encodeDimensionInformation(_local12, _local11);
encodeArray(_local12, _local10, _local9);
_arg1.appendChild(_local12);
};
};
};
} else {
_local13 = 0;
while (_local13 < _local8) {
_local9 = TypeIterator.getItemAt(_local5.value, _local13);
if (_arg2.length == 1){
_local12 = new XML((("<" + itemName.localName) + "/>"));
encodeArrayItem(_local12, _local9);
_arg1.appendChild(_local12);
} else {
if (_arg2.length > 1){
_local11 = (("[" + _local8) + "]");
_local10 = _arg2[_local6];
_local12 = new XML((("<" + itemName.localName) + "/>"));
encodeDimensionInformation(_local12, _local11);
encodeArray(_local12, _local10, _local9);
_arg1.appendChild(_local12);
};
};
_local13++;
};
};
};
};
}
private function encodeArrayItem(_arg1:XML, _arg2):void{
var _local3:SOAPEncoder = (processor as SOAPEncoder);
_local3.encodeType(schemaType, _arg1, itemName, _arg2);
}
private function encodeDimensionInformation(_arg1:XML, _arg2:String):void{
var _local3:String = schemaType.uri;
var _local4:String = schemaManager.getOrCreatePrefix(_local3);
var _local5:Namespace = new Namespace(_local4, _local3);
var _local6:String = ((_local4 + ":") + schemaType.localName);
_local6 = (_local6 + _arg2);
_arg1.addNamespace(_local5);
var _local7:String = soapConstants.getSOAPEncodingToken(soapConstants.soapencArrayTypeQName);
_arg1.@[_local7] = _local6;
}
private function unwrapMXMLArray(_arg1){
var classInfo:Object;
var properties:Array;
var property:String;
var childValue:*;
var value = _arg1;
var result:* = value;
if (!(value is Array)){
try {
classInfo = ObjectUtil.getClassInfo((value as Object));
properties = classInfo["properties"];
if (properties.length == 1){
property = properties[0];
if (((!((property == null))) && (value.hasOwnProperty(property)))){
childValue = value[property];
if ((childValue is Array)){
result = childValue;
};
};
};
} catch(e:Error) {
};
};
return (result);
}
}
}//package mx.rpc.soap.types
Section 144
//ISOAPDecoder (mx.rpc.soap.ISOAPDecoder)
package mx.rpc.soap {
import mx.rpc.wsdl.*;
import mx.rpc.xml.*;
public interface ISOAPDecoder extends IXMLDecoder {
function get wsdlOperation():WSDLOperation;
function get headerFormat():String;
function set wsdlOperation(_arg1:WSDLOperation):void;
function get multiplePartsFormat():String;
function set headerFormat(_arg1:String):void;
function set multiplePartsFormat(_arg1:String):void;
function get ignoreWhitespace():Boolean;
function set forcePartArrays(_arg1:Boolean):void;
function get resultFormat():String;
function decodeResponse(_arg1):SOAPResult;
function set resultFormat(_arg1:String):void;
function get forcePartArrays():Boolean;
function set ignoreWhitespace(_arg1:Boolean):void;
}
}//package mx.rpc.soap
Section 145
//ISOAPEncoder (mx.rpc.soap.ISOAPEncoder)
package mx.rpc.soap {
import mx.rpc.wsdl.*;
import mx.rpc.xml.*;
public interface ISOAPEncoder extends IXMLEncoder {
function set wsdlOperation(_arg1:WSDLOperation):void;
function encodeRequest(_arg1=null, _arg2:Array=null):XML;
function get wsdlOperation():WSDLOperation;
function set ignoreWhitespace(_arg1:Boolean):void;
function get ignoreWhitespace():Boolean;
}
}//package mx.rpc.soap
Section 146
//LoadEvent (mx.rpc.soap.LoadEvent)
package mx.rpc.soap {
import flash.events.*;
import mx.rpc.events.*;
import mx.rpc.wsdl.*;
import flash.xml.*;
public class LoadEvent extends WSDLLoadEvent {
private var _document:XMLDocument;
public static const LOAD:String = "load";
public function LoadEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=true, _arg4:WSDL=null, _arg5:String=null){
super(((_arg1 == null)) ? LOAD : _arg1, _arg2, _arg3, _arg4, _arg5);
}
public function get document():XMLDocument{
if ((((_document == null)) && (!((xml == null))))){
try {
_document = new XMLDocument(xml.toXMLString());
} catch(e:Error) {
};
};
return (_document);
}
override public function toString():String{
return (formatToString("LoadEvent", "location", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new LoadEvent(type, bubbles, cancelable, wsdl, location));
}
public static function createEvent(_arg1:WSDL, _arg2:String=null):LoadEvent{
return (new LoadEvent(LOAD, false, true, _arg1, _arg2));
}
}
}//package mx.rpc.soap
Section 147
//SOAPConstants (mx.rpc.soap.SOAPConstants)
package mx.rpc.soap {
import flash.utils.*;
import mx.rpc.soap.types.*;
import mx.utils.*;
public class SOAPConstants {
public var soapBase64QName:QName;
private var _envelopeNS:Namespace;
public var headerQName:QName;
public var soapencArrayQName:QName;
private var _contentType:String;
public var soapencRefQName:QName;
public var faultQName:QName;
public var bodyQName:QName;
public var soapoffsetQName:QName;
public var actorQName:QName;
public var envelopeQName:QName;
public var mustUnderstandQName:QName;
public var soapencArrayTypeQName:QName;
private var _encodingNS:Namespace;
public static const SOAP_ENVELOPE_URI:String = "http://schemas.xmlsoap.org/soap/envelope/";
public static const XML_DECLARATION:String = "<?xml version="1.0" encoding="utf-8"?>
";
public static const SOAP_ENCODING_URI:String = "http://schemas.xmlsoap.org/soap/encoding/";
public static const USE_ENCODED:String = "encoded";
public static const RPC_STYLE:String = "rpc";
public static const SOAP_CONTENT_TYPE:String = "text/xml; charset=utf-8";
public static const mapQName:QName = new QName(APACHE_SOAP_URI, "Map");
public static const diffgramQName:QName = new QName("urn:schemas-microsoft-com:xml-diffgram-v1", "diffgram");
public static const DOC_STYLE:String = "document";
public static const WRAPPED_STYLE:String = "wrapped";
public static const USE_LITERAL:String = "literal";
public static const documentQName:QName = new QName(APACHE_SOAP_URI, "Document");
public static const DEFAULT_USE:String = "literal";
public static const SOAP12_ENVELOPE_URI:String = "http://www.w3.org/2002/12/soap-envelope";
public static const SOAP12_ENCODING_URI:String = "http://www.w3.org/2002/12/soap-encoding";
public static const rowSetQName:QName = new QName(APACHE_SOAP_URI, "RowSet");
public static const SOAP12_CONTENT_TYPE:String = "application/soap+xml; charset=utf-8";
public static const queryBeanQName:QName = new QName(COLD_FUSION_URI, "QueryBean");
public static const APACHE_SOAP_URI:String = "http://xml.apache.org/xml-soap";
public static const SOAP_ENC_PREFIX:String = "SOAP-ENC";
public static const COLD_FUSION_URI:String = "http://rpc.xml.coldfusion";
public static const DEFAULT_OPERATION_STYLE:String = "document";
public static const msdataURI:String = "urn:schemas-microsoft-com:xml-msdata";
public static const SOAP_ENV_PREFIX:String = "SOAP-ENV";
private static var customTypesInitialized:Boolean;
private static var typeMap:Object = {};
private static var constantsCache:Object;
public function SOAPConstants(_arg1:Namespace=null, _arg2:Namespace=null){
if (_arg1 == null){
_arg1 = new Namespace(SOAP_ENV_PREFIX, SOAP_ENVELOPE_URI);
};
if (_arg2 == null){
_arg2 = new Namespace(SOAP_ENC_PREFIX, SOAP_ENCODING_URI);
};
_envelopeNS = _arg1;
_encodingNS = _arg2;
envelopeQName = new QName(envelopeURI, "Envelope");
headerQName = new QName(envelopeURI, "Header");
bodyQName = new QName(envelopeURI, "Body");
faultQName = new QName(envelopeURI, "Fault");
actorQName = new QName(envelopeURI, "actor");
mustUnderstandQName = new QName(envelopeURI, "mustUnderstand");
soapencArrayQName = new QName(encodingURI, "Array");
soapencArrayTypeQName = new QName(encodingURI, "arrayType");
soapencRefQName = new QName(encodingURI, "multiRef");
soapoffsetQName = new QName(encodingURI, "offset");
soapBase64QName = new QName(encodingURI, "base64");
if (!customTypesInitialized){
initCustomSOAPTypes();
};
registerCustomSOAPType(soapencArrayQName, SOAPArrayType);
registerCustomSOAPType(soapencArrayTypeQName, SOAPArrayType);
}
public function getSOAPEncodingToken(_arg1:QName):String{
return (((encodingNamespace.prefix + ":") + _arg1.localName));
}
public function get encodingNamespace():Namespace{
return (_encodingNS);
}
public function get contentType():String{
return (_contentType);
}
public function get encodingURI():String{
return (encodingNamespace.uri);
}
public function get envelopeNamespace():Namespace{
return (_envelopeNS);
}
public function get envelopeURI():String{
return (envelopeNamespace.uri);
}
public static function getConstants(_arg1:XML=null):SOAPConstants{
var _local2:Namespace;
var _local3:Namespace;
var _local5:Array;
var _local6:Namespace;
if (_arg1 != null){
_local5 = _arg1.namespaceDeclarations();
for each (_local6 in _local5) {
if (((URLUtil.urisEqual(_local6.uri, SOAP_ENVELOPE_URI)) || (URLUtil.urisEqual(_local6.uri, SOAP12_ENVELOPE_URI)))){
_local2 = _local6;
} else {
if (((URLUtil.urisEqual(_local6.uri, SOAP_ENCODING_URI)) || (URLUtil.urisEqual(_local6.uri, SOAP12_ENCODING_URI)))){
_local3 = _local6;
};
};
};
};
if (_local2 == null){
_local2 = new Namespace(SOAP_ENV_PREFIX, SOAP_ENVELOPE_URI);
};
if (_local3 == null){
_local3 = new Namespace(SOAP_ENC_PREFIX, SOAP_ENCODING_URI);
};
if (constantsCache == null){
constantsCache = {};
};
var _local4:SOAPConstants = constantsCache[_local2.uri];
if (_local4 == null){
_local4 = new SOAPConstants(_local2, _local3);
constantsCache[_local2.uri] = _local4;
};
return (_local4);
}
private static function initCustomSOAPTypes():void{
registerCustomSOAPType(queryBeanQName, QueryBeanType);
registerCustomSOAPType(mapQName, MapType);
registerCustomSOAPType(rowSetQName, RowSetType);
registerCustomSOAPType(documentQName, ApacheDocumentType);
registerCustomSOAPType(diffgramQName, DataSetType);
customTypesInitialized = true;
}
private static function getKey(_arg1:QName):String{
var _local2:String;
if ((((_arg1.uri == null)) || ((_arg1.uri == "")))){
_local2 = _arg1.localName;
} else {
_local2 = _arg1.toString();
};
return (_local2);
}
public static function unregisterCustomSOAPType(_arg1:QName):void{
var _local2:String;
if (_arg1 != null){
_local2 = getKey(_arg1);
delete typeMap[_local2];
};
}
public static function getCustomSOAPType(_arg1:QName):ICustomSOAPType{
var soapType:ICustomSOAPType;
var key:String;
var definitionName:String;
var c:Class;
var type = _arg1;
if (type != null){
key = getKey(type);
definitionName = (typeMap[key] as String);
if (definitionName != null){
try {
c = (getDefinitionByName(definitionName) as Class);
soapType = (new (c) as ICustomSOAPType);
} catch(e:Error) {
};
};
};
return (soapType);
}
public static function registerCustomSOAPType(_arg1:QName, _arg2):void{
var _local4:String;
var _local3:String = getKey(_arg1);
if ((_arg2 is String)){
_local4 = (_arg2 as String);
} else {
_local4 = getQualifiedClassName(_arg2);
};
typeMap[_local3] = _local4;
}
public static function isSOAPEncodedType(_arg1:QName):Boolean{
var _local2:String = ((_arg1)!=null) ? _arg1.uri : null;
if (_local2 != null){
if (((URLUtil.urisEqual(_local2, SOAPConstants.SOAP_ENCODING_URI)) || (URLUtil.urisEqual(_local2, SOAPConstants.SOAP12_ENCODING_URI)))){
return (true);
};
};
return (false);
}
}
}//package mx.rpc.soap
Section 148
//SOAPDecoder (mx.rpc.soap.SOAPDecoder)
package mx.rpc.soap {
import flash.utils.*;
import mx.rpc.wsdl.*;
import flash.xml.*;
import mx.rpc.xml.*;
import mx.rpc.soap.types.*;
import mx.logging.*;
import mx.utils.*;
public class SOAPDecoder extends XMLDecoder implements ISOAPDecoder {
private var _multiplePartsFormat:String;
private var _forcePartArrays:Boolean;
private var _headerFormat:String;
private var log:ILogger;
private var _resultFormat:String;
private var _ignoreWhitespace:Boolean;// = true
private var _referencesResolved:Boolean;
public var supportGenericCompoundTypes:Boolean;// = false
private var _wsdlOperation:WSDLOperation;
private var _elementsWithId:XMLList;
public static var PI_WHITESPACE_PATTERN:RegExp = new RegExp("[\\?][>]\\s*[<]", "g");
public function SOAPDecoder(){
log = Log.getLogger("mx.rpc.soap.SOAPDecoder");
}
public function get soapConstants():SOAPConstants{
return (wsdlOperation.soapConstants);
}
override public function decodeComplexRestriction(_arg1:XML, _arg2, _arg3:QName, _arg4):void{
var _local8:ICustomSOAPType;
var _local5:SchemaConstants = schemaManager.schemaConstants;
var _local6:String = _arg1.@base;
var _local7:QName = schemaManager.getQNameForPrefixedName(_local6, _arg1);
if (_local7 == soapConstants.soapencArrayQName){
_local8 = SOAPConstants.getCustomSOAPType(_local7);
if (_local8 != null){
_local8.decode(this, _arg2, _arg3, _arg4, _arg1);
return;
};
};
super.decodeComplexRestriction(_arg1, _arg2, _arg3, _arg4);
}
public function set multiplePartsFormat(_arg1:String):void{
_multiplePartsFormat = _arg1;
}
private function resolveReferences(_arg1:XML, _arg2:Boolean=true):void{
var child:XML;
var element:XML;
var href:String;
var hashPosition:int;
var matches:XMLList;
var referent:XML;
var root = _arg1;
var cleanupElementsWithIdCache = _arg2;
if (_referencesResolved){
return;
};
var index:uint;
if (_elementsWithId == null){
_elementsWithId = document..*.(attribute("id").length() > 0);
};
for each (child in root.children()) {
if (child.nodeKind() == "element"){
element = child;
href = getAttributeFromNode("href", element);
if (href != null){
hashPosition = href.indexOf("#");
if (hashPosition >= 0){
href = href.substring((hashPosition + 1));
};
matches = _elementsWithId.(@id == href);
if (matches.length() > 0){
referent = matches[0];
} else {
throw (new Error((("The element referenced by id '" + href) + "' was not found.")));
};
referent.setName(element.name());
if (referent.hasComplexContent()){
resolveReferences(referent, false);
};
root.replace(index, referent);
} else {
if (element.hasComplexContent()){
resolveReferences(element, false);
};
};
};
index = (index + 1);
};
if (cleanupElementsWithIdCache){
_elementsWithId = null;
_referencesResolved = true;
};
}
protected function decodeFaults(_arg1:XMLList):Array{
var _local3:XML;
var _local4:QName;
var _local5:String;
var _local6:String;
var _local7:XML;
var _local8:String;
var _local9:XMLList;
var _local10:XML;
var _local11:SOAPFault;
log.debug("SOAP: Decoding SOAP response fault");
var _local2:Array = [];
for each (_local3 in _arg1) {
_local7 = _local3;
_local9 = _local3.children();
for each (_local10 in _local9) {
if (_local10.localName() == "faultcode"){
_local4 = schemaManager.getQNameForPrefixedName(_local10.toString(), _local10);
} else {
if (_local10.localName() == "faultstring"){
_local5 = _local10.toString();
} else {
if (_local10.localName() == "faultactor"){
_local8 = _local10.toString();
} else {
if (_local10.localName() == "detail"){
if (_local10.hasComplexContent()){
_local6 = _local10.children().toXMLString();
} else {
_local6 = _local10.toString();
};
};
};
};
};
};
_local11 = new SOAPFault(_local4, _local5, _local6, _local7, _local8);
_local2.push(_local11);
};
return (_local2);
}
override protected function preProcessXML(_arg1:XML):void{
if (outputEncoding.useStyle == SOAPConstants.USE_ENCODED){
resolveReferences(_arg1);
};
}
public function get schemaConstants():SchemaConstants{
return (schemaManager.schemaConstants);
}
public function set forcePartArrays(_arg1:Boolean):void{
_forcePartArrays = _arg1;
}
protected function decodeHeaders(_arg1:XML):Array{
var _local4:XML;
var _local5:QName;
var _local6:XML;
var _local7:Object;
var _local8:SOAPHeader;
var _local9:String;
var _local10:String;
log.debug("Decoding SOAP response headers");
var _local2:Array = [];
var _local3:XMLList = _arg1.elements();
for each (_local4 in _local3) {
if (headerFormat == "object"){
_local5 = getXSIType(_local4);
_local6 = null;
_local7 = null;
if (_local5 != null){
_local6 = schemaManager.getNamedDefinition(_local5, constants.complexTypeQName, constants.simpleTypeQName);
};
if (_local6 != null){
schemaManager.releaseScope();
_local7 = decode(_local4, null, _local5);
} else {
_local7 = decode(_local4, _local4.name());
};
_local8 = new SOAPHeader(_local4.name(), _local7);
_local9 = XMLUtil.getAttributeByQName(_local4, soapConstants.mustUnderstandQName).toString();
if (_local9 == "1"){
_local8.mustUnderstand = true;
};
_local10 = XMLUtil.getAttributeByQName(_local4, soapConstants.actorQName).toString();
if (_local10 != ""){
_local8.role = _local10;
};
_local2.push(_local8);
} else {
if (headerFormat == "e4x"){
_local2.push(_local4);
} else {
if (headerFormat == "xml"){
_local2.push(new XMLDocument(_local4.toString()));
};
};
};
};
return (_local2);
}
override public function decodeComplexType(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null, _arg6:DecodingContext=null):void{
var _local7:XML;
if ((_arg4 is XML)){
_local7 = (_arg4 as XML);
if ((((_local7.elements(SOAPConstants.diffgramQName).length() > 0)) && ((_local7.elements(schemaConstants.schemaQName).length() > 0)))){
decodeType(SOAPConstants.diffgramQName, _arg2, _local7.name(), _arg4);
return;
};
};
super.decodeComplexType(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
protected function get inputEncoding():WSDLEncoding{
var _local1:WSDLEncoding;
if (_wsdlOperation.inputMessage != null){
_local1 = _wsdlOperation.inputMessage.encoding;
} else {
_local1 = new WSDLEncoding();
};
return (_local1);
}
protected function decodeBody(_arg1:XML, _arg2:SOAPResult):void{
var _local3:*;
var _local6:WSDLMessagePart;
var _local7:XMLList;
var _local8:XML;
var _local9:*;
var _local10:QName;
var _local11:QName;
var _local12:XML;
var _local13:String;
var _local14:uint;
var _local15:QName;
var _local16:uint;
log.debug("Decoding SOAP response body");
document = _arg1;
preProcessXML(_arg1);
if (wsdlOperation.outputMessage == null){
_arg2.result = undefined;
return;
};
var _local4:Array = wsdlOperation.outputMessage.parts;
if ((((_local4 == null)) || ((_local4.length == 0)))){
_arg2.result = undefined;
return;
};
var _local5:XML = _arg1;
if (wsdlOperation.style == SOAPConstants.RPC_STYLE){
_local5 = _local5.elements()[0];
} else {
if ((((outputEncoding.useStyle == SOAPConstants.USE_LITERAL)) && ((wsdlOperation.outputMessage.isWrapped == true)))){
_local5 = _local5.elements()[0];
};
};
for each (_local6 in _local4) {
if (_local6.element != null){
if (_local5.hasComplexContent()){
_local7 = _local5.elements(_local6.element);
} else {
_local7 = _local5.text();
};
_local10 = _local6.element;
_local11 = null;
} else {
_local11 = _local6.type;
_local12 = _local6.definition;
if (_local5.hasComplexContent()){
if (outputEncoding.useStyle == SOAPConstants.USE_ENCODED){
_local10 = new QName("", _local6.name.localName);
_local7 = _local5.elements(_local10);
if (_local7.length() == 0){
_local13 = outputEncoding.namespaceURI;
_local10 = new QName(_local13, _local6.name.localName);
_local7 = _local5.elements(_local10);
if (_local7.length() == 0){
_local13 = inputEncoding.namespaceURI;
_local10 = new QName(_local13, _local6.name.localName);
_local7 = _local5.elements(_local10);
};
};
} else {
_local7 = _local5.elements(_local6.name);
};
} else {
_local7 = _local5.text();
};
};
for each (_local8 in _local7) {
_local9 = decode(_local8, _local10, _local11, _local12);
if (_local4.length > 1){
if (multiplePartsFormat == "object"){
if (_local3 == null){
_local3 = createContent(_local5.name());
_local3.isSimple = false;
};
if (_local3[_local6.name.localName] == null){
_local14 = getMaxOccurs(_local12);
if ((((((_local14 > 1)) && (forcePartArrays))) || ((_local7.length() > 1)))){
_local3[_local6.name.localName] = createIterableValue(_local6.type);
};
};
if (TypeIterator.isIterable(_local3[_local6.name.localName])){
TypeIterator.push(_local3[_local6.name.localName], _local9);
} else {
_local3[_local6.name.localName] = _local9;
};
} else {
if (multiplePartsFormat == "array"){
if (_local3 == null){
_local3 = createIterableValue(_local5.name());
};
TypeIterator.push(_local3, _local9);
};
};
} else {
if (_local3 == null){
_local15 = _local11;
if (_local15 == null){
_local15 = _local6.element;
};
if (_local15 == null){
_local15 = _local6.name;
};
_local16 = getMaxOccurs(_local12);
if ((((((_local16 > 1)) && (forcePartArrays))) || ((_local7.length() > 1)))){
_local3 = createIterableValue(_local15);
} else {
_local3 = createContent();
};
};
if (TypeIterator.isIterable(_local3)){
TypeIterator.push(_local3, _local9);
} else {
_local3 = _local9;
};
};
};
};
if ((_local3 is ContentProxy)){
_local3 = ContentProxy(_local3).content;
};
_arg2.result = _local3;
}
public function set wsdlOperation(_arg1:WSDLOperation):void{
_wsdlOperation = _arg1;
schemaManager = _wsdlOperation.schemaManager;
}
public function get multiplePartsFormat():String{
return (_multiplePartsFormat);
}
public function set headerFormat(_arg1:String):void{
_headerFormat = _arg1;
}
public function decodeResponse(_arg1):SOAPResult{
var soapResult:SOAPResult;
var responseString:String;
var oldIgnoreWhitespace:Boolean;
var responseXML:XML;
var response = _arg1;
if ((response is XML)){
responseString = XML(response).toXMLString();
} else {
responseString = String(response);
};
var startTime:int = getTimer();
log.info("Decoding SOAP response");
reset();
if (responseString != null){
log.debug("Encoded SOAP response {0}", responseString);
oldIgnoreWhitespace = XML.ignoreWhitespace;
try {
responseString = responseString.replace(PI_WHITESPACE_PATTERN, "?><");
responseString = StringUtil.trim(responseString);
XML.ignoreWhitespace = ignoreWhitespace;
responseXML = new XML(responseString);
soapResult = decodeEnvelope(responseXML);
} finally {
XML.ignoreWhitespace = oldIgnoreWhitespace;
};
};
log.info("Decoded SOAP response into result [{0} millis]", (getTimer() - startTime));
return (soapResult);
}
override public function decodeType(_arg1:QName, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local9:SchemaDatatypes;
var _local10:String;
var _local11:SchemaConstants;
var _local12:XML;
var _local6:QName = _arg1;
var _local7:QName = getXSIType(_arg4);
if (_local7 != null){
_arg1 = _local7;
};
if (outputEncoding.useStyle == SOAPConstants.USE_ENCODED){
if (SOAPConstants.isSOAPEncodedType(_arg1)){
_local9 = schemaManager.schemaDatatypes;
if (_arg1 == soapConstants.soapBase64QName){
_arg1 = _local9.base64BinaryQName;
} else {
_local10 = _arg1.localName;
if (((!((_local10 == "Array"))) && (!((_local10 == "arrayType"))))){
_arg1 = schemaConstants.getQName(_local10);
};
};
};
};
var _local8:ICustomSOAPType = SOAPConstants.getCustomSOAPType(_arg1);
if (_local8 != null){
_local8.decode(this, _arg2, _arg3, _arg4, _arg5);
setXSIType(_arg2, _arg1);
} else {
_local11 = schemaManager.schemaConstants;
if (isBuiltInType(_arg1)){
super.decodeType(_arg1, _arg2, _arg3, _arg4, _arg5);
} else {
_local12 = schemaManager.getNamedDefinition(_arg1, _local11.complexTypeQName, _local11.simpleTypeQName, _local11.elementTypeQName);
if (_local12 != null){
schemaManager.releaseScope();
super.decodeType(_arg1, _arg2, _arg3, _arg4, _arg5);
} else {
super.decodeType(_local6, _arg2, _arg3, _arg4, _arg5);
};
};
};
}
public function get forcePartArrays():Boolean{
return (_forcePartArrays);
}
public function set ignoreWhitespace(_arg1:Boolean):void{
_ignoreWhitespace = _arg1;
}
public function get wsdlOperation():WSDLOperation{
return (_wsdlOperation);
}
public function get headerFormat():String{
return (_headerFormat);
}
public function set resultFormat(_arg1:String):void{
_resultFormat = _arg1;
}
protected function decodeEnvelope(_arg1:XML):SOAPResult{
var _local3:Namespace;
var _local4:SchemaConstants;
var _local5:Array;
var _local6:Namespace;
var _local7:XML;
var _local8:XML;
var _local9:XMLList;
var _local10:Array;
var _local11:XMLList;
var _local12:XML;
var _local13:String;
var _local14:XMLDocument;
var _local15:XMLNode;
log.debug("Decoding SOAP response envelope");
var _local2:SOAPResult = new SOAPResult();
if (_arg1 != null){
_local3 = _arg1.namespace();
};
if (_local3 == null){
throw (new Error(("SOAP Response cannot be decoded. Raw response: " + _arg1)));
};
if (_local3.uri != SOAPConstants.SOAP_ENVELOPE_URI){
throw (new Error("SOAP Response Version Mismatch"));
};
_local5 = _arg1.inScopeNamespaces();
for each (_local6 in _local5) {
schemaManager.namespaces[_local6.prefix] = _local6;
};
_local7 = _arg1[soapConstants.headerQName][0];
if (_local7 != null){
_local2.headers = decodeHeaders(_local7);
};
_local8 = _arg1[soapConstants.bodyQName][0];
if ((((((_local8 == null)) || ((_local8.hasComplexContent() == false)))) || ((_local8.children().length() <= 0)))){
_local2.result = undefined;
} else {
_local9 = _local8[soapConstants.faultQName];
if (_local9.length() > 0){
_local2.isFault = true;
_local2.result = decodeFaults(_local9);
} else {
if (resultFormat == "object"){
decodeBody(_local8, _local2);
} else {
if (resultFormat == "e4x"){
_local2.result = _local8.children();
} else {
if (resultFormat == "xml"){
_local10 = [];
_local11 = _local8.children();
for each (_local12 in _local11) {
_local13 = _local12.nodeKind();
if (_local13 == "element"){
_local14 = new XMLDocument(_local12.toString());
_local15 = _local14.firstChild;
_local10.push(_local15);
} else {
if (_local13 == "text"){
_local10.push(_local12.toString());
};
};
};
_local2.result = _local10;
};
};
};
};
};
return (_local2);
}
override public function reset():void{
super.reset();
_referencesResolved = false;
_elementsWithId = null;
}
protected function get outputEncoding():WSDLEncoding{
var _local1:WSDLEncoding;
if (_wsdlOperation.outputMessage != null){
_local1 = _wsdlOperation.outputMessage.encoding;
} else {
_local1 = new WSDLEncoding();
};
return (_local1);
}
public function get ignoreWhitespace():Boolean{
return (_ignoreWhitespace);
}
public function get resultFormat():String{
return (_resultFormat);
}
override protected function parseValue(_arg1, _arg2:XMLList){
var _local3:QName;
var _local4:XMLList;
if (((((supportGenericCompoundTypes) && ((outputEncoding.useStyle == SOAPConstants.USE_LITERAL)))) && ((_arg2.length() > 0)))){
_local3 = new QName(_arg2[0].name().uri, "item");
_local4 = _arg2.elements(_local3);
if (_local4.length() > 0){
_arg2 = _local4;
};
};
return (super.parseValue(_arg1, _arg2));
}
}
}//package mx.rpc.soap
Section 149
//SOAPEncoder (mx.rpc.soap.SOAPEncoder)
package mx.rpc.soap {
import mx.rpc.wsdl.*;
import flash.xml.*;
import mx.rpc.xml.*;
import mx.resources.*;
import mx.rpc.soap.types.*;
import mx.logging.*;
public class SOAPEncoder extends XMLEncoder implements ISOAPEncoder {
private var log:ILogger;
private var _ignoreWhitespace:Boolean;// = true
private var _wsdlOperation:WSDLOperation;
private var isSOAPEncoding:Boolean;// = false
private var resourceManager:IResourceManager;
public function SOAPEncoder(){
resourceManager = ResourceManager.getInstance();
super();
log = Log.getLogger("mx.rpc.soap.SOAPEncoder");
}
override protected function deriveXSIType(_arg1:XML, _arg2:QName, _arg3):void{
var _local4:SchemaDatatypes;
var _local5:QName;
var _local6:String;
if (isSOAPEncoding){
_local4 = schemaManager.schemaDatatypes;
if ((((_arg2 == _local4.anyTypeQName)) || ((_arg2 == _local4.anySimpleTypeQName)))){
if (((isSimpleValue(_arg3)) || ((_arg2 == _local4.anySimpleTypeQName)))){
_local6 = SchemaMarshaller.guessSimpleType(_arg3);
_local5 = new QName(schemaConstants.xsdURI, _local6);
};
} else {
_local5 = _arg2;
};
if (_local5 != null){
_arg1.@[schemaConstants.getXSIToken(schemaConstants.typeAttrQName)] = schemaConstants.getXSDToken(_local5);
};
};
}
public function get soapConstants():SOAPConstants{
return (wsdlOperation.soapConstants);
}
public function set wsdlOperation(_arg1:WSDLOperation):void{
_wsdlOperation = _arg1;
schemaManager = _wsdlOperation.schemaManager;
}
protected function encodePartValue(_arg1:WSDLMessagePart, _arg2):XMLList{
var _local3:XMLList;
if (_arg1.element != null){
_local3 = encode(_arg2, _arg1.element);
} else {
_local3 = encode(_arg2, _arg1.name, _arg1.type, _arg1.definition);
};
return (_local3);
}
protected function encodeOperationAsRPCEncoded(_arg1, _arg2:XML):void{
isSOAPEncoding = true;
var _local3:XML = new XML((("<" + wsdlOperation.name) + "/>"));
var _local4:String = inputEncoding.namespaceURI;
var _local5:String = schemaManager.getOrCreatePrefix(_local4);
var _local6:Namespace = new Namespace(_local5, _local4);
_local3.setNamespace(_local6);
encodeMessage(_arg1, _local3);
_arg2.appendChild(_local3);
_arg2.@[(SOAPConstants.SOAP_ENV_PREFIX + ":encodingStyle")] = soapConstants.encodingURI;
}
protected function encodeEnvelope(_arg1, _arg2:Array):XML{
log.debug("Encoding SOAP request envelope");
var _local3:XML = new XML((("<" + soapConstants.envelopeQName.localName) + "/>"));
_local3.setNamespace(soapConstants.envelopeNamespace);
_local3.addNamespace(schemaConstants.xsdNamespace);
_local3.addNamespace(schemaConstants.xsiNamespace);
schemaManager.namespaces[soapConstants.envelopeNamespace.prefix] = soapConstants.envelopeNamespace;
encodeHeaders(_arg2, _local3);
encodeBody(_arg1, _local3);
return (_local3);
}
protected function encodeHeaders(_arg1:Array, _arg2:XML):void{
var _local3:uint;
var _local4:XML;
var _local5:uint;
if (_arg1 != null){
_local3 = _arg1.length;
if (_local3 > 0){
_local4 = new XML((("<" + soapConstants.headerQName.localName) + "/>"));
_local4.setNamespace(soapConstants.envelopeNamespace);
_arg2.appendChild(_local4);
_local5 = 0;
while (_local5 < _local3) {
encodeHeaderElement(_arg1[_local5], _local4);
_local5++;
};
};
};
}
protected function encodeOperationAsDocumentLiteral(_arg1:Object, _arg2:XML):void{
var _local4:QName;
var _local5:XML;
var _local6:String;
var _local7:Namespace;
var _local3:Array = wsdlOperation.inputMessage.parts;
if (wsdlOperation.inputMessage.isWrapped){
_local4 = wsdlOperation.inputMessage.wrappedQName;
_local5 = new XML((("<" + _local4.localName) + "/>"));
if (((!((_local4.uri == null))) && (!((_local4.uri == ""))))){
_local6 = schemaManager.getOrCreatePrefix(_local4.uri);
_local7 = new Namespace(_local6, _local4.uri);
_local5.setNamespace(_local7);
};
encodeMessage(_arg1, _local5);
_arg2.appendChild(_local5);
} else {
encodeMessage(_arg1, _arg2);
};
}
override public function encode(_arg1, _arg2:QName=null, _arg3:QName=null, _arg4:XML=null):XMLList{
var _local5:XMLList;
var _local6:uint;
var _local7:uint;
var _local8:XMLList;
var _local9:Boolean;
if (_arg4 != null){
_local5 = new XMLList();
_local6 = getMaxOccurs(_arg4);
_local7 = getMinOccurs(_arg4);
if (_local6 == 0){
return (_local5);
};
if ((((_arg1 == null)) && ((_local7 == 0)))){
return (_local5);
};
if (_local6 > 1){
_local8 = new XMLList();
_local9 = schemaManager.pushNamespaceInScope(_arg2.uri);
encodeGroupElement(_arg4, _local8, _arg2, _arg1);
if (_local9){
schemaManager.releaseScope();
};
_local5 = (_local5 + _local8);
return (_local5);
};
};
return (super.encode(_arg1, _arg2, _arg3, _arg4));
}
protected function encodeMessage(_arg1, _arg2:XML):void{
var _local3:Array;
var _local6:String;
var _local8:WSDLMessagePart;
var _local9:*;
var _local10:String;
var _local11:XMLList;
var _local12:String;
if (wsdlOperation.inputMessage != null){
_local3 = wsdlOperation.inputMessage.parts;
};
if (_local3 == null){
return;
};
var _local4:Object = {};
var _local5:int;
var _local7:uint;
while (_local7 < _local3.length) {
_local8 = _local3[_local7];
_local9 = undefined;
if ((_arg1 is Array)){
_local9 = _arg1[_local7];
if (_local9 === undefined){
if (_local8.optional){
_local5++;
} else {
_local6 = resourceManager.getString("rpc", "missingInputParameter", [_local7]);
throw (new Error(_local6));
};
};
} else {
_local10 = _local8.name.localName;
if (_arg1 != null){
_local9 = _arg1[_local10];
};
_local4[_local10] = _local9;
if ((((_local9 === undefined)) || (((!((_arg1 == null))) && (!(_arg1.hasOwnProperty(_local10))))))){
if (_local8.optional){
_local5++;
} else {
_local6 = resourceManager.getString("rpc", "missingInputParameterWithName", [_local10]);
throw (new Error(_local6));
};
};
};
if (_local9 !== undefined){
_local11 = encodePartValue(_local8, _local9);
_arg2.appendChild(_local11);
};
_local7++;
};
if (_arg1 != null){
if ((_arg1 is Array)){
if (_arg1.length < (_local3.length - _local5)){
_local6 = resourceManager.getString("rpc", "tooFewInputParameters", [_local3.length, _arg1.length]);
throw (new Error(_local6));
};
} else {
for (_local12 in _arg1) {
if (!_local4.hasOwnProperty(_local12)){
_local6 = resourceManager.getString("rpc", "unexpectedInputParameter", [_local12]);
throw (new Error(_local6));
};
};
};
};
}
protected function preEncodedCheck(_arg1):Object{
var _local3:XMLDocument;
var _local4:XMLNode;
var _local2:Object;
if (_arg1 != null){
if ((_arg1 is XMLList)){
_local2 = (_arg1 as XMLList);
} else {
if ((_arg1 is XML)){
_local2 = (_arg1 as XML);
} else {
if ((_arg1 is XMLDocument)){
_local3 = (_arg1 as XMLDocument);
_local2 = new XML(_local3.firstChild.toString());
} else {
if ((_arg1 is XMLNode)){
_local4 = (_arg1 as XMLNode);
_local2 = new XML(_local4.toString());
};
};
};
};
};
return (_local2);
}
protected function encodeBody(_arg1, _arg2:XML):void{
log.debug("Encoding SOAP request body");
var _local3:XML = new XML((("<" + soapConstants.bodyQName.localName) + "/>"));
_local3.setNamespace(soapConstants.envelopeNamespace);
var _local4:Object = preEncodedCheck(_arg1);
if (_local4 != null){
_local3.appendChild(_local4);
} else {
if (wsdlOperation.style == SOAPConstants.DOC_STYLE){
if (inputEncoding.useStyle == SOAPConstants.USE_LITERAL){
encodeOperationAsDocumentLiteral(_arg1, _local3);
} else {
throw (new Error("WSDL 1.1 supports operations with binding style 'document' only if use style is 'literal'."));
};
} else {
if (wsdlOperation.style == SOAPConstants.RPC_STYLE){
if (inputEncoding.useStyle == SOAPConstants.USE_LITERAL){
encodeOperationAsRPCLiteral(_arg1, _local3);
} else {
if (inputEncoding.useStyle == SOAPConstants.USE_ENCODED){
encodeOperationAsRPCEncoded(_arg1, _local3);
} else {
throw (new Error((("WSDL 1.1 does not support operations with binding style 'rpc' and use style " + inputEncoding.useStyle) + ".")));
};
};
} else {
throw (new Error((("Unrecognized binding style '" + wsdlOperation.style) + "'. Only 'document' and 'rpc' styles are supported.")));
};
};
};
_arg2.appendChild(_local3);
}
public function encodeRequest(_arg1=null, _arg2:Array=null):XML{
var envelopeXML:XML;
var args = _arg1;
var headers = _arg2;
reset();
var oldIgnoreWhitespace:Boolean = XML.ignoreWhitespace;
var oldPrettyPrinting:Boolean = XML.prettyPrinting;
try {
XML.ignoreWhitespace = ignoreWhitespace;
XML.prettyPrinting = false;
envelopeXML = encodeEnvelope(args, headers);
} finally {
XML.ignoreWhitespace = oldIgnoreWhitespace;
XML.prettyPrinting = oldPrettyPrinting;
};
return (envelopeXML);
}
public function set ignoreWhitespace(_arg1:Boolean):void{
_ignoreWhitespace = _arg1;
}
public function get wsdlOperation():WSDLOperation{
return (_wsdlOperation);
}
protected function encodeOperationAsRPCLiteral(_arg1:Object, _arg2:XML):void{
var _local3:XML = new XML((("<" + wsdlOperation.name) + "/>"));
var _local4:String = schemaManager.getOrCreatePrefix(inputEncoding.namespaceURI);
var _local5:Namespace = new Namespace(_local4, inputEncoding.namespaceURI);
_local3.setNamespace(_local5);
encodeMessage(_arg1, _local3);
_arg2.appendChild(_local3);
}
public function get schemaConstants():SchemaConstants{
return (schemaManager.schemaConstants);
}
override public function encodeType(_arg1:QName, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local9:String;
var _local10:String;
var _local6:SchemaDatatypes = schemaManager.schemaDatatypes;
var _local7:QName = getXSIType(_arg4);
if (_local7 != null){
_arg1 = _local7;
};
if (isSOAPEncoding){
_local7 = _arg1;
if (SOAPConstants.isSOAPEncodedType(_arg1)){
if (_arg1 == soapConstants.soapBase64QName){
_arg1 = _local6.base64BinaryQName;
} else {
_local9 = _arg1.localName;
if (((!((_local9 == "Array"))) && (!((_local9 == "arrayType"))))){
_arg1 = schemaConstants.getQName(_local9);
};
};
};
};
var _local8:ICustomSOAPType = SOAPConstants.getCustomSOAPType(_arg1);
if (_local8 != null){
_local8.encode(this, _arg2, _arg3, _arg4, _arg5);
} else {
super.encodeType(_arg1, _arg2, _arg3, _arg4, _arg5);
};
if (_local7 != null){
_local10 = _arg2.@[schemaConstants.getXSIToken(schemaConstants.typeAttrQName)];
if ((((_local10 == null)) || ((_local10 == "")))){
super.setXSIType(_arg2, _local7);
};
};
}
override public function encodeComplexRestriction(_arg1:XML, _arg2:XML, _arg3:QName, _arg4):void{
var _local8:ICustomSOAPType;
var _local5:SchemaConstants = schemaManager.schemaConstants;
var _local6:String = _arg1.@base;
var _local7:QName = schemaManager.getQNameForPrefixedName(_local6, _arg1);
if (_local7 == soapConstants.soapencArrayQName){
_local8 = SOAPConstants.getCustomSOAPType(_local7);
if (_local8 != null){
_local8.encode(this, _arg2, _arg3, _arg4, _arg1);
return;
};
};
super.encodeComplexRestriction(_arg1, _arg2, _arg3, _arg4);
}
public function get ignoreWhitespace():Boolean{
return (_ignoreWhitespace);
}
protected function encodeHeaderElement(_arg1:Object, _arg2:XML):void{
var _local4:XMLList;
var _local5:XML;
var _local6:String;
var _local7:String;
var _local8:Namespace;
var _local3:* = preEncodedCheck(_arg1);
if (_local3 != null){
_arg2.appendChild(_arg1);
} else {
_local4 = new XMLList();
if (((!((_arg1.content == null))) && (_arg1.content.hasOwnProperty(_arg1.qname.localName)))){
_arg1.content = _arg1.content[_arg1.qname.localName];
};
_local3 = preEncodedCheck(_arg1.content);
if (_local3 != null){
if ((_local3 is XMLList)){
_local4 = (_local3 as XMLList);
} else {
_local4 = new XMLList(_local3);
};
} else {
_local4 = encode(_arg1.content, _arg1.qname);
};
for each (_local5 in _local4) {
if (((((!((_arg1.qname.uri == null))) && ((_arg1.qname.uri.length > 0)))) && (!((_local5.namespace().uri == _arg1.qname.uri))))){
_local7 = schemaManager.getOrCreatePrefix(_arg1.qname.uri);
_local8 = new Namespace(_local7, _arg1.qname.uri);
_local5.setNamespace(_local8);
};
if (_arg1.mustUnderstand){
_local6 = schemaManager.getOrCreatePrefix(soapConstants.mustUnderstandQName.uri);
_local5.@[((_local6 + ":") + soapConstants.mustUnderstandQName.localName)] = "1";
};
if (_arg1.role != null){
_local6 = schemaManager.getOrCreatePrefix(soapConstants.actorQName.uri);
_local5.@[((_local6 + ":") + soapConstants.actorQName.localName)] = _arg1.role;
};
};
_arg2.appendChild(_local4);
};
}
protected function get inputEncoding():WSDLEncoding{
return (_wsdlOperation.inputMessage.encoding);
}
}
}//package mx.rpc.soap
Section 150
//SOAPFault (mx.rpc.soap.SOAPFault)
package mx.rpc.soap {
import mx.rpc.*;
public class SOAPFault extends Fault {
public var faultactor:String;
public var element:XML;
public var faultcode:QName;
public function SOAPFault(_arg1:QName, _arg2:String, _arg3:String=null, _arg4:XML=null, _arg5:String=null){
super(_arg1.localName, _arg2, _arg3);
this.element = _arg4;
this.faultactor = _arg5;
this.faultcode = _arg1;
}
public function get detail():String{
return (_faultDetail);
}
public function set detail(_arg1:String):void{
_faultDetail = _arg1;
}
override public function toString():String{
return (((((("SOAPFault (" + faultCode) + "): ") + faultString) + " ") + faultDetail));
}
public function get faultstring():String{
return (_faultString);
}
public function set faultstring(_arg1:String):void{
_faultString = _arg1;
}
}
}//package mx.rpc.soap
Section 151
//SOAPHeader (mx.rpc.soap.SOAPHeader)
package mx.rpc.soap {
public class SOAPHeader {
public var xmlType:QName;
public var role:String;
public var mustUnderstand:Boolean;
public var content:Object;
public var qname:QName;
public function SOAPHeader(_arg1:QName, _arg2:Object){
this.qname = _arg1;
this.content = _arg2;
}
public function toString():String{
return (((((qname + ", ") + content) + ", ") + role));
}
}
}//package mx.rpc.soap
Section 152
//SOAPResult (mx.rpc.soap.SOAPResult)
package mx.rpc.soap {
public class SOAPResult {
public var headers:Array;
public var isFault:Boolean;
public var result;
}
}//package mx.rpc.soap
Section 153
//WSDL (mx.rpc.wsdl.WSDL)
package mx.rpc.wsdl {
import mx.rpc.soap.*;
import mx.rpc.xml.*;
import mx.resources.*;
import mx.logging.*;
import mx.rpc.*;
public class WSDL {
private var resourceManager:IResourceManager;
private var _schemaManager:SchemaManager;
private var _wsdlConstants:WSDLConstants;
private var _log:ILogger;
private var importsManager:QualifiedResourceManager;
private var _targetNamespace:Namespace;
private var _schemaConstants:SchemaConstants;
private var _soapConstants:SOAPConstants;
private var serviceMap:Object;
private var namespaces:Object;
private var _xml:XML;
public function WSDL(_arg1:XML){
resourceManager = ResourceManager.getInstance();
super();
_xml = _arg1;
_log = Log.getLogger("mx.rpc.wsdl.WSDL");
processNamespaces();
processSchemas();
}
private function parseService(_arg1:String=null, _arg2:String=null):WSDLService{
var _local3:WSDLService;
var _local4:XML;
var _local6:XML;
var _local7:WSDLPort;
var _local8:Array;
var _local9:WSDL;
var _local5:XMLList = xml.elements(wsdlConstants.serviceQName);
for each (_local6 in _local5) {
if (_arg1 == null){
_local4 = _local6;
_arg1 = _local6.@name.toString();
break;
} else {
if (_local6.@name == _arg1){
_local4 = _local6;
break;
};
};
};
if (_local4 != null){
_local3 = new WSDLService(_arg1);
_local7 = parsePort(_local3, _local4, _arg2);
if (_local7 != null){
_local3.addPort(_local7);
};
} else {
if (importsManager != null){
_local8 = importsManager.getResources();
for each (_local9 in _local8) {
_local3 = _local9.parseService(_arg1, _arg2);
if (_local3 != null){
break;
};
};
};
};
return (_local3);
}
public function getTypes(_arg1:Namespace):XML{
var _local2:XML;
var _local4:Array;
var _local5:WSDL;
var _local3:XMLList = xml.elements(wsdlConstants.typesQName);
if (_local3.length() > 0){
_local2 = _local3[0];
} else {
if (importsManager != null){
_local4 = importsManager.getResourcesForNamespace(_arg1);
for each (_local5 in _local4) {
_local2 = _local5.getTypes(_arg1);
if (_local2 != null){
break;
};
};
};
};
return (_local2);
}
public function get soapConstants():SOAPConstants{
if (_soapConstants == null){
_soapConstants = SOAPConstants.getConstants(xml);
};
return (_soapConstants);
}
private function processNamespaces():void{
var _local1:String;
var _local2:Array;
var _local3:Namespace;
if (_xml != null){
_local1 = _xml.@targetNamespace.toString();
_targetNamespace = new Namespace(_local1);
namespaces = {};
_local2 = _xml.namespaceDeclarations();
for each (_local3 in _local2) {
namespaces[_local3.prefix] = _local3;
};
_wsdlConstants = WSDLConstants.getConstants(_xml);
_schemaConstants = SchemaConstants.getConstants(_xml);
schemaManager.addNamespaces(namespaces);
};
}
public function get targetNamespace():Namespace{
return (_targetNamespace);
}
public function get wsdlConstants():WSDLConstants{
if (_wsdlConstants == null){
_wsdlConstants = WSDLConstants.getConstants(xml);
};
return (_wsdlConstants);
}
public function get schemaManager():SchemaManager{
if (_schemaManager == null){
_schemaManager = new SchemaManager();
_schemaManager.schemaConstants = schemaConstants;
};
return (_schemaManager);
}
private function parseBinding(_arg1:QName):WSDLBinding{
var _local2:WSDLBinding;
var _local3:XML;
var _local5:XML;
var _local6:XMLList;
var _local7:String;
var _local8:QName;
var _local9:WSDLPortType;
var _local10:XMLList;
var _local11:XML;
var _local12:String;
var _local13:String;
var _local14:String;
var _local15:WSDLOperation;
var _local16:XMLList;
var _local17:XMLList;
var _local18:XML;
var _local19:WSDLEncoding;
var _local20:XMLList;
var _local21:XML;
var _local22:String;
var _local23:WSDLMessage;
var _local24:String;
var _local25:String;
var _local26:String;
var _local27:Array;
var _local28:WSDL;
var _local4:XMLList = xml.elements(wsdlConstants.bindingQName);
for each (_local5 in _local4) {
if (_local5.@name == _arg1.localName){
_local3 = _local5;
break;
};
};
if (_local3 != null){
_local2 = new WSDLBinding(_arg1.localName);
_local6 = _local3.elements(wsdlConstants.soapBindingQName);
if (_local6.length() > 0){
_local12 = _local6[0].@style.toString();
_local2.style = _local12;
_local13 = _local6[0].@transport.toString();
_local2.transport = _local13;
};
_local7 = _local3.@type.toString();
_local8 = schemaManager.getQNameForPrefixedName(_local7, _local3);
_local9 = new WSDLPortType(_local8.localName);
_local2.portType = _local9;
_local10 = _local3.elements(wsdlConstants.operationQName);
for each (_local11 in _local10) {
_local14 = _local11.@name.toString();
_local15 = new WSDLOperation(_local14);
_local15.schemaManager = schemaManager;
_local15.namespaces = namespaces;
_local15.wsdlConstants = wsdlConstants;
_local16 = _local11.elements(wsdlConstants.soapOperationQName);
if (_local16.length() > 0){
_local24 = _local16[0].@soapAction.toString();
_local15.soapAction = _local24;
_local25 = _local16[0].@style.toString();
if (_local25 == ""){
_local15.style = _local2.style;
} else {
_local15.style = _local25;
};
};
_local17 = _local11.elements(wsdlConstants.inputQName);
if (_local17.length() > 0){
_local18 = _local17[0];
_local15.inputMessage = new WSDLMessage();
_local20 = _local18.elements(wsdlConstants.soapBodyQName);
if (_local20.length() > 0){
_local21 = _local20[0];
_local19 = parseEncodingExtension(_local21);
_local15.inputMessage.encoding = _local19;
};
_local20 = _local18.elements(wsdlConstants.soapHeaderQName);
for each (_local21 in _local20) {
_local23 = parseHeader(_local14, _local21);
_local15.inputMessage.addHeader(_local23);
};
_local20 = _local18.elements(wsdlConstants.soapHeaderFaultQName);
for each (_local21 in _local20) {
_local23 = parseHeader(_local14, _local21);
_local15.inputMessage.addHeaderFault(_local23);
};
};
_local17 = _local11.elements(wsdlConstants.outputQName);
if (_local17.length() > 0){
_local18 = _local17[0];
_local15.outputMessage = new WSDLMessage();
_local20 = _local18.elements(wsdlConstants.soapBodyQName);
if (_local20.length() > 0){
_local21 = _local20[0];
_local19 = parseEncodingExtension(_local21);
_local15.outputMessage.encoding = _local19;
};
_local20 = _local18.elements(wsdlConstants.soapHeaderQName);
for each (_local21 in _local20) {
_local23 = parseHeader(_local14, _local21);
_local15.outputMessage.addHeader(_local23);
};
_local20 = _local18.elements(wsdlConstants.soapHeaderFaultQName);
for each (_local21 in _local20) {
_local23 = parseHeader(_local14, _local21);
_local15.outputMessage.addHeaderFault(_local23);
};
};
_local17 = _local11.elements(wsdlConstants.faultQName);
for each (_local18 in _local17) {
_local20 = _local18.elements(wsdlConstants.soapFaultQName);
if (_local20.length() > 0){
_local21 = _local20[0];
_local26 = _local21.@["name"].toString();
_local23 = new WSDLMessage(_local26);
_local19 = parseEncodingExtension(_local21, false, true);
_local23.encoding = _local19;
_local15.addFault(_local23);
};
};
_local9.addOperation(_local15);
};
parsePortType(_local8, _local9);
} else {
if (importsManager != null){
_local27 = importsManager.getResources();
for each (_local28 in _local27) {
_local2 = _local28.parseBinding(_arg1);
if (_local2 != null){
break;
};
};
};
};
return (_local2);
}
private function parsePort(_arg1:WSDLService, _arg2:XML, _arg3:String=null):WSDLPort{
var _local4:WSDLPort;
var _local5:XML;
var _local7:XML;
var _local8:XMLList;
var _local9:String;
var _local10:QName;
var _local11:WSDLBinding;
var _local12:String;
var _local6:XMLList = _arg2.elements(wsdlConstants.portQName);
for each (_local7 in _local6) {
if (_arg3 == null){
_local5 = _local7;
_arg3 = _local7.@name.toString();
break;
} else {
if (_local7.@name == _arg3){
_local5 = _local7;
break;
};
};
};
if (_local5 != null){
_local4 = new WSDLPort(_arg3, _arg1);
_local8 = _local5.elements(wsdlConstants.soapAddressQName);
if (_local8.length() > 0){
_local4.endpointURI = _local8[0].@location.toString();
};
_local9 = _local5.@binding.toString();
_local10 = schemaManager.getQNameForPrefixedName(_local9, _local5);
_local11 = parseBinding(_local10);
if (_local11 != null){
_local4.binding = _local11;
} else {
_local12 = resourceManager.getString("rpc", "unrecognizedBindingName", [_local10.localName, _local10.uri]);
throw (new Fault("WSDL.UnrecognizedBindingName", _local12));
};
};
return (_local4);
}
public function get xml():XML{
return (_xml);
}
private function parseDocumentOperation(_arg1:WSDLOperation):void{
var _local2:WSDLMessagePart;
var _local3:XML;
var _local4:String;
var _local5:QName;
var _local6:XMLList;
var _local7:XML;
var _local8:XMLList;
var _local9:XMLList;
var _local10:XML;
var _local11:WSDLMessage;
var _local12:XMLList;
var _local13:XML;
var _local14:WSDLMessage;
var _local15:XMLList;
var _local16:XML;
if (((((!((_arg1.inputMessage == null))) && (!((_arg1.inputMessage.encoding == null))))) && ((_arg1.inputMessage.encoding.useStyle == SOAPConstants.USE_LITERAL)))){
_local11 = _arg1.inputMessage;
if (((!((_local11.parts == null))) && ((_local11.parts.length == 1)))){
schemaManager.reset();
_local2 = _local11.parts[0];
if (_local2.element != null){
_local3 = schemaManager.getNamedDefinition(_local2.element, schemaConstants.elementTypeQName);
if (((!((_local3 == null))) && ((_local3.@["name"] == _arg1.name)))){
_local4 = _local3.@["type"];
if (((!((_local4 == null))) && (!((_local4 == ""))))){
_local5 = schemaManager.getQNameForPrefixedName(_local4, _local3);
_local7 = schemaManager.getNamedDefinition(_local5, schemaConstants.complexTypeQName);
} else {
_local6 = _local3.elements(schemaConstants.complexTypeQName);
if (_local6.length() == 1){
_local7 = _local6[0];
};
};
if (_local7 != null){
_local8 = _local7.elements(schemaConstants.attributeQName);
if (_local8.length() == 0){
_local9 = _local7.elements(schemaConstants.sequenceQName);
if ((((_local7.elements().length() == 0)) || ((_local9.length() == 1)))){
_local11.isWrapped = true;
_local11.wrappedQName = _local2.element;
_local11.parts = [];
if (_local9.length() == 1){
_local10 = _local9[0];
_local12 = _local10.elements(schemaConstants.elementTypeQName);
for each (_local13 in _local12) {
_local2 = parseWrappedMessagePart(_local13);
_local11.addPart(_local2);
};
};
};
};
};
};
};
};
};
_local7 = null;
_local4 = null;
if (((((!((_arg1.outputMessage == null))) && (!((_arg1.outputMessage.encoding == null))))) && ((_arg1.outputMessage.encoding.useStyle == SOAPConstants.USE_LITERAL)))){
_local14 = _arg1.outputMessage;
if (((!((_local14.parts == null))) && ((_local14.parts.length == 1)))){
_local2 = _local14.parts[0];
if (_local2.element != null){
schemaManager.reset();
_local3 = schemaManager.getNamedDefinition(_local2.element, schemaConstants.elementTypeQName);
if (_local3 != null){
_local4 = _local3.@["type"];
if (((!((_local4 == null))) && (!((_local4 == ""))))){
_local5 = schemaManager.getQNameForPrefixedName(_local4, _local3);
_local7 = schemaManager.getNamedDefinition(_local5, schemaConstants.complexTypeQName);
} else {
_local6 = _local3.elements(schemaConstants.complexTypeQName);
if (_local6.length() == 1){
_local7 = _local6[0];
};
};
if (_local7 != null){
_local8 = _local7.elements(schemaConstants.attributeQName);
if (_local8.length() == 0){
_local9 = _local7.elements(schemaConstants.sequenceQName);
if ((((_local7.elements().length() == 0)) || ((_local9.length() == 1)))){
_local14.isWrapped = true;
_local14.wrappedQName = _local2.element;
_local14.parts = [];
if (_local9.length() == 1){
_local10 = _local9[0];
_local15 = _local10.elements(schemaConstants.elementTypeQName);
for each (_local16 in _local15) {
_local2 = parseWrappedMessagePart(_local16);
_local14.addPart(_local2);
};
};
};
};
};
};
};
};
};
}
private function parseMessage(_arg1:WSDLMessage, _arg2:QName, _arg3:String, _arg4:int):Boolean{
var _local5:XML;
var _local6:Boolean;
var _local9:XML;
var _local10:XMLList;
var _local11:XML;
var _local12:String;
var _local13:WSDLMessagePart;
var _local14:Array;
var _local15:WSDL;
var _local7:WSDLEncoding = _arg1.encoding;
var _local8:XMLList = xml.elements(wsdlConstants.messageQName);
for each (_local9 in _local8) {
if (_local9.@name == _arg2.localName){
_local5 = _local9;
break;
};
};
if (_local5 != null){
_local6 = true;
if ((((_arg1.name == null)) || ((_arg1.name == "")))){
if (_arg4 == WSDLConstants.MODE_IN){
_arg1.name = (_arg3 + "Request");
} else {
if (_arg4 == WSDLConstants.MODE_OUT){
_arg1.name = (_arg3 + "Response");
};
};
};
_local10 = _local5.elements(wsdlConstants.partQName);
for each (_local11 in _local10) {
_local12 = _local11.@name;
if (((!((_local7 == null))) && (!(_local7.hasPart(_local12))))){
} else {
_local13 = parseMessagePart(_local11);
_arg1.addPart(_local13);
};
};
} else {
if (importsManager != null){
_local14 = importsManager.getResources();
for each (_local15 in _local14) {
_local6 = _local15.parseMessage(_arg1, _arg2, _arg3, _arg4);
if (_local6){
break;
};
};
};
};
return (_local6);
}
private function parseHeader(_arg1:String, _arg2:XML):WSDLMessage{
var _local3:String = _arg2.@["part"].toString();
var _local4:WSDLMessage = new WSDLMessage(_local3);
var _local5:WSDLEncoding = parseEncodingExtension(_arg2, true);
_local4.encoding = _local5;
parseMessage(_local4, _local5.message, _arg1, WSDLConstants.MODE_HEADER);
return (_local4);
}
public function addSchema(_arg1:Schema):void{
schemaManager.addSchema(_arg1);
}
private function processSchemas():void{
var _local2:XMLList;
var _local3:XML;
var _local4:Schema;
var _local1:XML = getTypes(targetNamespace);
if (_local1 != null){
_local2 = _local1.elements(schemaConstants.schemaQName);
for each (_local3 in _local2) {
_local4 = new Schema(_local3);
addSchema(_local4);
};
};
}
public function addImport(_arg1:Namespace, _arg2:WSDL):void{
if (importsManager == null){
importsManager = new QualifiedResourceManager();
};
importsManager.addResource(_arg1, _arg2);
}
private function parseMessagePart(_arg1:XML):WSDLMessagePart{
var _local7:String;
var _local8:QName;
var _local9:String;
var _local10:QName;
var _local2:String = _arg1.@name;
var _local3:QName = new QName("", _local2);
var _local4:WSDLMessagePart = new WSDLMessagePart(_local3);
var _local5:String = _arg1.@element;
var _local6:String = _arg1.@type;
if (_local5 != ""){
_local7 = _arg1.@element;
_local8 = schemaManager.getQNameForPrefixedName(_local7, _arg1);
_local4.element = _local8;
} else {
if (_local6 != ""){
_local9 = _arg1.@type;
_local10 = schemaManager.getQNameForPrefixedName(_local9, _arg1);
_local4.type = _local10;
};
};
return (_local4);
}
private function parseWrappedMessagePart(_arg1:XML):WSDLMessagePart{
var _local2:QName;
var _local8:String;
if (_arg1.attribute("ref").length() == 1){
_local2 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local2, schemaConstants.elementTypeQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve element definition for ref '" + _local2) + "'")));
};
};
var _local3:String = _arg1.@name;
var _local4:QName = schemaManager.getQNameForElement(_local3, _arg1.@form);
var _local5:WSDLMessagePart = new WSDLMessagePart(_local4);
var _local6:String = _arg1.@minOccurs;
var _local7:String = _arg1.@maxOccurs;
if (((!((_local6 == ""))) && ((parseInt(_local6) == 0)))){
_local5.optional = true;
};
if (_local2 != null){
_local5.element = _local2;
} else {
_local8 = _arg1.@type;
if (((!((_local8 == ""))) || (!(_arg1.hasComplexContent())))){
if ((((_local8 == null)) || ((_local8 == "")))){
_local5.type = schemaConstants.anyTypeQName;
} else {
_local5.type = schemaManager.getQNameForPrefixedName(_local8, _arg1);
};
if (((!((_local6 == ""))) || (!((_local7 == ""))))){
_local5.definition = _arg1;
};
} else {
if (_arg1.hasComplexContent()){
_local5.definition = _arg1;
};
};
};
if (_local2 != null){
schemaManager.releaseScope();
};
return (_local5);
}
public function get schemaConstants():SchemaConstants{
if (_schemaConstants == null){
_schemaConstants = SchemaConstants.getConstants(xml);
};
return (_schemaConstants);
}
public function getOperation(_arg1:String, _arg2:String=null, _arg3:String=null):WSDLOperation{
var _local4:WSDLPort = getPort(_arg2, _arg3);
var _local5:WSDLBinding = _local4.binding;
var _local6:WSDLPortType = _local5.portType;
var _local7:WSDLOperation = _local6.getOperation(_arg1);
return (_local7);
}
private function parsePortType(_arg1:QName, _arg2:WSDLPortType):Boolean{
var _local3:XML;
var _local4:Boolean;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:String;
var _local10:WSDLOperation;
var _local11:String;
var _local12:QName;
var _local13:WSDLMessage;
var _local14:XMLList;
var _local15:XMLList;
var _local16:XMLList;
var _local17:XML;
var _local18:String;
var _local19:Array;
var _local20:WSDL;
var _local5:XMLList = xml.elements(wsdlConstants.portTypeQName);
for each (_local6 in _local5) {
if (_local6.@name == _arg1.localName){
_local3 = _local6;
break;
};
};
if (_local3 != null){
_local4 = true;
_local7 = _local3.elements(wsdlConstants.operationQName);
for each (_local8 in _local7) {
_local9 = _local8.@name.toString();
_local10 = _arg2.getOperation(_local9);
if (_local9 == null){
_log.warn("An operation '{0}' was found in the port type but is missing binding information.", _local9);
} else {
_local14 = _local8.elements(wsdlConstants.inputQName);
if (_local14.length() > 0){
schemaManager.reset();
_local11 = _local14[0].@message.toString();
_local12 = schemaManager.getQNameForPrefixedName(_local11, _local14[0]);
_local13 = _local10.inputMessage;
_local13.name = _local12.localName;
parseMessage(_local13, _local12, _local9, WSDLConstants.MODE_IN);
};
_local15 = _local8.elements(wsdlConstants.outputQName);
if (_local15.length() > 0){
schemaManager.reset();
_local11 = _local15[0].@message.toString();
_local12 = schemaManager.getQNameForPrefixedName(_local11, _local15[0]);
_local13 = _local10.outputMessage;
_local13.name = _local12.localName;
parseMessage(_local13, _local12, _local9, WSDLConstants.MODE_OUT);
};
_local16 = _local8.elements(wsdlConstants.faultQName);
for each (_local17 in _local16) {
schemaManager.reset();
_local18 = _local17.@name.toString();
_local13 = _local10.getFault(_local18);
if (_local13 != null){
_local11 = _local17.@message.toString();
_local12 = schemaManager.getQNameForPrefixedName(_local11, _local17);
parseMessage(_local13, _local12, _local9, WSDLConstants.MODE_FAULT);
};
};
if (_local10.style == SOAPConstants.DOC_STYLE){
parseDocumentOperation(_local10);
};
};
};
} else {
if (importsManager != null){
_local19 = importsManager.getResources();
for each (_local20 in _local19) {
_local4 = _local20.parsePortType(_arg1, _arg2);
if (_local4){
break;
};
};
};
};
return (_local4);
}
public function getPort(_arg1:String=null, _arg2:String=null):WSDLPort{
var _local3:WSDLPort;
var _local5:String;
var _local4:WSDLService = getService(_arg1, _arg2);
if (_local4 != null){
if (_arg2 == null){
_local3 = _local4.defaultPort;
} else {
_local3 = _local4.getPort(_arg2);
};
};
if (_local3 == null){
_local5 = resourceManager.getString("rpc", "noServiceAndPort", [_arg1, _arg2]);
throw (new Fault("Client.NoSuchPort", _local5));
};
return (_local3);
}
private function parseEncodingExtension(_arg1:XML, _arg2:Boolean=false, _arg3:Boolean=false):WSDLEncoding{
var _local5:String;
var _local4:WSDLEncoding = new WSDLEncoding();
_local4.useStyle = _arg1.@["use"].toString();
_local4.namespaceURI = _arg1.@["namespace"].toString();
_local4.encodingStyle = _arg1.@["encodingStyle"].toString();
if (_arg2){
_local5 = _arg1.@["message"].toString();
_local4.message = schemaManager.getQNameForPrefixedName(_local5, _arg1);
_local4.setParts(_arg1.@["part"].toString());
} else {
if (!_arg3){
_local4.setParts(_arg1.@["parts"].toString());
};
};
return (_local4);
}
public function getService(_arg1:String=null, _arg2:String=null):WSDLService{
var _local3:WSDLService;
var _local4:WSDLPort;
var _local5:WSDLService;
var _local6:WSDLPort;
var _local7:String;
var _local8:String;
if (((!((serviceMap == null))) && (!((_arg1 == null))))){
_local3 = serviceMap[_arg1];
if (_local3 != null){
if (_arg2 != null){
_local4 = _local3.getPort(_arg2);
};
if (_local4 == null){
_local5 = parseService(_arg1, _arg2);
for each (_local6 in _local5.ports) {
_local3.addPort(_local6);
};
};
};
};
if (_local3 == null){
_local3 = parseService(_arg1, _arg2);
if (_local3 != null){
if (serviceMap == null){
serviceMap = {};
};
serviceMap[_local3.name] = _local3;
} else {
if (_arg1 != null){
_local7 = resourceManager.getString("rpc", "noSuchServiceInWSDL", [_arg1]);
throw (new Fault("Client.NoSuchService", _local7));
};
_local7 = resourceManager.getString("rpc", "noServiceElement");
_local8 = resourceManager.getString("rpc", "noServiceElement.details", [""]);
throw (new Fault("Server.NoServicesInWSDL", _local7, _local8));
};
};
return (_local3);
}
}
}//package mx.rpc.wsdl
Section 154
//WSDLBinding (mx.rpc.wsdl.WSDLBinding)
package mx.rpc.wsdl {
import mx.rpc.soap.*;
public class WSDLBinding {
private var _name:String;
private var _transport:String;
private var _style:String;
private var _portType:WSDLPortType;
public function WSDLBinding(_arg1:String){
_name = _arg1;
}
public function set style(_arg1:String):void{
_style = _arg1;
}
public function get transport():String{
if (_transport == null){
_transport = WSDLConstants.SOAP_HTTP_URI;
};
return (_transport);
}
public function get name():String{
return (_name);
}
public function toString():String{
return (((((("WSDLBinding name=" + _name) + ", style=") + _style) + ", transport=") + _transport));
}
public function get style():String{
if (_style == null){
_style = SOAPConstants.DEFAULT_OPERATION_STYLE;
};
return (_style);
}
public function set transport(_arg1:String):void{
_transport = _arg1;
}
public function set portType(_arg1:WSDLPortType):void{
_portType = _arg1;
}
public function get portType():WSDLPortType{
return (_portType);
}
}
}//package mx.rpc.wsdl
Section 155
//WSDLConstants (mx.rpc.wsdl.WSDLConstants)
package mx.rpc.wsdl {
import mx.utils.*;
public class WSDLConstants {
public var portTypeQName:QName;
public var soapFaultQName:QName;
public var documentationQName:QName;
public var soapHeaderQName:QName;
public var bindingQName:QName;
public var faultQName:QName;
public var portQName:QName;
public var outputQName:QName;
public var typesQName:QName;
public var wsdlArrayTypeQName:QName;
private var _soapNS:Namespace;
public var soapHeaderFaultQName:QName;
public var soapAddressQName:QName;
public var soapBindingQName:QName;
private var _wsdlNS:Namespace;
public var soapBodyQName:QName;
public var messageQName:QName;
public var soapOperationQName:QName;
public var serviceQName:QName;
public var partQName:QName;
public var inputQName:QName;
public var operationQName:QName;
public var importQName:QName;
public var definitionsQName:QName;
public static const MODE_IN:int = 0;
public static const SOAP_HTTP_URI:String = "http://schemas.xmlsoap.org/soap/http/";
public static const DEFAULT_WSDL_VERSION:String = "1.1";
public static const DEFAULT_STYLE:String = "document";
public static const WSDL_PREFIX:String = "wsdl";
public static const WSDL_HTTP_URI:String = "http://schemas.xmlsoap.org/wsdl/http/";
public static const MODE_OUT:int = 1;
public static const WSDL_SOAP_URI:String = "http://schemas.xmlsoap.org/wsdl/soap/";
public static const WSDL20_SOAP_URI:String = "http://www.w3.org/2006/01/wsdl/soap";
public static const MODE_HEADER:int = 3;
public static const MODE_FAULT:int = 2;
public static const WSDL20_URI:String = "http://www.w3.org/2006/01/wsdl";
public static const WSDL_URI:String = "http://schemas.xmlsoap.org/wsdl/";
public static const WSDL_SOAP_PREFIX:String = "wsoap";
public static const WSDL_SOAP12_URI:String = "http://schemas.xmlsoap.org/wsdl/soap12/";
public static const WSDL20_SOAP12_URI:String = "http://www.w3.org/2006/01/wsdl/soap";
public static const WSDL20_HTTP_URI:String = "http://www.w3.org/2006/01/wsdl/http";
private static var constantsCache:Object;
public function WSDLConstants(_arg1:Namespace=null, _arg2:Namespace=null){
if (_arg1 == null){
_arg1 = new Namespace(WSDL_PREFIX, WSDL_URI);
};
if (_arg2 == null){
_arg2 = new Namespace(WSDL_SOAP_PREFIX, WSDL_SOAP_URI);
};
_wsdlNS = _arg1;
_soapNS = _arg2;
definitionsQName = new QName(wsdlURI, "definitions");
importQName = new QName(wsdlURI, "import");
typesQName = new QName(wsdlURI, "types");
messageQName = new QName(wsdlURI, "message");
portTypeQName = new QName(wsdlURI, "portType");
bindingQName = new QName(wsdlURI, "binding");
serviceQName = new QName(wsdlURI, "service");
documentationQName = new QName(wsdlURI, "documentation");
portQName = new QName(wsdlURI, "port");
operationQName = new QName(wsdlURI, "operation");
inputQName = new QName(wsdlURI, "input");
outputQName = new QName(wsdlURI, "output");
partQName = new QName(wsdlURI, "part");
faultQName = new QName(wsdlURI, "fault");
wsdlArrayTypeQName = new QName(wsdlURI, "arrayType");
soapAddressQName = new QName(soapURI, "address");
soapBindingQName = new QName(soapURI, "binding");
soapOperationQName = new QName(soapURI, "operation");
soapBodyQName = new QName(soapURI, "body");
soapFaultQName = new QName(soapURI, "fault");
soapHeaderQName = new QName(soapURI, "header");
soapHeaderFaultQName = new QName(soapURI, "headerfault");
}
public function get soapNamespace():Namespace{
return (_soapNS);
}
public function get wsdlNamespace():Namespace{
return (_wsdlNS);
}
public function get soapURI():String{
return (soapNamespace.uri);
}
public function get wsdlURI():String{
return (wsdlNamespace.uri);
}
public static function getConstants(_arg1:XML):WSDLConstants{
var _local2:Namespace;
var _local3:Namespace;
var _local5:Array;
var _local6:Namespace;
if (_arg1 != null){
_local5 = _arg1.inScopeNamespaces();
for each (_local6 in _local5) {
if (URLUtil.urisEqual(_local6.uri, WSDL_URI)){
_local2 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, WSDL20_URI)){
_local2 = _local6;
};
};
if (URLUtil.urisEqual(_local6.uri, WSDL_SOAP_URI)){
_local3 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, WSDL20_SOAP_URI)){
_local3 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, WSDL20_SOAP12_URI)){
_local3 = _local6;
};
};
};
};
};
if (_local2 == null){
_local2 = new Namespace(WSDL_PREFIX, WSDL_URI);
};
if (_local3 == null){
_local3 = new Namespace(WSDL_SOAP_PREFIX, WSDL_SOAP_URI);
};
if (constantsCache == null){
constantsCache = {};
};
var _local4:WSDLConstants = constantsCache[_local2.uri];
if (_local4 == null){
_local4 = new WSDLConstants(_local2, _local3);
constantsCache[_local2.uri] = _local4;
};
return (_local4);
}
}
}//package mx.rpc.wsdl
Section 156
//WSDLEncoding (mx.rpc.wsdl.WSDLEncoding)
package mx.rpc.wsdl {
import mx.rpc.soap.*;
public class WSDLEncoding {
private var _parts:Array;
private var _message:QName;
private var _soapConstants:SOAPConstants;
private var _namespaceURI:String;
private var _useStyle:String;// = "literal"
private var _encodingStyle:String;// = "http://schemas.xmlsoap.org/soap/encoding/"
public function get parts():Array{
return (_parts);
}
public function set namespaceURI(_arg1:String):void{
_namespaceURI = _arg1;
}
public function get soapConstants():SOAPConstants{
if (_soapConstants == null){
_soapConstants = SOAPConstants.getConstants(null);
};
return (_soapConstants);
}
public function setParts(_arg1:String):void{
var _local2:Array;
var _local3:String;
if (((!((_arg1 == null))) && ((_arg1.length > 0)))){
_parts = [];
_local2 = _arg1.split(" ");
for each (_local3 in _local2) {
if (_local3.length > 0){
_parts.push(_local3);
};
};
} else {
_parts = null;
};
}
public function get message():QName{
return (_message);
}
public function get useStyle():String{
return (_useStyle);
}
public function hasPart(_arg1:String):Boolean{
var _local2:String;
if (((!((_parts == null))) && ((_parts.length > 0)))){
for each (_local2 in _parts) {
if (_local2 == _arg1){
return (true);
};
};
return (false);
};
return (true);
}
public function set message(_arg1:QName):void{
_message = _arg1;
}
public function get namespaceURI():String{
return (_namespaceURI);
}
public function set useStyle(_arg1:String):void{
_useStyle = _arg1;
}
public function set encodingStyle(_arg1:String):void{
_encodingStyle = (_arg1) ? _arg1 : soapConstants.encodingURI;
}
public function get encodingStyle():String{
if (_encodingStyle == null){
_encodingStyle = soapConstants.encodingURI;
};
return (_encodingStyle);
}
}
}//package mx.rpc.wsdl
Section 157
//WSDLMessage (mx.rpc.wsdl.WSDLMessage)
package mx.rpc.wsdl {
public class WSDLMessage {
public var parts:Array;
private var _headerFaultsMap:Object;
private var _partsMap:Object;
public var name:String;
public var encoding:WSDLEncoding;
public var wrappedQName:QName;
public var isWrapped:Boolean;
private var _headersMap:Object;
public function WSDLMessage(_arg1:String=null){
this.name = _arg1;
}
public function getHeader(_arg1:String):WSDLMessage{
var _local2:WSDLMessage;
if (_headersMap != null){
_local2 = _headersMap[_arg1];
};
return (_local2);
}
public function getPart(_arg1:String):WSDLMessagePart{
var _local2:WSDLMessagePart;
if (_partsMap != null){
_local2 = _partsMap[_arg1];
};
return (_local2);
}
public function addHeaderFault(_arg1:WSDLMessage):void{
if (_headerFaultsMap == null){
_headerFaultsMap = {};
};
_headerFaultsMap[_arg1.name] = _arg1;
}
public function addPart(_arg1:WSDLMessagePart):void{
if (_partsMap == null){
_partsMap = {};
};
if (parts == null){
parts = [];
};
_partsMap[_arg1.name.localName] = _arg1;
parts.push(_arg1);
}
public function addHeader(_arg1:WSDLMessage):void{
if (_headersMap == null){
_headersMap = {};
};
_headersMap[_arg1.name] = _arg1;
}
public function getHeaderFault(_arg1:String):WSDLMessage{
var _local2:WSDLMessage;
if (_headerFaultsMap != null){
_local2 = _headerFaultsMap[_arg1];
};
return (_local2);
}
}
}//package mx.rpc.wsdl
Section 158
//WSDLMessagePart (mx.rpc.wsdl.WSDLMessagePart)
package mx.rpc.wsdl {
public class WSDLMessagePart {
public var optional:Boolean;
private var _name:QName;
public var definition:XML;
public var type:QName;
public var element:QName;
public function WSDLMessagePart(_arg1:QName, _arg2:QName=null, _arg3:QName=null){
_name = _arg1;
this.type = _arg3;
this.element = _arg2;
}
public function get name():QName{
return (_name);
}
}
}//package mx.rpc.wsdl
Section 159
//WSDLOperation (mx.rpc.wsdl.WSDLOperation)
package mx.rpc.wsdl {
import mx.rpc.soap.*;
import mx.rpc.xml.*;
public class WSDLOperation {
private var _soapAction:String;
private var _soapConstants:SOAPConstants;
public var outputMessage:WSDLMessage;
private var _faultsMap:Object;
private var _schemaManager:SchemaManager;
public var inputMessage:WSDLMessage;
private var _wsdlConstants:WSDLConstants;
private var _name:String;
public var style:String;
public var namespaces:Object;
public function WSDLOperation(_arg1:String){
_name = _arg1;
}
public function addFault(_arg1:WSDLMessage):void{
if (_faultsMap == null){
_faultsMap = {};
};
_faultsMap[_arg1.name] = _arg1;
}
public function set soapAction(_arg1:String):void{
_soapAction = _arg1;
}
public function get soapConstants():SOAPConstants{
if (_soapConstants == null){
_soapConstants = SOAPConstants.getConstants(null);
};
return (_soapConstants);
}
public function set soapConstants(_arg1:SOAPConstants):void{
_soapConstants = _arg1;
}
public function get name():String{
return (_name);
}
public function get wsdlConstants():WSDLConstants{
if (_wsdlConstants == null){
_wsdlConstants = WSDLConstants.getConstants(null);
};
return (_wsdlConstants);
}
public function get schemaManager():SchemaManager{
return (_schemaManager);
}
public function set wsdlConstants(_arg1:WSDLConstants):void{
_wsdlConstants = _arg1;
}
public function set schemaManager(_arg1:SchemaManager):void{
_schemaManager = _arg1;
}
public function get soapAction():String{
if (_soapAction == null){
_soapAction = "";
};
return (_soapAction);
}
public function getFault(_arg1:String):WSDLMessage{
var _local2:WSDLMessage;
if (_faultsMap != null){
_local2 = _faultsMap[_arg1];
};
return (_local2);
}
}
}//package mx.rpc.wsdl
Section 160
//WSDLPort (mx.rpc.wsdl.WSDLPort)
package mx.rpc.wsdl {
public class WSDLPort {
private var _binding:WSDLBinding;
private var _name:String;
private var _service:WSDLService;
private var _endpointURI:String;
public function WSDLPort(_arg1:String, _arg2:WSDLService){
_name = _arg1;
_service = _arg2;
}
public function get binding():WSDLBinding{
return (_binding);
}
public function set binding(_arg1:WSDLBinding):void{
_binding = _arg1;
}
public function get name():String{
return (_name);
}
public function toString():String{
return (((((("WSDLPort name=" + _name) + ", endpointURI=") + _endpointURI) + ", binding=") + _binding));
}
public function set endpointURI(_arg1:String):void{
_endpointURI = _arg1;
}
public function get service():WSDLService{
return (_service);
}
public function get endpointURI():String{
return (_endpointURI);
}
}
}//package mx.rpc.wsdl
Section 161
//WSDLPortType (mx.rpc.wsdl.WSDLPortType)
package mx.rpc.wsdl {
public class WSDLPortType {
private var _operations:Object;
private var _name:String;
public function WSDLPortType(_arg1:String){
_name = _arg1;
_operations = {};
}
public function getOperation(_arg1:String):WSDLOperation{
return (_operations[_arg1]);
}
public function addOperation(_arg1:WSDLOperation):void{
_operations[_arg1.name] = _arg1;
}
public function get name():String{
return (_name);
}
public function operations():Object{
return (_operations);
}
}
}//package mx.rpc.wsdl
Section 162
//WSDLService (mx.rpc.wsdl.WSDLService)
package mx.rpc.wsdl {
public class WSDLService {
private var _ports:Object;
private var _defaultPort:WSDLPort;
private var _name:String;
public function WSDLService(_arg1:String){
_name = _arg1;
_ports = {};
}
public function addPort(_arg1:WSDLPort):void{
_ports[_arg1.name] = _arg1;
if (_defaultPort == null){
_defaultPort = _arg1;
};
}
public function get ports():Object{
return (_ports);
}
public function getPort(_arg1:String):WSDLPort{
return (_ports[_arg1]);
}
public function get defaultPort():WSDLPort{
return (_defaultPort);
}
public function get name():String{
return (_name);
}
}
}//package mx.rpc.wsdl
Section 163
//ContentProxy (mx.rpc.xml.ContentProxy)
package mx.rpc.xml {
import flash.utils.*;
import mx.utils.*;
public dynamic class ContentProxy extends Proxy {
private var _isSimple:Boolean;// = true
private var _content;
private var _propertyList:Array;
private var _makeObjectsBindable:Boolean;
public function ContentProxy(_arg1=undefined, _arg2:Boolean=false, _arg3:Boolean=true){
object_proxy::content = _arg1;
object_proxy::makeObjectsBindable = _arg2;
object_proxy::isSimple = _arg3;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
var _local2:Boolean;
var _local3:Object;
if (((!(_isSimple)) && (!((_content == null))))){
_local3 = _content[_arg1];
_local2 = delete _content[_arg1];
};
return (_local2);
}
object_proxy function set makeObjectsBindable(_arg1:Boolean):void{
_makeObjectsBindable = _arg1;
if (((((_arg1) && (!(_isSimple)))) && (!((_content is ObjectProxy))))){
_content = new ObjectProxy(_content);
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
if (((!(_isSimple)) && (!((_content == null))))){
return (_content[_propertyList[(_arg1 - 1)]]);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_content != null){
return (_content[_arg1]);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
var _local2:Boolean;
if (_content != null){
_local2 = (_arg1 in _content);
};
return (_local2);
}
object_proxy function setupPropertyList():void{
var _local1:String;
if (getQualifiedClassName(_content) == "Object"){
_propertyList = [];
for (_local1 in _content) {
_propertyList.push(_local1);
};
} else {
_propertyList = ObjectUtil.getClassInfo(_content, null, {includeReadOnly:false, uris:["*"]}).properties;
};
}
object_proxy function set content(_arg1):void{
if ((_arg1 is ContentProxy)){
_arg1 = ContentProxy(_arg1).object_proxy::content;
};
_content = _arg1;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
if (_arg1 == 0){
object_proxy::setupPropertyList();
};
if (_arg1 < _propertyList.length){
return ((_arg1 + 1));
};
return (0);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:*;
if (_isSimple){
_local3 = _content;
if (_local3 !== _arg2){
_content = _arg2;
};
} else {
if (_content == null){
_content = object_proxy::createObject();
};
_local3 = _content[_arg1];
if (_local3 !== _arg2){
_content[_arg1] = _arg2;
};
};
}
object_proxy function set isSimple(_arg1:Boolean):void{
_isSimple = _arg1;
}
object_proxy function get content(){
return (_content);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
if (_content != null){
return (_content[_arg1].apply(_content, _args));
};
return (undefined);
}
object_proxy function createObject(){
if (object_proxy::makeObjectsBindable){
return (new ObjectProxy());
};
return ({});
}
object_proxy function get isSimple():Boolean{
return (_isSimple);
}
object_proxy function get makeObjectsBindable():Boolean{
return (_makeObjectsBindable);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_propertyList[(_arg1 - 1)]);
}
}
}//package mx.rpc.xml
Section 164
//DecodingContext (mx.rpc.xml.DecodingContext)
package mx.rpc.xml {
public class DecodingContext {
public var index:int;// = 0
public var anyIndex:int;// = -1
public var hasContextSiblings:Boolean;// = false
}
}//package mx.rpc.xml
Section 165
//IXMLDecoder (mx.rpc.xml.IXMLDecoder)
package mx.rpc.xml {
public interface IXMLDecoder {
function decode(_arg1, _arg2:QName=null, _arg3:QName=null, _arg4:XML=null);
function set recordXSIType(_arg1:Boolean):void;
function get recordXSIType():Boolean;
function get typeRegistry():SchemaTypeRegistry;
function set makeObjectsBindable(_arg1:Boolean):void;
function get makeObjectsBindable():Boolean;
function set typeRegistry(_arg1:SchemaTypeRegistry):void;
function reset():void;
}
}//package mx.rpc.xml
Section 166
//IXMLEncoder (mx.rpc.xml.IXMLEncoder)
package mx.rpc.xml {
public interface IXMLEncoder {
function get xmlSpecialCharsFilter():Function;
function set xmlSpecialCharsFilter(_arg1:Function):void;
function encode(_arg1, _arg2:QName=null, _arg3:QName=null, _arg4:XML=null):XMLList;
function reset():void;
}
}//package mx.rpc.xml
Section 167
//IXMLSchemaInstance (mx.rpc.xml.IXMLSchemaInstance)
package mx.rpc.xml {
public interface IXMLSchemaInstance {
function get xsiType():QName;
function set xsiType(_arg1:QName):void;
}
}//package mx.rpc.xml
Section 168
//QualifiedResourceManager (mx.rpc.xml.QualifiedResourceManager)
package mx.rpc.xml {
public class QualifiedResourceManager {
protected var resources:Array;
protected var resourcesMap:Object;
public function getResourcesForNamespace(_arg1:Namespace):Array{
return (getResourcesForURI(_arg1.uri));
}
public function getResourcesForURI(_arg1:String):Array{
if (resourcesMap == null){
return (null);
};
if (_arg1 == null){
_arg1 = "";
};
var _local2:Array = resourcesMap[_arg1];
return (_local2);
}
public function addResource(_arg1:Namespace, _arg2:Object):void{
if (resources == null){
resources = [];
};
resources.push(_arg2);
if (resourcesMap == null){
resourcesMap = {};
};
var _local3:String = _arg1.uri;
if (_local3 == null){
_local3 = "";
};
var _local4:Array = (resourcesMap[_local3] as Array);
if (_local4 == null){
_local4 = [];
};
_local4.push(_arg2);
resourcesMap[_local3] = _local4;
}
public function getResources():Array{
return (resources);
}
}
}//package mx.rpc.xml
Section 169
//Schema (mx.rpc.xml.Schema)
package mx.rpc.xml {
public class Schema {
public var elementFormDefault:String;// = "unqualified"
private var _targetNamespace:Namespace;
private var _schemaDatatypes:SchemaDatatypes;
private var _xml:XML;
private var _namespaces:Object;
private var importsManager:QualifiedResourceManager;
public var attributeFormDefault:String;// = "unqualified"
public var finalDefault:String;
private var _schemaConstants:SchemaConstants;
public var blockDefault:String;
public function Schema(_arg1:XML=null){
this.xml = _arg1;
}
public function set xml(_arg1:XML):void{
var _local2:String;
var _local3:Array;
var _local4:Namespace;
_xml = _arg1;
if (_xml != null){
_local2 = _xml.@targetNamespace.toString();
_targetNamespace = new Namespace(_local2);
attributeFormDefault = _xml.@attributeFormDefault.toString();
if (attributeFormDefault == ""){
attributeFormDefault = "unqualified";
};
blockDefault = _xml.@blockDefault.toString();
elementFormDefault = _xml.@elementFormDefault.toString();
if (elementFormDefault == ""){
elementFormDefault = "unqualified";
};
finalDefault = _xml.@finalDefault.toString();
namespaces = {};
_local3 = _xml.inScopeNamespaces();
for each (_local4 in _local3) {
namespaces[_local4.prefix] = _local4;
};
_schemaConstants = SchemaConstants.getConstants(_xml);
_schemaDatatypes = SchemaDatatypes.getConstants(_schemaConstants.xsdURI);
} else {
_schemaConstants = null;
_schemaDatatypes = null;
};
}
public function addInclude(_arg1:XMLList):void{
xml.appendChild(_arg1);
}
public function get targetNamespace():Namespace{
return (_targetNamespace);
}
public function set targetNamespace(_arg1:Namespace):void{
_targetNamespace = _arg1;
}
public function get xml():XML{
return (_xml);
}
public function addImport(_arg1:Namespace, _arg2:Schema):void{
if (importsManager == null){
importsManager = new QualifiedResourceManager();
};
importsManager.addResource(_arg1, _arg2);
}
public function get schemaConstants():SchemaConstants{
if (_schemaConstants == null){
_schemaConstants = SchemaConstants.getConstants(_xml);
};
return (_schemaConstants);
}
public function set namespaces(_arg1:Object):void{
_namespaces = _arg1;
}
public function getNamedDefinition(_arg1:QName, ... _args):Object{
var imports:Array;
var schema:Schema;
var currentTargetNamespace:Namespace;
var schemaXML:XML;
var constants:SchemaConstants;
var t:uint;
var componentType:QName;
var localComponentType:QName;
var definition:XML;
var name = _arg1;
var componentTypes = _args;
var uri:String = name.uri;
var schemas:Array = [this];
if (importsManager != null){
imports = importsManager.getResourcesForURI(uri);
if (imports != null){
schemas = schemas.concat(imports);
};
};
var s:uint;
while (s < schemas.length) {
schema = (schemas[s] as Schema);
currentTargetNamespace = schema.targetNamespace;
schemaXML = schema.xml;
constants = schema.schemaConstants;
t = 0;
while (t < componentTypes.length) {
componentType = (componentTypes[t] as QName);
if ((((schema.elementFormDefault == "qualified")) && ((componentType == schemaConstants.elementTypeQName)))){
//unresolved if
//unresolved if
} else {
if ((((schema.attributeFormDefault == "qualified")) && ((componentType == schemaConstants.attributeQName)))){
//unresolved if
//unresolved if
} else {
if (((((!((componentType == schemaConstants.elementTypeQName))) && (!((componentType == schemaConstants.attributeQName))))) && (!((currentTargetNamespace.uri == name.uri))))){
} else {
localComponentType = new QName(constants.xsdURI, componentType.localName);
definition = schemaXML[localComponentType].(@name == name.localName)[0];
if (definition != null){
return ({definition:definition, schema:schema});
};
};
};
};
t = (t + 1);
};
s = (s + 1);
};
return (null);
}
public function get namespaces():Object{
if (_namespaces == null){
_namespaces = {};
};
return (_namespaces);
}
public function get schemaDatatypes():SchemaDatatypes{
if (_schemaDatatypes == null){
_schemaDatatypes = SchemaDatatypes.getConstants(schemaConstants.xsdURI);
};
return (_schemaDatatypes);
}
}
}//package mx.rpc.xml
Section 170
//SchemaConstants (mx.rpc.xml.SchemaConstants)
package mx.rpc.xml {
import mx.utils.*;
public class SchemaConstants {
public var documentationQName:QName;
public var minInclusiveQName:QName;
public var enumerationTypeQName:QName;
public var keyQName:QName;
public var appinfoQName:QName;
public var anyQName:QName;
public var typeAttrQName:QName;
public var choiceQName:QName;
public var maxInclusiveQName:QName;
public var redefineQName:QName;
public var anyTypeQName:QName;
public var attributeGroupQName:QName;
private var _xsiNS:Namespace;
public var extensionQName:QName;
public var listQName:QName;
public var selectorQName:QName;
public var patternQName:QName;
public var minLengthQName:QName;
public var keyrefQName:QName;
public var restrictionQName:QName;
public var annotationQName:QName;
public var nilQName:QName;
public var complexTypeQName:QName;
public var fieldQName:QName;
public var unionQName:QName;
public var uniqueQName:QName;
public var schemaQName:QName;
public var nameQName:QName;
public var maxLengthQName:QName;
public var includeQName:QName;
public var lengthQName:QName;
public var sequenceQName:QName;
public var groupQName:QName;
private var _xsdNS:Namespace;
public var attributeQName:QName;
public var elementTypeQName:QName;
public var anyAttributeQName:QName;
public var simpleTypeQName:QName;
public var complexContentQName:QName;
public var importQName:QName;
public var allQName:QName;
public var simpleContentQName:QName;
public static const MODE_ELEMENT:int = 1;
public static const XSI_URI_2000:String = "http://www.w3.org/2000/10/XMLSchema-instance";
public static const XSI_URI_2001:String = "http://www.w3.org/2001/XMLSchema-instance";
public static const XSI_URI_1999:String = "http://www.w3.org/1999/XMLSchema-instance";
public static const MODE_TYPE:int = 0;
public static const XSD_URI_2000:String = "http://www.w3.org/2000/10/XMLSchema";
public static const XSD_URI_2001:String = "http://www.w3.org/2001/XMLSchema";
public static const XML_SCHEMA_INSTANCE_PREFIX:String = "xsi";
public static const XML_SCHEMA_PREFIX:String = "xsd";
public static const XSD_URI_1999:String = "http://www.w3.org/1999/XMLSchema";
public static const XML_SCHEMA_URI:String = "http://www.w3.org/2001/XMLSchema";
public static const XML_SCHEMA_INSTANCE_URI:String = "http://www.w3.org/2001/XMLSchema-instance";
private static var constantsCache:Object;
public function SchemaConstants(_arg1:Namespace=null, _arg2:Namespace=null){
if (_arg1 == null){
_arg1 = new Namespace(XML_SCHEMA_PREFIX, XSD_URI_2001);
};
if (_arg2 == null){
_arg2 = new Namespace(XML_SCHEMA_INSTANCE_PREFIX, XSI_URI_2001);
};
_xsdNS = _arg1;
_xsiNS = _arg2;
allQName = new QName(xsdURI, "all");
annotationQName = new QName(xsdURI, "annotation");
anyQName = new QName(xsdURI, "any");
anyTypeQName = new QName(xsdURI, "anyType");
anyAttributeQName = new QName(xsdURI, "anyAttribute");
appinfoQName = new QName(xsdURI, "appinfo");
attributeQName = new QName(xsdURI, "attribute");
attributeGroupQName = new QName(xsdURI, "attributeGroup");
choiceQName = new QName(xsdURI, "choice");
complexContentQName = new QName(xsdURI, "complexContent");
complexTypeQName = new QName(xsdURI, "complexType");
documentationQName = new QName(xsdURI, "documentation");
elementTypeQName = new QName(xsdURI, "element");
enumerationTypeQName = new QName(xsdURI, "enumeration");
extensionQName = new QName(xsdURI, "extension");
fieldQName = new QName(xsdURI, "field");
groupQName = new QName(xsdURI, "group");
importQName = new QName(xsdURI, "import");
includeQName = new QName(xsdURI, "include");
keyQName = new QName(xsdURI, "key");
keyrefQName = new QName(xsdURI, "keyref");
lengthQName = new QName(xsdURI, "length");
listQName = new QName(xsdURI, "list");
maxInclusiveQName = new QName(xsdURI, "maxInclusive");
maxLengthQName = new QName(xsdURI, "maxLength");
minInclusiveQName = new QName(xsdURI, "minInclusive");
minLengthQName = new QName(xsdURI, "minLength");
nameQName = new QName(xsdURI, "name");
patternQName = new QName(xsdURI, "pattern");
redefineQName = new QName(xsdURI, "redefine");
restrictionQName = new QName(xsdURI, "restriction");
schemaQName = new QName(xsdURI, "schema");
selectorQName = new QName(xsdURI, "selector");
sequenceQName = new QName(xsdURI, "sequence");
simpleContentQName = new QName(xsdURI, "simpleContent");
simpleTypeQName = new QName(xsdURI, "simpleType");
unionQName = new QName(xsdURI, "union");
uniqueQName = new QName(xsdURI, "unique");
var _local3 = "nil";
if (xsdURI == SchemaConstants.XSD_URI_1999){
_local3 = "null";
};
nilQName = new QName(xsiURI, _local3);
typeAttrQName = new QName(xsiURI, "type");
}
public function get xsdNamespace():Namespace{
return (_xsdNS);
}
public function getXSDToken(_arg1:QName):String{
return (((xsdNamespace.prefix + ":") + _arg1.localName));
}
public function get xsiNamespace():Namespace{
return (_xsiNS);
}
public function get xsiURI():String{
return (xsiNamespace.uri);
}
public function getXSIToken(_arg1:QName):String{
return (((xsiNamespace.prefix + ":") + _arg1.localName));
}
public function get xsdURI():String{
return (xsdNamespace.uri);
}
public function getQName(_arg1:String):QName{
if (_arg1 == "type"){
return (typeAttrQName);
};
return (new QName(xsdURI, _arg1));
}
public static function getConstants(_arg1:XML=null):SchemaConstants{
var _local2:Namespace;
var _local3:Namespace;
var _local5:Array;
var _local6:Namespace;
if (_arg1 != null){
_local5 = _arg1.namespaceDeclarations();
for each (_local6 in _local5) {
if (URLUtil.urisEqual(_local6.uri, XSD_URI_1999)){
_local2 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, XSD_URI_2000)){
_local2 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, XSD_URI_2001)){
_local2 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, XSI_URI_1999)){
_local3 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, XSI_URI_2000)){
_local3 = _local6;
} else {
if (URLUtil.urisEqual(_local6.uri, XSI_URI_2001)){
_local3 = _local6;
};
};
};
};
};
};
};
};
if (_local2 == null){
_local2 = new Namespace(XML_SCHEMA_PREFIX, XSD_URI_2001);
};
if (_local3 == null){
_local3 = new Namespace(XML_SCHEMA_INSTANCE_PREFIX, XSI_URI_2001);
};
if (constantsCache == null){
constantsCache = {};
};
var _local4:SchemaConstants = constantsCache[_local2.uri];
if (_local4 == null){
_local4 = new SchemaConstants(_local2, _local3);
constantsCache[_local2.uri] = _local4;
};
return (_local4);
}
}
}//package mx.rpc.xml
Section 171
//SchemaDatatypes (mx.rpc.xml.SchemaDatatypes)
package mx.rpc.xml {
public class SchemaDatatypes {
public var hexBinaryQName:QName;
public var unsignedIntQName:QName;
public var NMTOKENSQName:QName;
public var nonPositiveIntegerQName:QName;
public var integerQName:QName;
public var stringQName:QName;
public var anyAtomicTypeQName:QName;
public var unsignedLongQName:QName;
public var tokenQName:QName;
public var languageQName:QName;
public var IDQName:QName;
public var NMTOKENQName:QName;
public var nonNegativeIntegerQName:QName;
public var doubleQName:QName;
public var base64BinaryQName:QName;
public var booleanQName:QName;
public var unsignedShortQName:QName;
public var dayTimeDurationQName:QName;
public var gYearMonthQName:QName;
public var anySimpleTypeQName:QName;
public var durationQName:QName;
public var IDREF:QName;
public var byteQName:QName;
public var QNameQName:QName;
public var shortQName:QName;
public var dateQName:QName;
public var longQName:QName;
public var normalizedStringQName:QName;
public var positiveIntegerQName:QName;
public var anyURIQName:QName;
public var floatQName:QName;
public var NCNameQName:QName;
public var timeInstantQName:QName;
public var NameQName:QName;
public var gYearQName:QName;
public var NOTATIONQName:QName;
public var dateTimeQName:QName;
public var gMonthQName:QName;
public var decimalQName:QName;
public var timeQName:QName;
public var negativeIntegerQName:QName;
public var gMonthDayQName:QName;
public var IDREFS:QName;
public var ENTITY:QName;
public var yearMonthDurationQName:QName;
public var gDayQName:QName;
public var intQName:QName;
public var ENTITIES:QName;
public var precisionDecimal:QName;
public var anyTypeQName:QName;
public var unsignedByteQName:QName;
private static var constantsCache:Object;
public function SchemaDatatypes(_arg1:String=null){
if ((((_arg1 == null)) || ((_arg1 == "")))){
_arg1 = SchemaConstants.XSD_URI_2001;
};
anyTypeQName = new QName(_arg1, "anyType");
anySimpleTypeQName = new QName(_arg1, "anySimpleType");
anyAtomicTypeQName = new QName(_arg1, "anyAtomicType");
stringQName = new QName(_arg1, "string");
booleanQName = new QName(_arg1, "boolean");
decimalQName = new QName(_arg1, "decimal");
precisionDecimal = new QName(_arg1, "precisionDecimal");
floatQName = new QName(_arg1, "float");
doubleQName = new QName(_arg1, "double");
durationQName = new QName(_arg1, "duration");
dateTimeQName = new QName(_arg1, "dateTime");
timeQName = new QName(_arg1, "time");
dateQName = new QName(_arg1, "date");
gYearMonthQName = new QName(_arg1, "gYearMonth");
gYearQName = new QName(_arg1, "gYear");
gMonthDayQName = new QName(_arg1, "gMonthDay");
gDayQName = new QName(_arg1, "gDay");
gMonthQName = new QName(_arg1, "gMonth");
hexBinaryQName = new QName(_arg1, "hexBinary");
base64BinaryQName = new QName(_arg1, "base64Binary");
anyURIQName = new QName(_arg1, "anyURI");
QNameQName = new QName(_arg1, "QName");
NOTATIONQName = new QName(_arg1, "NOTATION");
normalizedStringQName = new QName(_arg1, "normalizedString");
tokenQName = new QName(_arg1, "token");
languageQName = new QName(_arg1, "language");
NMTOKENQName = new QName(_arg1, "NMTOKEN");
NMTOKENSQName = new QName(_arg1, "NMTOKENS");
NameQName = new QName(_arg1, "Name");
NCNameQName = new QName(_arg1, "NCName");
IDQName = new QName(_arg1, "ID");
IDREF = new QName(_arg1, "IDREF");
IDREFS = new QName(_arg1, "IDREFS");
ENTITY = new QName(_arg1, "ENTITY");
ENTITIES = new QName(_arg1, "ENTITIES");
integerQName = new QName(_arg1, "integer");
nonPositiveIntegerQName = new QName(_arg1, "nonPositiveInteger");
negativeIntegerQName = new QName(_arg1, "negativeInteger");
longQName = new QName(_arg1, "long");
intQName = new QName(_arg1, "int");
shortQName = new QName(_arg1, "short");
byteQName = new QName(_arg1, "byte");
nonNegativeIntegerQName = new QName(_arg1, "nonNegativeInteger");
unsignedLongQName = new QName(_arg1, "unsignedLong");
unsignedIntQName = new QName(_arg1, "unsignedInt");
unsignedShortQName = new QName(_arg1, "unsignedShort");
unsignedByteQName = new QName(_arg1, "unsignedByte");
positiveIntegerQName = new QName(_arg1, "positiveInteger");
yearMonthDurationQName = new QName(_arg1, "yearMonthDuration");
dayTimeDurationQName = new QName(_arg1, "dayTimeDuration");
if (_arg1 == SchemaConstants.XSD_URI_1999){
timeInstantQName = new QName(_arg1, "timeInstant");
};
}
public static function getConstants(_arg1:String=null):SchemaDatatypes{
if (constantsCache == null){
constantsCache = {};
};
if ((((_arg1 == null)) || ((_arg1 == "")))){
_arg1 = SchemaConstants.XSD_URI_2001;
};
var _local2:SchemaDatatypes = constantsCache[_arg1];
if (_local2 == null){
_local2 = new SchemaDatatypes(_arg1);
constantsCache[_arg1] = _local2;
};
return (_local2);
}
}
}//package mx.rpc.xml
Section 172
//SchemaManager (mx.rpc.xml.SchemaManager)
package mx.rpc.xml {
public class SchemaManager extends QualifiedResourceManager {
private var _namespaces:Object;
private var _schemaMarshaller:SchemaMarshaller;
private var _schemaConstants:SchemaConstants;
private var namespaceCount:uint;// = 0
private var schemaStack:Array;
private var initialScope;
private var _schemaDatatypes:SchemaDatatypes;
public function SchemaManager(){
initialScope = [];
schemaStack = [];
}
public function addNamespaces(_arg1:Object):void{
var _local2:String;
var _local3:Namespace;
for (_local2 in _arg1) {
_local3 = (_arg1[_local2] as Namespace);
namespaces[_local2] = _local3;
};
}
public function getNamedDefinition(_arg1:QName, ... _args):XML{
var _local5:Schema;
var _local6:Object;
var _local7:XML;
var _local3:Array = currentScope();
var _local4:int;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
_args.unshift(_arg1);
_local6 = _local5.getNamedDefinition.apply(_local5, _args);
if (_local6 != null){
_local7 = (_local6.definition as XML);
pushSchemaInScope(_local6.schema);
return (_local7);
};
_local4++;
};
return (null);
}
public function releaseScope(){
return (schemaStack.pop());
}
public function marshall(_arg1, _arg2:QName=null, _arg3:XML=null):String{
return (schemaMarshaller.marshall(_arg1, _arg2, _arg3));
}
public function reset():void{
namespaceCount = 0;
schemaStack = [];
schemaStack.push(initialScope);
}
public function pushSchemaInScope(_arg1:Schema):void{
var _local2:Array;
if (_arg1 != null){
_local2 = [_arg1];
_local2["current"] = _local2[0];
schemaStack.push(_local2);
};
}
public function pushNamespaceInScope(_arg1):Boolean{
var _local5:Schema;
var _local2:Namespace = new Namespace(_arg1);
var _local3:Array = currentScope();
var _local4:int;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
if (_local5.targetNamespace.uri == _local2.uri){
pushSchemaInScope(_local5);
return (true);
};
_local4++;
};
return (false);
}
public function getQNameForAttribute(_arg1:String, _arg2:String=null):QName{
var _local3:QName;
if ((((_arg2 == "qualified")) || ((((_arg2 == null)) && ((currentSchema.attributeFormDefault == "qualified")))))){
_local3 = new QName(currentSchema.targetNamespace.uri, _arg1);
} else {
_local3 = new QName("", _arg1);
};
return (_local3);
}
public function currentScope():Array{
var _local1:Array = schemaStack.pop();
if (_local1 != null){
schemaStack.push(_local1);
} else {
_local1 = [];
};
return (_local1);
}
public function set schemaConstants(_arg1:SchemaConstants):void{
_schemaConstants = _arg1;
}
public function addSchema(_arg1:Schema, _arg2:Boolean=true):void{
var _local3:Array;
addResource(_arg1.targetNamespace, _arg1);
if (_arg2 == true){
_local3 = schemaStack.pop();
};
if (_local3 == null){
_local3 = [];
};
_local3.push(_arg1);
if (!_local3.hasOwnProperty("current")){
_local3["current"] = _local3[0];
};
schemaStack.push(_local3);
if (schemaStack.length == 1){
initialScope = schemaStack[0];
};
}
public function getOrCreatePrefix(_arg1:String):String{
var _local2:String;
var _local3:Namespace;
var _local5:Namespace;
var _local7:Object;
for each (_local3 in namespaces) {
if (_local3.uri == _arg1){
return (_local3.prefix);
};
};
if (currentSchema != null){
_local7 = currentSchema.namespaces;
for each (_local3 in _local7) {
if (_local3.uri == _arg1){
return (_local3.prefix);
};
};
};
var _local4 = "ns";
var _local6:String = (_local4 + namespaceCount);
if (namespaces[_local6] != null){
namespaceCount++;
_local6 = (_local4 + namespaceCount);
_local5 = new Namespace(_local6, _arg1);
namespaces[_local6] = _local5;
return (_local6);
};
_local5 = new Namespace(_local6, _arg1);
namespaces[_local6] = _local5;
return (_local6);
}
public function unmarshall(_arg1, _arg2:QName=null, _arg3:XML=null){
return (schemaMarshaller.unmarshall(_arg1, _arg2, _arg3));
}
public function set namespaces(_arg1:Object):void{
_namespaces = _arg1;
}
public function get schemaDatatypes():SchemaDatatypes{
if (_schemaDatatypes == null){
_schemaDatatypes = SchemaDatatypes.getConstants(schemaConstants.xsdURI);
};
return (_schemaDatatypes);
}
public function get namespaces():Object{
if (_namespaces == null){
_namespaces = {};
};
return (_namespaces);
}
public function getQNameForElement(_arg1:String, _arg2:String=null):QName{
var _local3:QName;
if ((((_arg2 == "qualified")) || ((((((_arg2 == null)) || ((_arg2 == "")))) && ((currentSchema.elementFormDefault == "qualified")))))){
_local3 = new QName(currentSchema.targetNamespace.uri, _arg1);
} else {
_local3 = new QName("", _arg1);
};
return (_local3);
}
public function get currentSchema():Schema{
var _local1:Schema;
var _local2:Array = currentScope();
if (_local2.hasOwnProperty("current")){
_local1 = _local2["current"];
};
return (_local1);
}
public function get schemaMarshaller():SchemaMarshaller{
if (_schemaMarshaller == null){
_schemaMarshaller = new SchemaMarshaller(schemaConstants, schemaDatatypes);
};
return (_schemaMarshaller);
}
public function get schemaConstants():SchemaConstants{
if (_schemaConstants == null){
_schemaConstants = SchemaConstants.getConstants();
};
return (_schemaConstants);
}
public function getQNameForPrefixedName(_arg1:String, _arg2:XML=null, _arg3:Boolean=false):QName{
var _local4:QName;
var _local5:String;
var _local6:String;
var _local8:Namespace;
var _local9:Array;
var _local10:Namespace;
var _local11:Namespace;
var _local7:int = _arg1.indexOf(":");
if (_local7 > 0){
_local5 = _arg1.substr(0, _local7);
_local6 = _arg1.substr((_local7 + 1));
} else {
_local6 = _arg1;
};
if ((((_local5 == null)) && ((_arg3 == true)))){
_local8 = currentSchema.targetNamespace;
};
if (_local5 == null){
_local5 = "";
};
if (_local8 == null){
if (_arg2 != null){
_local9 = _arg2.inScopeNamespaces();
for each (_local10 in _local9) {
if (_local10.prefix == _local5){
_local8 = _local10;
break;
};
};
};
};
if (_local8 == null){
_local8 = namespaces[_local5];
};
if (_local8 == null){
_local8 = currentSchema.namespaces[_local5];
};
if (_local8 == null){
_local11 = ((_arg2)!=null) ? _arg2.namespace() : null;
if (((!((_local11 == null))) && ((_local11.prefix == "")))){
_local8 = _local11;
} else {
_local8 = currentSchema.targetNamespace;
};
};
if (_local8 != null){
_local4 = new QName(_local8.uri, _local6);
} else {
_local4 = new QName("", _local6);
};
return (_local4);
}
}
}//package mx.rpc.xml
Section 173
//SchemaMarshaller (mx.rpc.xml.SchemaMarshaller)
package mx.rpc.xml {
import flash.utils.*;
import mx.utils.*;
public class SchemaMarshaller {
private var unmarshallers:Object;
private var constants:SchemaConstants;
private var datatypes:SchemaDatatypes;
private var marshallers:Object;
private var _validating:Boolean;
public static const FLOAT_MIN_VALUE:Number = Math.pow(2, -149);
public static const LONG_MIN_VALUE:Number = -9.22337203685478E18;
public static const BYTE_MIN_VALUE:Number = -128;
public static const LONG_MAX_VALUE:Number = 9.22337203685478E18;
public static const USHORT_MAX_VALUE:Number = 0xFFFF;
public static const FLOAT_MAX_VALUE:Number = ((Math.pow(2, 24) - 1) * Math.pow(2, 104));
public static const SHORT_MIN_VALUE:Number = -32768;
public static const ULONG_MAX_VALUE:Number = 1.84467440737096E19;
public static const BYTE_MAX_VALUE:Number = 127;
public static const SHORT_MAX_VALUE:Number = 32767;
public static const UBYTE_MAX_VALUE:Number = 0xFF;
public static var whitespaceTrimPattern:RegExp = new RegExp("^[ ]+|[ ]+$", "g");
public static var whitespaceReplacePattern:RegExp = new RegExp("[\t\r\n]", "g");
public static var byteArrayAsBase64Binary:Boolean = true;
public static var whitespaceCollapsePattern:RegExp = new RegExp("[ \t\r\n]+", "g");
public function SchemaMarshaller(_arg1:SchemaConstants, _arg2:SchemaDatatypes){
this.constants = _arg1;
this.datatypes = _arg2;
registerMarshallers();
}
public function unmarshallBoolean(_arg1, _arg2:QName=null, _arg3:XML=null):Boolean{
if (_arg1 == null){
return (false);
};
var _local4:String = whitespaceCollapse(_arg1).toLowerCase();
if ((((_local4 == "true")) || ((_local4 == "1")))){
return (true);
};
return (false);
}
public function marshallDuration(_arg1, _arg2:QName=null, _arg3:XML=null):String{
return (whitespaceCollapse(_arg1));
}
private function registerMarshallers():void{
marshallers = {};
marshallers[datatypes.booleanQName.localName] = marshallBoolean;
marshallers[datatypes.anyTypeQName.localName] = marshallAny;
marshallers[datatypes.anySimpleTypeQName.localName] = marshallAny;
marshallers[datatypes.anyAtomicTypeQName.localName] = marshallAny;
marshallers[datatypes.stringQName.localName] = marshallString;
marshallers[datatypes.booleanQName.localName] = marshallBoolean;
marshallers[datatypes.decimalQName.localName] = marshallDecimal;
marshallers[datatypes.precisionDecimal.localName] = marshallDecimal;
marshallers[datatypes.floatQName.localName] = marshallFloat;
marshallers[datatypes.doubleQName.localName] = marshallDouble;
marshallers[datatypes.durationQName.localName] = marshallDuration;
marshallers[datatypes.dateTimeQName.localName] = marshallDatetime;
marshallers[datatypes.timeQName.localName] = marshallDatetime;
marshallers[datatypes.dateQName.localName] = marshallDatetime;
marshallers[datatypes.gYearMonthQName.localName] = marshallGregorian;
marshallers[datatypes.gYearQName.localName] = marshallGregorian;
marshallers[datatypes.gMonthDayQName.localName] = marshallGregorian;
marshallers[datatypes.gDayQName.localName] = marshallGregorian;
marshallers[datatypes.gMonthQName.localName] = marshallGregorian;
marshallers[datatypes.hexBinaryQName.localName] = marshallHexBinary;
marshallers[datatypes.base64BinaryQName.localName] = marshallBase64Binary;
marshallers[datatypes.anyURIQName.localName] = marshallString;
marshallers[datatypes.QNameQName.localName] = marshallString;
marshallers[datatypes.NOTATIONQName.localName] = marshallString;
marshallers[datatypes.normalizedStringQName.localName] = marshallString;
marshallers[datatypes.tokenQName.localName] = marshallString;
marshallers[datatypes.languageQName.localName] = marshallString;
marshallers[datatypes.NMTOKENQName.localName] = marshallString;
marshallers[datatypes.NMTOKENSQName.localName] = marshallString;
marshallers[datatypes.NameQName.localName] = marshallString;
marshallers[datatypes.NCNameQName.localName] = marshallString;
marshallers[datatypes.IDQName.localName] = marshallString;
marshallers[datatypes.IDREF.localName] = marshallString;
marshallers[datatypes.IDREFS.localName] = marshallString;
marshallers[datatypes.ENTITY.localName] = marshallString;
marshallers[datatypes.ENTITIES.localName] = marshallString;
marshallers[datatypes.integerQName.localName] = marshallInteger;
marshallers[datatypes.nonPositiveIntegerQName.localName] = marshallInteger;
marshallers[datatypes.negativeIntegerQName.localName] = marshallInteger;
marshallers[datatypes.longQName.localName] = marshallInteger;
marshallers[datatypes.intQName.localName] = marshallInteger;
marshallers[datatypes.shortQName.localName] = marshallInteger;
marshallers[datatypes.byteQName.localName] = marshallInteger;
marshallers[datatypes.nonNegativeIntegerQName.localName] = marshallInteger;
marshallers[datatypes.unsignedLongQName.localName] = marshallInteger;
marshallers[datatypes.unsignedIntQName.localName] = marshallInteger;
marshallers[datatypes.unsignedShortQName.localName] = marshallInteger;
marshallers[datatypes.unsignedByteQName.localName] = marshallInteger;
marshallers[datatypes.positiveIntegerQName.localName] = marshallInteger;
marshallers[datatypes.yearMonthDurationQName.localName] = marshallDatetime;
marshallers[datatypes.dayTimeDurationQName.localName] = marshallDatetime;
if (datatypes.timeInstantQName != null){
marshallers[datatypes.timeInstantQName.localName] = marshallDatetime;
};
unmarshallers = {};
unmarshallers[datatypes.booleanQName.localName] = unmarshallBoolean;
unmarshallers[datatypes.anyTypeQName.localName] = unmarshallAny;
unmarshallers[datatypes.anySimpleTypeQName.localName] = unmarshallAny;
unmarshallers[datatypes.anyAtomicTypeQName.localName] = unmarshallAny;
unmarshallers[datatypes.stringQName.localName] = unmarshallString;
unmarshallers[datatypes.booleanQName.localName] = unmarshallBoolean;
unmarshallers[datatypes.decimalQName.localName] = unmarshallDecimal;
unmarshallers[datatypes.precisionDecimal.localName] = unmarshallDecimal;
unmarshallers[datatypes.floatQName.localName] = unmarshallFloat;
unmarshallers[datatypes.doubleQName.localName] = unmarshallDouble;
unmarshallers[datatypes.durationQName.localName] = unmarshallDuration;
unmarshallers[datatypes.dateTimeQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.timeQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.dateQName.localName] = unmarshallDate;
unmarshallers[datatypes.gYearMonthQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gYearQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gMonthDayQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gDayQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.gMonthQName.localName] = unmarshallGregorian;
unmarshallers[datatypes.hexBinaryQName.localName] = unmarshallHexBinary;
unmarshallers[datatypes.base64BinaryQName.localName] = unmarshallBase64Binary;
unmarshallers[datatypes.anyURIQName.localName] = unmarshallString;
unmarshallers[datatypes.QNameQName.localName] = unmarshallString;
unmarshallers[datatypes.NOTATIONQName.localName] = unmarshallString;
unmarshallers[datatypes.normalizedStringQName.localName] = unmarshallString;
unmarshallers[datatypes.tokenQName.localName] = unmarshallString;
unmarshallers[datatypes.languageQName.localName] = unmarshallString;
unmarshallers[datatypes.NMTOKENQName.localName] = unmarshallString;
unmarshallers[datatypes.NMTOKENSQName.localName] = unmarshallString;
unmarshallers[datatypes.NameQName.localName] = unmarshallString;
unmarshallers[datatypes.NCNameQName.localName] = unmarshallString;
unmarshallers[datatypes.IDQName.localName] = unmarshallString;
unmarshallers[datatypes.IDREF.localName] = unmarshallString;
unmarshallers[datatypes.IDREFS.localName] = unmarshallString;
unmarshallers[datatypes.ENTITY.localName] = unmarshallString;
unmarshallers[datatypes.ENTITIES.localName] = unmarshallString;
unmarshallers[datatypes.integerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.nonPositiveIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.negativeIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.longQName.localName] = unmarshallInteger;
unmarshallers[datatypes.intQName.localName] = unmarshallInteger;
unmarshallers[datatypes.shortQName.localName] = unmarshallInteger;
unmarshallers[datatypes.byteQName.localName] = unmarshallInteger;
unmarshallers[datatypes.nonNegativeIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedLongQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedIntQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedShortQName.localName] = unmarshallInteger;
unmarshallers[datatypes.unsignedByteQName.localName] = unmarshallInteger;
unmarshallers[datatypes.positiveIntegerQName.localName] = unmarshallInteger;
unmarshallers[datatypes.yearMonthDurationQName.localName] = unmarshallDatetime;
unmarshallers[datatypes.dayTimeDurationQName.localName] = unmarshallDatetime;
if (datatypes.timeInstantQName != null){
unmarshallers[datatypes.timeInstantQName.localName] = unmarshallDatetime;
};
}
public function unmarshallAny(_arg1, _arg2:QName=null, _arg3:XML=null){
var _local4:*;
var _local5:Function;
var _local7:String;
if (_arg1 === undefined){
return (undefined);
};
if (_arg1 == null){
return (null);
};
var _local6:String = whitespaceCollapse(_arg1);
if (_local6 == ""){
_local5 = unmarshallers[datatypes.stringQName.localName];
} else {
if (((((((isNaN(Number(_local6))) || ((_local6.charAt(0) == "0")))) || ((((_local6.charAt(0) == "-")) && ((_local6.charAt(1) == "0")))))) || ((_local6.charAt((_local6.length - 1)) == "E")))){
_local7 = _local6.toLowerCase();
if ((((_local7 == "true")) || ((_local7 == "false")))){
_local5 = unmarshallers[datatypes.booleanQName.localName];
} else {
_local5 = unmarshallers[datatypes.stringQName.localName];
};
} else {
_local5 = unmarshallers[datatypes.doubleQName.localName];
};
};
_local4 = _local5(_arg1, _arg2, _arg3);
return (_local4);
}
public function marshallDouble(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:Number = Number(_arg1);
_local4 = specialNumber(_local5);
if (_local4 == null){
_local4 = _local5.toString();
};
return (_local4);
}
public function unmarshallDatetime(_arg1, _arg2:QName=null, _arg3:XML=null):Object{
var _local4:Date;
var _local6:String;
var _local7:String;
var _local8:Boolean;
var _local9:Boolean;
var _local10:int;
var _local17:int;
var _local18:Number;
var _local20:int;
var _local21:int;
var _local22:uint;
var _local23:uint;
var _local24:uint;
var _local25:Date;
if (_arg1 == null){
return (null);
};
var _local5:String = whitespaceCollapse(_arg1);
var _local11:int = _local5.indexOf("T");
if (_local11 != -1){
_local6 = _local5.substring(0, _local11);
_local7 = _local5.substring((_local11 + 1));
} else {
_local7 = _local5;
};
var _local12:int = int(_local7.substring(0, 2));
var _local13:int = int(_local7.substring(3, 5));
var _local14:int = _local7.indexOf(".", 6);
var _local15:int = int(_local7.substring(6, 8));
var _local16:int = _local7.indexOf("Z", 8);
if (_local16 == -1){
_local16 = _local7.indexOf("+", 8);
if (_local16 != -1){
_local17 = 1;
} else {
_local16 = _local7.indexOf("-", 8);
if (_local16 != -1){
_local17 = -1;
};
};
if (_local16 != -1){
_local10 = (_local16 + 1);
_local20 = int(_local7.substring(_local10, (_local10 + 2)));
_local10 = (_local10 + 3);
_local21 = int(_local7.substring(_local10, (_local10 + 2)));
_local18 = ((_local20 * 3600000) + (_local21 * 60000));
_local8 = true;
_local9 = true;
};
} else {
_local8 = true;
};
var _local19:int;
if (_local14 != -1){
if (_local8){
_local19 = int(_local7.substring((_local14 + 1), _local16));
} else {
_local19 = int(_local7.substring((_local14 + 1)));
};
};
if (_local6 != null){
_local10 = _local6.indexOf("-", 1);
var _temp1 = _local10;
_local10 = (_local10 + 1);
_local22 = uint(_local6.substring(0, _temp1));
_local23 = uint(_local6.substring(_local10, (_local10 + 2)));
_local10 = (_local10 + 3);
_local24 = uint(_local6.substring(_local10, (_local10 + 2)));
if (_local8){
_local4 = new Date(Date.UTC(_local22, (_local23 - 1), _local24));
} else {
_local4 = new Date(_local22, (_local23 - 1), _local24);
};
} else {
if (_local8){
_local25 = new Date();
_local4 = new Date(Date.UTC(_local25.fullYearUTC, _local25.monthUTC, _local25.dateUTC));
} else {
_local4 = new Date();
};
};
if (_local8){
_local4.setUTCHours(_local12, _local13, _local15, _local19);
if (_local9){
if (_local17 > 0){
_local4.time = (_local4.time - _local18);
} else {
_local4.time = (_local4.time + _local18);
};
};
} else {
_local4.setHours(_local12, _local13, _local15, _local19);
};
return (_local4);
}
public function marshall(_arg1, _arg2:QName=null, _arg3:XML=null){
var _local5:*;
if (_arg2 == null){
_arg2 = datatypes.anyTypeQName;
};
var _local4:Function = marshallers[_arg2.localName];
if (_local4 != null){
_local5 = _local4(_arg1, _arg2, _arg3);
} else {
throw (new TypeError((("Cannot marshall type '" + _arg2) + "' to simple content.")));
};
return (_local5);
}
public function marshallInteger(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:Number;
if ((_arg1 is Number)){
_local5 = (_arg1 as Number);
} else {
_local5 = Number(whitespaceCollapse(_arg1));
};
var _local6:Number = -(Number.MAX_VALUE);
var _local7:Number = Number.MAX_VALUE;
if (_arg2 == datatypes.longQName){
_local6 = LONG_MIN_VALUE;
_local7 = LONG_MAX_VALUE;
} else {
if (_arg2 == datatypes.intQName){
_local6 = int.MIN_VALUE;
_local7 = int.MAX_VALUE;
} else {
if (_arg2 == datatypes.shortQName){
_local6 = SHORT_MIN_VALUE;
_local7 = SHORT_MAX_VALUE;
} else {
if (_arg2 == datatypes.byteQName){
_local6 = BYTE_MIN_VALUE;
_local7 = BYTE_MAX_VALUE;
} else {
if (_arg2 == datatypes.unsignedLongQName){
_local6 = 0;
_local7 = ULONG_MAX_VALUE;
} else {
if (_arg2 == datatypes.unsignedIntQName){
_local6 = 0;
_local7 = uint.MAX_VALUE;
} else {
if (_arg2 == datatypes.unsignedShortQName){
_local6 = 0;
_local7 = USHORT_MAX_VALUE;
} else {
if (_arg2 == datatypes.unsignedByteQName){
_local6 = 0;
_local7 = UBYTE_MAX_VALUE;
} else {
if (_arg2 == datatypes.positiveIntegerQName){
_local6 = 1;
_local7 = Number.MAX_VALUE;
} else {
if (_arg2 == datatypes.nonNegativeIntegerQName){
_local6 = 0;
_local7 = Number.MAX_VALUE;
} else {
if (_arg2 == datatypes.negativeIntegerQName){
_local6 = -(Number.MAX_VALUE);
_local7 = -1;
} else {
if (_arg2 == datatypes.nonPositiveIntegerQName){
_local6 = -(Number.MAX_VALUE);
_local7 = 0;
} else {
if (_arg2 == datatypes.integerQName){
_local6 = -(Number.MAX_VALUE);
_local7 = Number.MAX_VALUE;
};
};
};
};
};
};
};
};
};
};
};
};
};
var _local8:Number = Math.floor(_local5);
if (_local8 >= _local6){
if (_local8 > _local7){
if (validating){
throw (new RangeError(((("The value '" + _arg1) + "' is too large for ") + _arg2.localName)));
};
return (whitespaceCollapse(_arg1));
};
} else {
if (validating){
throw (new RangeError(((("The value '" + _arg1) + "' is too small for ") + _arg2.localName)));
};
return (whitespaceCollapse(_arg1));
};
_local4 = _local8.toString();
return (_local4);
}
public function get validating():Boolean{
return (_validating);
}
public function marshallHexBinary(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local5:String;
var _local6:HexEncoder;
var _local4:ByteArray = (_arg1 as ByteArray);
if (_local4 != null){
_local6 = new HexEncoder();
_local6.encode(_local4);
_local5 = _local6.drain();
} else {
throw (new Error("Cannot marshall value as hex binary."));
};
return (_local5);
}
public function unmarshallGregorian(_arg1, _arg2:QName=null, _arg3:XML=null){
var _local4:String = whitespaceCollapse(_arg1);
var _local5:* = _local4;
if (_arg2 == datatypes.gYearQName){
_local5 = uint(_local4.substring(0, 4));
} else {
if (_arg2 == datatypes.gMonthQName){
_local5 = uint(_local4.substring(2, 4));
} else {
if (_arg2 == datatypes.gDayQName){
_local5 = uint(_local4.substring(3, 5));
};
};
};
return (_local5);
}
public function unmarshallDouble(_arg1, _arg2:QName=null, _arg3:XML=null):Number{
var _local4:Number;
var _local5:String;
if (_arg1 != null){
_local5 = whitespaceCollapse(_arg1);
if (_local5 == "INF"){
_local4 = Number.POSITIVE_INFINITY;
} else {
if (_local5 == "-INF"){
_local4 = Number.NEGATIVE_INFINITY;
} else {
_local4 = Number(_local5);
};
};
};
return (_local4);
}
public function unmarshallDuration(_arg1, _arg2:QName=null, _arg3:XML=null){
return (whitespaceCollapse(_arg1));
}
public function unmarshallHexBinary(_arg1, _arg2:QName=null, _arg3:XML=null):ByteArray{
var _local4:String;
var _local5:HexDecoder;
if (_arg1 != null){
_local4 = whitespaceCollapse(_arg1);
_local5 = new HexDecoder();
_local5.decode(_local4);
return (_local5.drain());
};
return (null);
}
public function marshallBase64Binary(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local5:String;
var _local6:Base64Encoder;
var _local4:ByteArray = (_arg1 as ByteArray);
if (_local4 != null){
_local6 = new Base64Encoder();
_local6.insertNewLines = false;
_local6.encodeBytes(_local4);
_local5 = _local6.drain();
} else {
return (null);
};
return (_local5);
}
public function unmarshallString(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
if (_arg1 != null){
_local4 = _arg1.toString();
};
return (_local4);
}
public function marshallDecimal(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:Number;
var _local6:String;
if ((_arg1 is Number)){
_local5 = (_arg1 as Number);
} else {
_local6 = whitespaceCollapse(_arg1);
_local5 = Number(_local6);
};
_local4 = specialNumber(_local5);
if (_local4 != null){
if (validating){
throw (new Error((("Invalid decimal value '" + _arg1) + "'.")));
};
_local4 = whitespaceCollapse(_arg1);
} else {
_local4 = _local5.toString();
};
return (_local4);
}
public function set validating(_arg1:Boolean):void{
_validating = _arg1;
}
public function unmarshall(_arg1, _arg2:QName=null, _arg3:XML=null){
var _local4:String;
var _local6:XML;
var _local7:String;
var _local8:XMLList;
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
if (_local6.nodeKind() == "element"){
_local7 = _local6.attribute(constants.nilQName).toString();
if (_local7 == "true"){
_local4 = null;
} else {
_local4 = _local6.text().toString();
};
} else {
_local4 = _local6.toString();
};
} else {
if ((_arg1 is XMLList)){
_local8 = (_arg1 as XMLList);
_local4 = _local8.text().toString();
} else {
if (_arg1 != null){
_local4 = _arg1.toString();
};
};
};
if (_arg2 == null){
_arg2 = datatypes.anyTypeQName;
};
var _local5:Function = unmarshallers[_arg2.localName];
if (_local5 != null){
_arg1 = _local5(_local4, _arg2, _arg3);
} else {
throw (new TypeError((("Cannot unmarshall type '" + _arg2) + "' from XML.")));
};
return (_arg1);
}
public function marshallDatetime(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:Date;
var _local6:Number;
if ((_arg1 is Number)){
_local5 = new Date();
_local5.time = (_arg1 as Number);
_arg1 = _local5;
};
if ((_arg1 is Date)){
_local5 = (_arg1 as Date);
_local4 = "";
if ((((_arg2 == datatypes.dateTimeQName)) || ((_arg2 == datatypes.dateQName)))){
_local4 = _local4.concat(_local5.getUTCFullYear(), "-");
_local6 = (_local5.getUTCMonth() + 1);
if (_local6 < 10){
_local4 = _local4.concat("0");
};
_local4 = _local4.concat(_local6, "-");
_local6 = _local5.getUTCDate();
if (_local6 < 10){
_local4 = _local4.concat("0");
};
_local4 = _local4.concat(_local6);
};
if (_arg2 == datatypes.dateTimeQName){
_local4 = _local4.concat("T");
};
if ((((_arg2 == datatypes.dateTimeQName)) || ((_arg2 == datatypes.timeQName)))){
_local6 = _local5.getUTCHours();
if (_local6 < 10){
_local4 = _local4.concat("0");
};
_local4 = _local4.concat(_local6, ":");
_local6 = _local5.getUTCMinutes();
if (_local6 < 10){
_local4 = _local4.concat("0");
};
_local4 = _local4.concat(_local6, ":");
_local6 = _local5.getUTCSeconds();
if (_local6 < 10){
_local4 = _local4.concat("0");
};
_local4 = _local4.concat(_local6);
_local6 = _local5.getUTCMilliseconds();
if (_local6 > 0){
_local4 = _local4.concat(".");
if (_local6 < 10){
_local4 = _local4.concat("00");
} else {
if (_local6 < 100){
_local4 = _local4.concat("0");
};
};
_local4 = _local4.concat(_local6);
};
};
_local4 = _local4.concat("Z");
} else {
if ((_arg1 is String)){
_local4 = (_arg1 as String);
};
};
return (_local4);
}
public function unmarshallDecimal(_arg1, _arg2:QName=null, _arg3:XML=null):Number{
return (unmarshallDouble(_arg1, _arg2));
}
public function marshallFloat(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:Number;
var _local6:String;
if ((_arg1 is Number)){
_local5 = (_arg1 as Number);
} else {
_local6 = whitespaceCollapse(_arg1);
_local5 = Number(_local6);
};
_local4 = specialNumber(_local5);
if (_local4 == null){
if (validating){
if (_local5 > 0){
if (_local5 > FLOAT_MAX_VALUE){
throw (new RangeError((("The value '" + _arg1) + "' is too large for a single-precision floating point value.")));
};
if (_local5 < FLOAT_MIN_VALUE){
throw (new RangeError((("The value '" + _arg1) + "' is too small for a single-precision floating point value.")));
};
} else {
if (-(_local5) > FLOAT_MAX_VALUE){
throw (new RangeError((("The absolute value of '" + _arg1) + "' is too large for a single-precision floating point value.")));
};
if (-(_local5) < FLOAT_MIN_VALUE){
throw (new RangeError((("The absolute value of '" + _arg1) + "' is too small for a single-precision floating point value.")));
};
};
};
_local4 = _local5.toString();
};
return (_local4);
}
public function unmarshallInteger(_arg1, _arg2:QName=null, _arg3:XML=null):Number{
return (parseInt(_arg1));
}
public function unmarshallDate(_arg1, _arg2:QName=null, _arg3:XML=null):Object{
var _local4:Date;
var _local5:int;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:String;
var _local11:int;
var _local12:int;
var _local13:Number;
if (_arg1 == null){
return (null);
};
var _local6:String = whitespaceCollapse(_arg1);
if (_local6 != null){
_local5 = _local6.indexOf("-", 1);
var _temp1 = _local5;
_local5 = (_local5 + 1);
_local7 = uint(_local6.substring(0, _temp1));
_local8 = uint(_local6.substring(_local5, (_local5 + 2)));
_local5 = (_local5 + 3);
_local9 = uint(_local6.substring(_local5, (_local5 + 2)));
_local5 = (_local5 + 2);
if (_local6.charAt(_local5) == "Z"){
_local4 = new Date(Date.UTC(_local7, (_local8 - 1), _local9));
} else {
if (_local6.length > 10){
_local4 = new Date(Date.UTC(_local7, (_local8 - 1), _local9));
var _temp2 = _local5;
_local5 = (_local5 + 1);
_local10 = _local6.charAt(_temp2);
_local11 = int(_local6.substring(_local5, (_local5 + 2)));
_local5 = (_local5 + 3);
_local12 = int(_local6.substring(_local5, (_local5 + 2)));
_local13 = ((_local11 * 3600000) + (_local12 * 60000));
if (_local10 == "+"){
_local4.time = (_local4.time - _local13);
} else {
_local4.time = (_local4.time + _local13);
};
} else {
_local4 = new Date(_local7, (_local8 - 1), _local9);
};
};
};
return (_local4);
}
public function unmarshallBase64Binary(_arg1, _arg2:QName=null, _arg3:XML=null):ByteArray{
if (_arg1 == null){
return (null);
};
var _local4:String = whitespaceCollapse(_arg1);
var _local5:Base64Decoder = new Base64Decoder();
_local5.decode(_local4);
return (_local5.drain());
}
public function marshallGregorian(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:Date;
var _local5:Number;
var _local7:int;
var _local8:String;
var _local9:String;
var _local10:String;
if ((_arg1 is Date)){
_local4 = (_arg1 as Date);
} else {
if ((_arg1 is Number)){
_local5 = (_arg1 as Number);
} else {
_arg1 = whitespaceCollapse(_arg1);
};
};
var _local6 = "";
if ((((_arg2 == datatypes.gYearMonthQName)) || ((_arg2 == datatypes.gYearQName)))){
if ((_arg1 is Date)){
_local5 = _local4.getUTCFullYear();
} else {
if ((_arg1 is String)){
_local8 = (_arg1 as String);
_local7 = _local8.indexOf("-", 1);
if (_local7 > 0){
_local8 = _local8.substring(0, _local7);
};
_local5 = parseInt(_local8);
};
};
if (((isNaN(_local5)) || ((_local5 == 0)))){
if (validating){
throw (new Error(((("Invalid year supplied for type " + _arg2.localName) + " in value ") + _arg1)));
};
return (whitespaceCollapse(_arg1));
} else {
_local8 = _local5.toFixed(0);
if (_local8.indexOf("-") == 0){
while (_local8.length < 5) {
_local8 = ((_local8.substring(0, 1) + "0") + _local8.substring(1));
};
} else {
while (_local8.length < 4) {
_local8 = ("0" + _local8);
};
};
_local6 = _local6.concat(_local8);
};
if (_arg2 != datatypes.gYearQName){
_local6 = _local6.concat("-");
};
};
if ((((((_arg2 == datatypes.gYearMonthQName)) || ((_arg2 == datatypes.gMonthDayQName)))) || ((_arg2 == datatypes.gMonthQName)))){
if (_arg2 != datatypes.gYearMonthQName){
_local6 = _local6.concat("--");
};
if ((_arg1 is Date)){
_local5 = (_local4.getUTCMonth() + 1);
} else {
_local9 = _arg1.toString();
if (_arg2 == datatypes.gMonthDayQName){
_local7 = _local9.indexOf("--", 0);
if (_local7 == 0){
_local9 = _local9.substring(2, 4);
} else {
if (validating){
throw (new Error((((("Invalid month supplied for " + _arg2.localName) + " in value ") + _arg1) + ". The format must be '--MM-DD'.")));
};
return (whitespaceCollapse(_arg1));
};
} else {
if (_arg2 == datatypes.gYearMonthQName){
_local7 = _local9.indexOf("-", 1);
if (_local7 > 0){
_local9 = _local9.substring((_local7 + 1), (_local7 + 3));
} else {
if (validating){
throw (new Error((((("Invalid month supplied for " + _arg2.localName) + " in value ") + _arg1) + ". The format must be '--CCYY-MM'.")));
};
return (whitespaceCollapse(_arg1));
};
} else {
_local7 = _local9.indexOf("--", 0);
if (_local7 > 0){
_local9 = _local9.substring(2, 4);
};
};
};
_local5 = parseInt(_local9);
};
if (((((isNaN(_local5)) || ((_local5 <= 0)))) || ((_local5 > 12)))){
if (validating){
throw (new Error(((("Invalid month supplied for type " + _arg2.localName) + " in value ") + _arg1)));
};
return (whitespaceCollapse(_arg1));
} else {
_local5 = int(_local5);
if (_local5 < 10){
_local6 = _local6.concat("0");
};
_local6 = _local6.concat(_local5);
};
if (_arg2 == datatypes.gMonthDayQName){
_local6 = _local6.concat("-");
};
};
if ((((_arg2 == datatypes.gMonthDayQName)) || ((_arg2 == datatypes.gDayQName)))){
if (_arg2 == datatypes.gDayQName){
_local6 = _local6.concat("---");
};
if ((_arg1 is Date)){
_local5 = _local4.getUTCDate();
} else {
if ((_arg1 is String)){
_local10 = (_arg1 as String);
if (_arg2 == datatypes.gMonthDayQName){
_local7 = _local10.indexOf("--", 0);
if (_local7 == 0){
_local10 = _local10.substring(5, 7);
} else {
if (validating){
throw (new Error((("Invalid day supplied for gMonthDay in value " + _arg1) + ". The format must be '--MM-DD'.")));
};
return (whitespaceCollapse(_arg1));
};
} else {
_local7 = _local10.indexOf("---", 0);
if (_local7 == 0){
_local10 = _local10.substring(3, 5);
};
};
_local5 = parseInt(_local10);
};
};
if (((((isNaN(_local5)) || ((_local5 <= 0)))) || ((_local5 > 31)))){
if (validating){
throw (new Error(((("Invalid day supplied for type " + _arg2.localName) + " in value ") + _arg1)));
};
return (whitespaceCollapse(_arg1));
} else {
_local5 = int(_local5);
if (_local5 < 10){
_local6 = _local6.concat("0");
};
_local6 = _local6.concat(_local5);
};
};
return (_local6);
}
public function marshallBoolean(_arg1, _arg2:QName=null, _arg3:XML=null):String{
var _local4:String;
var _local5:String;
if (_arg1 != null){
if ((_arg1 is Boolean)){
_local4 = ((_arg1 as Boolean)) ? "true" : "false";
} else {
if ((_arg1 is Number)){
_local4 = ((_arg1)==1) ? "true" : "false";
} else {
if ((_arg1 is Object)){
_local5 = Object(_arg1).toString();
if ((((((((_local5 == "true")) || ((_local5 == "false")))) || ((_local5 == "1")))) || ((_local5 == "0")))){
_local4 = _local5;
} else {
throw (new Error((("String '" + _arg1) + "' is not a Boolean.")));
};
};
};
};
};
return (_local4);
}
public function unmarshallFloat(_arg1, _arg2:QName=null, _arg3:XML=null):Number{
return (unmarshallDouble(_arg1, _arg2, _arg3));
}
public function marshallAny(_arg1, _arg2:QName=null, _arg3:XML=null){
if (_arg1 === undefined){
return (undefined);
};
if (_arg1 == null){
return (null);
};
var _local4:String = guessSimpleType(_arg1);
if (_arg2 != null){
_arg2 = new QName(_arg2.uri, _local4);
} else {
_arg2 = new QName(constants.xsdURI, _local4);
};
var _local5:Function = marshallers[_arg2.localName];
if (_local5 != null){
return (_local5(_arg1, _arg2));
};
throw (new TypeError((("Cannot marshall type '" + _arg2) + "' to simple content.")));
}
public function marshallString(_arg1, _arg2:QName=null, _arg3:XML=null):String{
if (((!((_arg1 == null))) && ((_arg1 is Object)))){
return (Object(_arg1).toString());
};
return (null);
}
public static function guessSimpleType(_arg1){
var _local2 = "string";
if ((_arg1 is uint)){
_local2 = "unsignedInt";
} else {
if ((_arg1 is int)){
_local2 = "int";
} else {
if ((_arg1 is Number)){
_local2 = "double";
} else {
if ((_arg1 is Boolean)){
_local2 = "boolean";
} else {
if ((_arg1 is String)){
_local2 = "string";
} else {
if ((_arg1 is ByteArray)){
if (byteArrayAsBase64Binary){
_local2 = "base64Binary";
} else {
_local2 = "hexBinary";
};
} else {
if ((_arg1 is Date)){
_local2 = "dateTime";
};
};
};
};
};
};
};
return (_local2);
}
private static function whitespaceCollapse(_arg1):String{
if (_arg1 == null){
return (null);
};
var _local2:String = _arg1.toString();
_local2 = _local2.replace(whitespaceCollapsePattern, " ");
_local2 = _local2.replace(whitespaceTrimPattern, "");
return (_local2);
}
private static function specialNumber(_arg1:Number):String{
if (_arg1 == Number.NEGATIVE_INFINITY){
return ("-INF");
};
if (_arg1 == Number.POSITIVE_INFINITY){
return ("INF");
};
if (isNaN(_arg1)){
return ("NaN");
};
return (null);
}
private static function whitespaceReplace(_arg1):String{
if (_arg1 == null){
return (null);
};
var _local2:String = _arg1.toString();
_local2 = _local2.replace(whitespaceReplacePattern, " ");
return (_local2);
}
}
}//package mx.rpc.xml
Section 174
//SchemaProcessor (mx.rpc.xml.SchemaProcessor)
package mx.rpc.xml {
import mx.utils.*;
public class SchemaProcessor {
private var _schemaManager:SchemaManager;
protected var strictOccurenceBounds:Boolean;// = false
protected function getMinOccurs(_arg1:XML):uint{
var _local2:uint = 1;
var _local3:String = getAttributeFromNode("minOccurs", _arg1);
if (_local3 != null){
_local2 = parseInt(_local3);
};
return (_local2);
}
protected function getSingleElementFromNode(_arg1:XML, ... _args):XML{
var _local4:XML;
var _local5:QName;
var _local3:XMLList = _arg1.elements();
for each (_local4 in _local3) {
if (((!((_args == null))) && ((_args.length > 0)))){
for each (_local5 in _args) {
if (_local4.name() == _local5){
return (_local4);
};
};
} else {
return (_local4);
};
};
return (null);
}
public function get schemaManager():SchemaManager{
if (_schemaManager == null){
_schemaManager = new SchemaManager();
};
return (_schemaManager);
}
protected function get constants():SchemaConstants{
return (schemaManager.schemaConstants);
}
protected function getAttributeFromNode(_arg1, _arg2:XML):String{
var _local3:String;
var _local4:XMLList;
if (_arg2 != null){
_local4 = _arg2.attribute(_arg1);
if (_local4.length() > 0){
_local3 = _local4[0];
};
};
return (_local3);
}
public function isBuiltInType(_arg1:QName):Boolean{
var _local2:String = ((_arg1)!=null) ? _arg1.uri : null;
if (_local2 != null){
if (((((URLUtil.urisEqual(_local2, SchemaConstants.XSD_URI_1999)) || (URLUtil.urisEqual(_local2, SchemaConstants.XSD_URI_2000)))) || (URLUtil.urisEqual(_local2, SchemaConstants.XSD_URI_2001)))){
return (true);
};
};
return (false);
}
protected function getMaxOccurs(_arg1:XML):uint{
var _local2:uint = 1;
var _local3:String = getAttributeFromNode("maxOccurs", _arg1);
if (_local3 != null){
_local2 = ((_local3)=="unbounded") ? uint.MAX_VALUE : parseInt(_local3);
};
return (_local2);
}
public function reset():void{
schemaManager.reset();
}
public function set schemaManager(_arg1:SchemaManager):void{
_schemaManager = _arg1;
}
public function getValueOccurence(_arg1):uint{
var _local2:uint = 1;
if (((!((_arg1 == null))) && (TypeIterator.isIterable(_arg1)))){
_local2 = TypeIterator.getLength(_arg1);
} else {
if (_arg1 === undefined){
_local2 = 0;
};
};
return (_local2);
}
}
}//package mx.rpc.xml
Section 175
//SchemaTypeRegistry (mx.rpc.xml.SchemaTypeRegistry)
package mx.rpc.xml {
import flash.utils.*;
public class SchemaTypeRegistry {
private var classMap:Object;
private var collectionMap:Object;
private static var _instance:SchemaTypeRegistry;
public function SchemaTypeRegistry(){
classMap = {};
collectionMap = {};
super();
}
public function getClass(_arg1:Object):Class{
var _local2:Class;
var _local3:String;
var _local4:String;
if (_arg1 != null){
_local3 = getKey(_arg1);
_local4 = (classMap[_local3] as String);
if (_local4 != null){
_local2 = (getDefinitionByName(_local4) as Class);
};
};
return (_local2);
}
private function register(_arg1:Object, _arg2:Object, _arg3:Object):void{
var _local5:String;
var _local4:String = getKey(_arg1);
if ((_arg2 is String)){
_local5 = (_arg2 as String);
} else {
_local5 = getQualifiedClassName(_arg2);
};
_arg3[_local4] = _local5;
}
public function getCollectionClass(_arg1:Object):Class{
var _local2:Class;
var _local3:String;
var _local4:String;
if (_arg1 != null){
_local3 = getKey(_arg1);
_local4 = (collectionMap[_local3] as String);
if (_local4 != null){
_local2 = (getDefinitionByName(_local4) as Class);
};
};
return (_local2);
}
public function unregisterCollectionClass(_arg1:Object):void{
var _local2:String;
if (_arg1 != null){
_local2 = getKey(_arg1);
delete collectionMap[_local2];
};
}
private function getKey(_arg1:Object):String{
var _local2:String;
var _local3:QName;
if ((_arg1 is QName)){
_local3 = (_arg1 as QName);
if ((((_local3.uri == null)) || ((_local3.uri == "")))){
_local2 = _local3.localName;
} else {
_local2 = _local3.toString();
};
} else {
_local2 = _arg1.toString();
};
return (_local2);
}
public function registerClass(_arg1:Object, _arg2:Object):void{
register(_arg1, _arg2, classMap);
}
public function registerCollectionClass(_arg1:Object, _arg2:Object):void{
register(_arg1, _arg2, collectionMap);
}
public function unregisterClass(_arg1:Object):void{
var _local2:String;
if (_arg1 != null){
_local2 = getKey(_arg1);
delete classMap[_local2];
};
}
public static function getInstance():SchemaTypeRegistry{
if (_instance == null){
_instance = new (SchemaTypeRegistry);
};
return (_instance);
}
}
}//package mx.rpc.xml
Section 176
//SimpleContent (mx.rpc.xml.SimpleContent)
package mx.rpc.xml {
import mx.rpc.xml.*;
dynamic class SimpleContent {
public var value;
function SimpleContent(_arg1){
value = _arg1;
}
public function valueOf():Object{
return ((value as Object));
}
public function toString():String{
var _local1:Object = (value as Object);
return (((_local1 == null)) ? null : _local1.toString());
}
}
}//package mx.rpc.xml
Section 177
//TypeIterator (mx.rpc.xml.TypeIterator)
package mx.rpc.xml {
import mx.collections.*;
public class TypeIterator {
private var _value;
private var counter:uint;
public function TypeIterator(_arg1){
_value = _arg1;
}
public function get value(){
return (_value);
}
public function next(){
var result:*;
try {
result = getItemAt(_value, counter);
} finally {
counter++;
};
return (result);
}
public function get length():uint{
return (getLength(_value));
}
public function hasNext():Boolean{
if (_value != null){
return ((getLength(_value) > counter));
};
return (false);
}
public function reset():void{
counter = 0;
}
public static function push(_arg1, _arg2):uint{
var _local3:uint;
var _local4:*;
var _local5:Array;
var _local6:IList;
var _local7:XMLList;
if (_arg1 != null){
if ((((_arg1 is ContentProxy)) && (!(ContentProxy(_arg1).isSimple)))){
_local4 = ContentProxy(_arg1).content;
if (TypeIterator.isIterable(_local4)){
_arg1 = _local4;
};
};
if ((_arg1 is Array)){
_local5 = (_arg1 as Array);
_local3 = _local5.push(_arg2);
} else {
if ((_arg1 is IList)){
_local6 = (_arg1 as IList);
_local6.addItem(_arg2);
_local3 = _local6.length;
} else {
if ((_arg1 is XMLList)){
_local7 = (_arg1 as XMLList);
_local7 = (_local7 + _arg2);
_local3 = _local7.length();
};
};
};
};
return (_local3);
}
public static function getLength(_arg1):uint{
var _local2:uint;
var _local3:Array;
var _local4:IList;
var _local5:XMLList;
if (_arg1 != null){
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
_local2 = _local3.length;
} else {
if ((_arg1 is IList)){
_local4 = (_arg1 as IList);
_local2 = _local4.length;
} else {
if ((_arg1 is XMLList)){
_local5 = (_arg1 as XMLList);
_local2 = _local5.length();
};
};
};
};
return (_local2);
}
public static function getItemAt(_arg1, _arg2:uint){
var _local3:*;
var _local4:Array;
var _local5:IList;
var _local6:XMLList;
if (_arg1 != null){
if ((_arg1 is Array)){
_local4 = (_arg1 as Array);
_local3 = _local4[_arg2];
} else {
if ((_arg1 is IList)){
_local5 = (_arg1 as IList);
_local3 = _local5.getItemAt(_arg2);
} else {
if ((_arg1 is XMLList)){
_local6 = (_arg1 as XMLList);
_local3 = _local6[_arg2];
};
};
};
};
return (_local3);
}
public static function isIterable(_arg1):Boolean{
var _local2:*;
if ((((_arg1 is ContentProxy)) && (!(ContentProxy(_arg1).isSimple)))){
_local2 = ContentProxy(_arg1).content;
if (TypeIterator.isIterable(_local2)){
_arg1 = _local2;
};
};
if ((((((_arg1 is Array)) || ((_arg1 is IList)))) || ((_arg1 is XMLList)))){
return (true);
};
return (false);
}
}
}//package mx.rpc.xml
Section 178
//XMLDecoder (mx.rpc.xml.XMLDecoder)
package mx.rpc.xml {
import flash.utils.*;
import mx.logging.*;
import mx.collections.*;
import mx.utils.*;
public class XMLDecoder extends SchemaProcessor implements IXMLDecoder {
private var _recordXSIType:Boolean;
protected var document:XML;
private var log:ILogger;
private var _makeObjectsBindable:Boolean;
private var _typeRegistry:SchemaTypeRegistry;
public static var listClass:Class = ArrayCollection;
public function XMLDecoder(){
log = Log.getLogger("mx.rpc.xml.XMLDecoder");
typeRegistry = SchemaTypeRegistry.getInstance();
}
public function createIterableValue(_arg1:Object=null){
var value:*;
var c:Class;
var type = _arg1;
try {
if (type != null){
c = typeRegistry.getCollectionClass(type);
if (c != null){
value = new (c);
};
};
} catch(e1:Error) {
log.debug("Error while resolving custom collection type for '{0}'.\nError: '{1}'.", type, e1);
};
try {
if (value == null){
if (makeObjectsBindable){
value = new listClass();
} else {
value = [];
};
};
} catch(e2:Error) {
log.warn("Unable to create instance of '{0}'.", listClass);
};
return (value);
}
public function get makeObjectsBindable():Boolean{
return (_makeObjectsBindable);
}
public function decodeAnyElement(_arg1:XML, _arg2, _arg3:QName, _arg4:XMLList, _arg5:DecodingContext=null, _arg6:Boolean=true):Boolean{
var _local7:Array;
var _local9:String;
var _local13:XML;
var _local14:String;
var _local15:String;
var _local16:QName;
var _local17:*;
var _local18:*;
if (_arg5 == null){
_arg5 = new DecodingContext();
};
var _local8:Boolean;
var _local10:uint = getMaxOccurs(_arg1);
var _local11:uint = getMinOccurs(_arg1);
if (_arg1 != null){
_local14 = _arg1.@["processContents"];
_local15 = _arg1.@["namespace"];
if (((!((_local15 == ""))) && (!((_local15 == "##any"))))){
if (((!((schemaManager.currentSchema == null))) && (!((schemaManager.currentSchema.targetNamespace == null))))){
_local9 = schemaManager.currentSchema.targetNamespace.uri;
};
if (_local15 == "##other"){
_local8 = false;
} else {
if (_local15.indexOf("##targetNamespace") >= 0){
_local15 = _local15.replace("##targetNamespace", _local9);
};
_local7 = _local15.split(" ");
};
};
};
var _local12:XMLList = getApplicableValues(_arg2, _arg4, null, _arg5, _local10);
for each (_local13 in _local12) {
_local16 = (_local13.name() as QName);
if (((!(_local8)) && (URLUtil.urisEqual(_local16.uri, _local9)))){
break;
};
if (includeNamespace(_local16.uri, _local7)){
if (_local14 == "skip"){
_local18 = _local13.toXMLString();
} else {
_local18 = _local13;
};
decodeAnyType(_arg2, _local16, new XMLList(_local18));
if (_arg5.anyIndex < 0){
_arg5.anyIndex = (_arg5.index + 0);
};
_arg5.index++;
};
};
return (true);
}
public function decodeComplexRestriction(_arg1:XML, _arg2, _arg3:QName, _arg4):void{
var _local9:XML;
var _local5:String = getAttributeFromNode("base", _arg1);
if (_local5 == null){
throw (new Error("A complexContent restriction must declare a base type."));
};
var _local6:QName = schemaManager.getQNameForPrefixedName(_local5, _arg1);
var _local7:XMLList = _arg1.elements();
var _local8:XMLList = new XMLList();
if ((_arg4 is XML)){
_local8 = (_arg4 as XML).elements();
} else {
if ((_arg4 is XMLList)){
_local8 = _arg4;
};
};
for each (_local9 in _local7) {
if (_local9.name() == constants.sequenceQName){
decodeSequence(_local9, _arg2, _arg3, _local8);
} else {
if (_local9.name() == constants.groupQName){
decodeGroupReference(_local9, _arg2, _arg3, _local8);
} else {
if (_local9.name() == constants.allQName){
decodeAll(_local9, _arg2, _arg3, _local8);
} else {
if (_local9.name() == constants.choiceQName){
decodeChoice(_local9, _arg2, _arg3, _local8);
} else {
if (_local9.name() == constants.attributeQName){
decodeAttribute(_local9, _arg2, _arg4);
} else {
if (_local9.name() == constants.attributeGroupQName){
decodeAttributeGroup(_local9, _arg2, _arg4);
} else {
if (_local9.name() == constants.anyAttributeQName){
decodeAnyAttribute(_local9, _arg2, _arg4);
};
};
};
};
};
};
};
};
}
public function decodeGroupElement(_arg1:XML, _arg2, _arg3:XMLList, _arg4:DecodingContext=null, _arg5:Boolean=true, _arg6:Boolean=true):Boolean{
var _local9:QName;
var _local13:*;
var _local14:String;
var _local15:QName;
var _local16:*;
var _local17:uint;
var _local18:XML;
if (_arg4 == null){
_arg4 = new DecodingContext();
};
var _local7:uint = getMaxOccurs(_arg1);
var _local8:uint = getMinOccurs(_arg1);
if (_arg1.attribute("ref").length() == 1){
_local9 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local9, constants.elementTypeQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve element definition for ref '" + _local9) + "'")));
};
};
if (_local7 == 0){
return (true);
};
var _local10:String = _arg1.@name.toString();
var _local11:QName = schemaManager.getQNameForElement(_local10, getAttributeFromNode("form", _arg1));
var _local12:XMLList = getApplicableValues(_arg2, _arg3, _local11, _arg4, _local7);
if ((((_local12.length() == 1)) && (isXSINil(_local12[0])))){
setValue(_arg2, _local11, null);
_arg4.index++;
return (true);
};
if (_local7 > 1){
_local14 = getAttributeFromNode("type", _arg1);
if (_local14 != null){
_local15 = schemaManager.getQNameForPrefixedName(_local14, _arg1);
};
_local16 = createIterableValue(_local15);
if (_arg6){
setValue(_arg2, _local11, _local16, _local15);
} else {
if (!(((_arg2 is ContentProxy)) && (!((_arg2.object_proxy::content == undefined))))){
setValue(_arg2, null, _local16, _local15);
};
};
};
if (_local12.length() == 0){
if (_local8 == 0){
return (true);
};
return (false);
};
if (_local7 == 1){
_local13 = decodeElementTopLevel(_arg1, _local11, parseValue(_local11, _local12));
setValue(_arg2, _local11, _local13);
_arg4.index++;
} else {
if (_local7 > 1){
if (_local12.length() < _local8){
if (strictOccurenceBounds){
throw (new Error((((((("Value supplied for element '" + _local11) + "' occurs ") + _local12.length()) + " times which falls short of minOccurs ") + _local8) + ".")));
};
return (false);
};
if (_local12.length() > _local7){
if (strictOccurenceBounds){
throw (new Error((((((("Value supplied for element of type '" + _local11) + "' occurs ") + _local12.length()) + " times which exceeds maxOccurs ") + _local7) + ".")));
};
return (false);
};
_local17 = 0;
while ((((_local17 < _local7)) && ((_local17 < _local12.length())))) {
_local18 = _local12[_local17];
_local13 = decodeElementTopLevel(_arg1, _local11, _local18);
setValue(_arg2, _local11, _local13);
_arg4.index++;
_local17++;
};
};
};
if (_local9 != null){
schemaManager.releaseScope();
};
return (true);
}
public function decodeElementTopLevel(_arg1:XML, _arg2:QName, _arg3){
var _local4:*;
var _local8:*;
var _local10:QName;
var _local11:XML;
var _local12:QName;
var _local5:Boolean = ((_arg1.@nillable.toString() == "true")) ? true : false;
if (((_local5) && ((_arg3 == null)))){
return (_arg3);
};
var _local6:String = getAttributeFromNode("fixed", _arg1);
if (_local6 != null){
_arg3 = _local6;
};
var _local7:String = getAttributeFromNode("default", _arg1);
if (((!(_local5)) && ((_arg3 == null)))){
_arg3 = _local7;
};
if (_arg3 == null){
return (_arg3);
};
var _local9:String = getAttributeFromNode("type", _arg1);
if (_local9 != null){
_local10 = schemaManager.getQNameForPrefixedName(_local9, _arg1);
_local4 = createContent(_local10);
decodeType(_local10, _local4, _arg2, _arg3);
return (_local4);
};
if (_arg1.hasComplexContent()){
_local11 = getSingleElementFromNode(_arg1, constants.complexTypeQName, constants.simpleTypeQName);
_local4 = createContent();
if (_local11.name() == constants.complexTypeQName){
decodeComplexType(_local11, _local4, _arg2, _arg3);
} else {
if (_local11.name() == constants.simpleTypeQName){
decodeSimpleType(_local11, _local4, _arg2, _arg3);
};
};
return (_local4);
//unresolved jump
};
if (((!((_local6 == null))) || (!((_local7 == null))))){
_local12 = schemaManager.schemaDatatypes.stringQName;
} else {
_local12 = constants.anyTypeQName;
};
_local4 = createContent(_local12);
decodeType(_local12, _local4, _arg2, _arg3);
return (_local4);
}
protected function parseValue(_arg1, _arg2:XMLList){
var _local3:* = _arg2;
if (_arg2.hasSimpleContent()){
if (isXSINil(_arg2)){
_local3 = null;
} else {
_local3 = _arg2.toString();
};
} else {
if (_arg2.length() == 1){
_local3 = _arg2[0];
};
};
return (_local3);
}
protected function includeNamespace(_arg1:String, _arg2:Array=null):Boolean{
var _local3:Boolean;
var _local4:String;
if (_arg2 != null){
_local3 = false;
for each (_local4 in _arg2) {
if ((((_local4 == "##local")) && ((_arg1 == null)))){
return (true);
};
if (URLUtil.urisEqual(_arg1, _local4)){
return (true);
};
};
return (false);
};
return (true);
}
public function get typeRegistry():SchemaTypeRegistry{
return (_typeRegistry);
}
public function decodeSimpleContent(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local7:String;
var _local8:QName;
var _local9:*;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
var _local13:*;
var _local6:XML = getSingleElementFromNode(_arg1, constants.extensionQName, constants.restrictionQName);
if ((_arg2 is ContentProxy)){
ContentProxy(_arg2).object_proxy::isSimple = true;
};
if (_local6 != null){
_local7 = getAttributeFromNode("base", _local6);
if (_local7 == null){
throw (new Error("A simpleContent extension or restriction must declare a base type."));
};
_local8 = schemaManager.getQNameForPrefixedName(_local7, _local6);
if (!isBuiltInType(_local8)){
_local10 = schemaManager.getNamedDefinition(_local8, constants.complexTypeQName, constants.simpleTypeQName);
if (_local10 == null){
throw (new Error((("Cannot find base type definition '" + _local8) + "'")));
};
schemaManager.releaseScope();
};
if (_local6.name() == constants.extensionQName){
if (isBuiltInType(_local8)){
_local9 = getSimpleValue(_arg4, _arg3);
_local13 = marshallBuiltInType(_local8, _arg2, _arg3, _local9, _arg5);
setSimpleValue(_arg2, _arg3, _local13, _local8);
} else {
decodeType(_local8, _arg2, _arg3, _arg4, _arg5);
};
_local11 = _local6.elements();
for each (_local12 in _local11) {
if (_local12.name() == constants.attributeQName){
decodeAttribute(_local12, _arg2, _arg4, _arg5);
} else {
if (_local12.name() == constants.attributeGroupQName){
decodeAttributeGroup(_local12, _arg2, _arg4, _arg5);
} else {
if (_local12.name() == constants.anyAttributeQName){
decodeAnyAttribute(_local12, _arg2, _arg4, _arg5);
};
};
};
};
} else {
if (_local6.name() == constants.restrictionQName){
_local9 = getSimpleValue(_arg4, _arg3);
decodeSimpleRestriction(_local6, _arg2, _arg3, _local9);
};
};
};
}
public function decodeGroupReference(_arg1:XML, _arg2, _arg3:QName, _arg4:XMLList, _arg5:DecodingContext=null, _arg6:Boolean=true):Boolean{
var _local7:QName;
var _local10:XML;
if (_arg1.attribute("ref").length() == 1){
_local7 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local7, constants.groupQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve group definition for '" + _local7) + "'")));
};
} else {
throw (new Error("A group reference element must have the ref attribute."));
};
var _local8:XMLList = _arg1.elements();
var _local9:Boolean;
for each (_local10 in _local8) {
if (_local10.name() == constants.allQName){
_local9 = decodeAll(_local10, _arg2, _arg3, _arg4, _arg5, _arg6);
} else {
if (_local10.name() == constants.choiceQName){
_local9 = decodeChoice(_local10, _arg2, _arg3, _arg4, _arg5, _arg6);
} else {
if (_local10.name() == constants.sequenceQName){
_local9 = decodeSequence(_local10, _arg2, _arg3, _arg4, _arg5, _arg6);
};
};
};
};
schemaManager.releaseScope();
return (_local9);
}
public function setSimpleValue(_arg1, _arg2, _arg3, _arg4:Object=null):void{
var _local5:ContentProxy;
if ((_arg1 is ContentProxy)){
_local5 = (_arg1 as ContentProxy);
if (_local5.object_proxy::isSimple){
_local5.object_proxy::content = _arg3;
return;
};
};
setValue(_arg1, _arg2, _arg3, _arg4);
}
public function decodeAnyAttribute(_arg1:XML, _arg2, _arg3=undefined, _arg4:XML=null):void{
var _local5:XML;
var _local6:Array;
var _local7:Boolean;
var _local8:String;
var _local9:String;
var _local10:XMLList;
var _local11:XML;
var _local12:QName;
var _local13:*;
if (((!((_arg3 === undefined))) && ((_arg3 is XML)))){
_local5 = (_arg3 as XML);
_local7 = true;
_local9 = _arg1.@["namespace"];
if (((!((_local9 == ""))) && (!((_local9 == "##any"))))){
if (((!((schemaManager.currentSchema == null))) && (!((schemaManager.currentSchema.targetNamespace == null))))){
_local8 = schemaManager.currentSchema.targetNamespace.uri;
};
if (_local9 == "##other"){
_local7 = false;
} else {
if (_local9.indexOf("##targetNamespace") >= 0){
_local9 = _local9.replace("##targetNamespace", _local8);
};
_local6 = _local9.split(" ");
};
};
_local10 = _local5.attributes();
for each (_local11 in _local10) {
_local12 = (_local11.name() as QName);
if (((!(_local7)) && (URLUtil.urisEqual(_local12.uri, _local8)))){
} else {
if (includeNamespace(_local12.uri, _local6)){
_local13 = getAttribute(_arg3, _local12);
if (_local13 != null){
setAttribute(_arg2, _local12, _local13);
};
};
};
};
};
}
public function decodeSimpleType(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local6:XML = getSingleElementFromNode(_arg1, constants.restrictionQName, constants.listQName, constants.unionQName);
if (_local6.name() == constants.restrictionQName){
decodeSimpleRestriction(_local6, _arg2, _arg3, _arg4);
} else {
if (_local6.name() == constants.listQName){
decodeSimpleList(_local6, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local6.name() == constants.listQName){
decodeSimpleUnion(_local6, _arg2, _arg3, _arg4, _arg5);
};
};
};
}
public function hasAttribute(_arg1, _arg2):Boolean{
return (!((getAttribute(_arg1, _arg2) === undefined)));
}
public function getProperties(_arg1):Array{
var _local3:XMLList;
var _local4:XML;
var _local2:Array = [];
if ((_arg1 is XML)){
_local3 = XML(_arg1).elements();
} else {
if ((_arg1 is XMLList)){
_local3 = XMLList(_arg1).elements();
};
};
if (_local3 != null){
for each (_local4 in _local3) {
_local2.push(_local4.name());
};
};
return (_local2);
}
protected function preProcessXML(_arg1:XML):void{
}
protected function isXSINil(_arg1):Boolean{
var _local2:String;
if (_arg1 != null){
_local2 = "false";
if ((_arg1 is XML)){
_local2 = XML(_arg1).attribute(constants.nilQName).toString();
} else {
if ((_arg1 is XMLList)){
_local2 = XMLList(_arg1).attribute(constants.nilQName).toString();
};
};
if (_local2 == "true"){
return (true);
};
};
return (false);
}
public function set typeRegistry(_arg1:SchemaTypeRegistry):void{
_typeRegistry = _arg1;
}
public function marshallBuiltInType(_arg1:QName, _arg2, _arg3:QName, _arg4, _arg5:XML=null){
var _local6:*;
var _local7:XMLList;
if ((((_arg1 == constants.anyTypeQName)) && (!(isSimpleValue(_arg4))))){
_local6 = createContent();
if ((_local6 is ContentProxy)){
ContentProxy(_local6).object_proxy::isSimple = false;
};
if ((_arg4 is XML)){
_local7 = _arg4.elements();
} else {
_local7 = new XMLList(_arg4);
};
decodeAnyType(_local6, _arg3, _local7);
return (_local6);
//unresolved jump
};
return (schemaManager.unmarshall(_arg4, _arg1, _arg5));
}
public function getSimpleValue(_arg1, _arg2){
var _local3:XML;
var _local4:XMLList;
if ((_arg1 is XML)){
_local3 = (_arg1 as XML);
if (_local3.hasSimpleContent()){
return (_local3.toString());
};
} else {
if ((_arg1 is XMLList)){
_local4 = (_arg1 as XMLList);
if (_local4.hasSimpleContent()){
return (_local4.toString());
};
};
};
return (getValue(_arg1, _arg2));
}
public function setValue(_arg1, _arg2, _arg3, _arg4:Object=null):void{
var existingValue:*;
var propertyName:String;
var proxyParent:ContentProxy;
var parent = _arg1;
var name = _arg2;
var value = _arg3;
var type = _arg4;
if (parent != null){
if ((value is ContentProxy)){
value = ContentProxy(value).object_proxy::content;
};
if (TypeIterator.isIterable(parent)){
TypeIterator.push(parent, value);
} else {
if (name != null){
if ((name is ContentProxy)){
name = ContentProxy(name).object_proxy::content;
};
if ((name is QName)){
propertyName = QName(name).localName;
} else {
propertyName = Object(name).toString();
};
if ((((parent is ContentProxy)) && (ContentProxy(parent).object_proxy::isSimple))){
existingValue = ContentProxy(parent).object_proxy::content;
} else {
if (Object(parent).hasOwnProperty(propertyName)){
existingValue = getExistingValue(parent, propertyName);
} else {
if (Object(parent).hasOwnProperty(("_" + propertyName))){
existingValue = getExistingValue(parent, ("_" + propertyName));
};
};
};
if (existingValue != null){
existingValue = promoteValueToArray(existingValue, type);
TypeIterator.push(existingValue, value);
value = existingValue;
};
try {
if ((((parent is ContentProxy)) && (ContentProxy(parent).object_proxy::isSimple))){
ContentProxy(parent).object_proxy::content = value;
} else {
try {
parent[propertyName] = value;
} catch(e:Error) {
parent[("_" + propertyName)] = value;
};
};
} catch(e:Error) {
log.warn("Unable to set property '{0}' on parent.", propertyName);
};
} else {
if ((parent is ContentProxy)){
proxyParent = (parent as ContentProxy);
existingValue = proxyParent.object_proxy::content;
if (existingValue !== undefined){
existingValue = promoteValueToArray(existingValue, type);
proxyParent.object_proxy::content = existingValue;
TypeIterator.push(existingValue, value);
value = existingValue;
};
proxyParent.object_proxy::content = value;
};
};
};
};
}
public function decodeComplexContent(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:DecodingContext):void{
var _local6:XML = getSingleElementFromNode(_arg1, constants.extensionQName, constants.restrictionQName);
if (_local6.name() == constants.extensionQName){
decodeComplexExtension(_local6, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local6.name() == constants.restrictionQName){
decodeComplexRestriction(_local6, _arg2, _arg3, _arg4);
};
};
}
public function getValue(_arg1, _arg2, _arg3:Number=-1){
var _local4:*;
var _local5:QName;
var _local6:XMLList;
if ((_arg2 is QName)){
_local5 = (_arg2 as QName);
if ((((_local5.uri == null)) || ((_local5.uri == "")))){
_arg2 = _local5.localName;
};
};
if ((_arg1 is XML)){
_local6 = XML(_arg1).elements(_arg2);
if (_local6.length() > 0){
_local4 = parseValue(_arg2, _local6);
};
} else {
if ((_arg1 is XMLList)){
_local6 = XMLList(_arg1).elements(_arg2);
if (_local6.length() > 0){
_local4 = parseValue(_arg2, _local6);
};
} else {
if ((_arg1 is ContentProxy)){
if (_local5 != null){
_arg2 = _local5.localName;
};
_local4 = ((_arg1 as ContentProxy).hasOwnProperty(_arg2)) ? _arg1[_arg2] : undefined;
} else {
if (!isSimpleValue(_arg1)){
_local4 = _arg1[_arg2];
};
};
};
};
return (_local4);
}
public function decodeComplexType(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null, _arg6:DecodingContext=null):void{
var _local9:XML;
if ((_arg2 is ContentProxy)){
ContentProxy(_arg2).object_proxy::isSimple = false;
};
var _local7:XMLList = _arg1.elements();
var _local8:XMLList = new XMLList();
if ((_arg4 is XML)){
_local8 = (_arg4 as XML).elements();
} else {
if ((_arg4 is XMLList)){
_local8 = _arg4;
};
};
for each (_local9 in _local7) {
if (_local9.name() == constants.simpleContentQName){
decodeSimpleContent(_local9, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local9.name() == constants.complexContentQName){
decodeComplexContent(_local9, _arg2, _arg3, _arg4, _arg6);
} else {
if (_local9.name() == constants.sequenceQName){
decodeSequence(_local9, _arg2, _arg3, _local8, _arg6);
} else {
if (_local9.name() == constants.groupQName){
decodeGroupReference(_local9, _arg2, _arg3, _local8, _arg6);
} else {
if (_local9.name() == constants.allQName){
decodeAll(_local9, _arg2, _arg3, _local8, _arg6);
} else {
if (_local9.name() == constants.choiceQName){
decodeChoice(_local9, _arg2, _arg3, _local8, _arg6);
} else {
if (_local9.name() == constants.attributeQName){
decodeAttribute(_local9, _arg2, _arg4, _arg5);
} else {
if (_local9.name() == constants.attributeGroupQName){
decodeAttributeGroup(_local9, _arg2, _arg4, _arg5);
} else {
if (_local9.name() == constants.anyAttributeQName){
decodeAnyAttribute(_local9, _arg2, _arg4, _arg5);
};
};
};
};
};
};
};
};
};
};
}
public function decodeChoice(_arg1:XML, _arg2, _arg3:QName, _arg4:XMLList, _arg5:DecodingContext=null, _arg6:Boolean=true):Boolean{
var _local10:Boolean;
var _local11:uint;
var _local12:uint;
var _local13:XML;
if (_arg5 == null){
_arg5 = new DecodingContext();
};
var _local7:uint = getMaxOccurs(_arg1);
var _local8:uint = getMinOccurs(_arg1);
if (_local7 == 0){
return (false);
};
if ((((_arg4 == null)) && ((_local8 == 0)))){
return (true);
};
var _local9:XMLList = _arg1.elements();
if (_local9.length() == 0){
return (true);
};
_local12 = 0;
while (_local12 < _local7) {
_local11 = (_arg5.index + 0);
_local10 = false;
for each (_local13 in _local9) {
if (_local13.name() == constants.elementTypeQName){
_local10 = ((_local10) || (decodeGroupElement(_local13, _arg2, _arg4, _arg5, false)));
if (_arg5.index > _local11){
break;
};
} else {
if (_local13.name() == constants.sequenceQName){
_local10 = ((_local10) || (decodeSequence(_local13, _arg2, _arg3, _arg4, _arg5, false)));
if (_arg5.index > _local11){
break;
};
} else {
if (_local13.name() == constants.groupQName){
_local10 = ((_local10) || (decodeGroupReference(_local13, _arg2, _arg3, _arg4, _arg5, false)));
if (_arg5.index > _local11){
break;
};
} else {
if (_local13.name() == constants.choiceQName){
_local10 = ((_local10) || (decodeChoice(_local13, _arg2, _arg3, _arg4, _arg5, false)));
if (_arg5.index > _local11){
break;
};
} else {
if (_local13.name() == constants.anyQName){
_local10 = ((_local10) || (decodeAnyElement(_local13, _arg2, _arg3, _arg4, _arg5, false)));
if (_arg5.index > _local11){
break;
};
};
};
};
};
};
};
if (!_local10){
break;
};
_local12++;
};
if (_local12 < _local8){
if (((_arg6) && (strictOccurenceBounds))){
throw (new Error((((((("Value supplied for choice " + _arg3.toString()) + " occurs ") + _local12) + " times which falls short of minOccurs ") + _local8) + ".")));
};
return (false);
};
return (true);
}
public function get recordXSIType():Boolean{
return (_recordXSIType);
}
public function set recordXSIType(_arg1:Boolean):void{
_recordXSIType = _arg1;
}
public function decodeType(_arg1:QName, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local6:*;
var _local7:XML;
var _local8:QName;
if (isBuiltInType(_arg1)){
_local6 = marshallBuiltInType(_arg1, _arg2, _arg3, _arg4, _arg5);
setValue(_arg2, _arg3, _local6, _arg1);
} else {
_local7 = schemaManager.getNamedDefinition(_arg1, constants.complexTypeQName, constants.simpleTypeQName);
if (_local7 == null){
throw (new Error((("Cannot find definition for type '" + _arg1) + "'")));
};
if (isXSINil(_arg4)){
setValue(_arg2, _arg3, null, _arg1);
return;
};
_local8 = (_local7.name() as QName);
if (_local8 == constants.complexTypeQName){
decodeComplexType(_local7, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local8 == constants.simpleTypeQName){
decodeSimpleType(_local7, _arg2, _arg3, _arg4, _arg5);
} else {
throw (new Error(("Invalid type definition " + _local8)));
};
};
schemaManager.releaseScope();
};
setXSIType(_arg2, _arg1);
}
protected function promoteValueToArray(_arg1, _arg2:Object=null){
var _local3:*;
if (!TypeIterator.isIterable(_arg1)){
_local3 = createIterableValue(_arg2);
TypeIterator.push(_local3, _arg1);
_arg1 = _local3;
};
return (_arg1);
}
public function decodeAttribute(_arg1:XML, _arg2, _arg3=undefined, _arg4:XML=null):void{
var _local5:QName;
var _local8:QName;
var _local9:String;
var _local10:*;
var _local11:String;
var _local12:XML;
var _local13:String;
var _local14:QName;
var _local15:*;
if (_arg1.attribute("ref").length() == 1){
_local5 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local5, constants.attributeQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve attribute definition for '" + _local5) + "'")));
};
};
var _local6:String = _arg1.@name.toString();
var _local7:String = _arg1.attribute("use").toString();
if (_local7 != "prohibited"){
_local8 = schemaManager.getQNameForAttribute(_local6, getAttributeFromNode("form", _arg1));
_local9 = getAttributeFromNode("fixed", _arg1);
if (_local9 != null){
_arg3 = _local9;
} else {
_arg3 = getAttribute(_arg3, _local8);
if (_arg3 === undefined){
_local11 = getAttributeFromNode("default", _arg1);
if (_local11 != null){
_arg3 = _local11;
};
};
};
if (_arg3 !== undefined){
_local10 = createContent();
_local13 = getAttributeFromNode("type", _arg1);
if (_local13 != null){
_local14 = schemaManager.getQNameForPrefixedName(_arg1.@type, _arg1);
} else {
_local14 = schemaManager.schemaDatatypes.anySimpleTypeQName;
};
if (_local14 != null){
if (isBuiltInType(_local14)){
_local15 = marshallBuiltInType(_local14, _local10, _local8, _arg3, _arg4);
setValue(_local10, _local8, _local15);
} else {
_local12 = schemaManager.getNamedDefinition(_local14, constants.simpleTypeQName);
if (_local12 != null){
decodeSimpleType(_local12, _local10, _local8, _arg3, _arg4);
} else {
throw (new Error(((("Cannot find simpleType " + _local14) + " for attribute ") + _local8)));
};
schemaManager.releaseScope();
};
} else {
_local12 = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
if (_local12 != null){
decodeSimpleType(_local12, _local10, _local8, _arg3, _arg4);
} else {
if (_arg3 != null){
_local10 = _arg3;
};
};
};
};
if (_local10 != null){
setAttribute(_arg2, _local8, _local10);
};
};
if (_local5 != null){
schemaManager.releaseScope();
};
}
protected function getApplicableValues(_arg1, _arg2:XMLList, _arg3:QName, _arg4:DecodingContext, _arg5:uint):XMLList{
var _local6:XMLList = new XMLList();
var _local7:uint = _arg4.index;
var _local8:Boolean;
if ((((_arg4.anyIndex > -1)) && (!((_arg3 == null))))){
_local7 = _arg4.anyIndex;
_local8 = true;
};
var _local9:uint = _local7;
while (_local9 < _arg2.length()) {
if (_local6.length() == _arg5){
break;
};
if ((((((_arg3 == null)) || ((_arg2[_local9].name() == _arg3)))) || ((((((_arg3.uri == "")) || ((_arg3.uri == null)))) && ((_arg3.localName == _arg2[_local9].name().localName)))))){
_local6 = (_local6 + _arg2[_local9]);
if (_local9 < _arg4.index){
_arg1[_arg3.localName] = null;
};
_local8 = false;
} else {
if (_local8 == false){
break;
};
};
_local9++;
};
return (_local6);
}
public function decodeAttributeGroup(_arg1:XML, _arg2, _arg3=undefined, _arg4:XML=null):void{
var _local5:QName;
var _local7:XML;
var _local8:XMLList;
var _local9:XML;
var _local10:XML;
if (_arg1.attribute("ref").length() == 1){
_local5 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local5, constants.attributeGroupQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve attributeGroup definition for '" + _local5) + "'")));
};
};
var _local6:XMLList = _arg1.elements(constants.attributeQName);
for each (_local7 in _local6) {
decodeAttribute(_local7, _arg2, _arg3, _arg4);
};
_local8 = _arg1.elements(constants.attributeGroupQName);
for each (_local9 in _local8) {
decodeAttributeGroup(_local9, _arg2, _arg3, _arg4);
};
_local10 = getSingleElementFromNode(_arg1, constants.anyAttributeQName);
if (_local10 != null){
decodeAnyAttribute(_local10, _arg2, _arg3, _arg4);
};
if (_local5 != null){
schemaManager.releaseScope();
};
}
public function decodeAll(_arg1:XML, _arg2, _arg3:QName, _arg4:XMLList, _arg5:DecodingContext=null, _arg6:Boolean=true):Boolean{
return (decodeSequence(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6));
}
public function isSimpleValue(_arg1):Boolean{
if ((_arg1 is XML)){
return (XML(_arg1).hasSimpleContent());
};
if ((((((((((((((_arg1 is String)) || ((_arg1 is Number)))) || ((_arg1 is Boolean)))) || ((_arg1 is Date)))) || ((_arg1 is int)))) || ((_arg1 is uint)))) || ((_arg1 is ByteArray)))){
return (true);
};
return (false);
}
public function decodeSequence(_arg1:XML, _arg2, _arg3:QName, _arg4:XMLList, _arg5:DecodingContext=null, _arg6:Boolean=true):Boolean{
var _local10:uint;
var _local12:Boolean;
var _local13:Boolean;
var _local14:uint;
var _local15:XML;
if (_arg5 == null){
_arg5 = new DecodingContext();
};
var _local7:uint = getMaxOccurs(_arg1);
var _local8:uint = getMinOccurs(_arg1);
if (_local7 == 0){
return (false);
};
if ((((((_arg4 == null)) || ((_arg4.length() == 0)))) && ((_local8 == 0)))){
return (true);
};
var _local9:XMLList = _arg1.elements();
var _local11:Boolean = (((_local9.length() > 1)) || (_arg5.hasContextSiblings));
if (_local9.length() == 0){
return (true);
};
_local10 = 0;
while (_local10 < _local7) {
_local12 = ((_arg6) && ((_local10 < _local8)));
_local13 = true;
_local14 = (_arg5.index + 0);
for each (_local15 in _local9) {
_local13 = false;
if (_local15.name() == constants.annotationQName){
_local13 = true;
};
if (_local15.name() == constants.elementTypeQName){
if (!decodeGroupElement(_local15, _arg2, _arg4, _arg5, _local12, _local11)){
break;
};
} else {
if (_local15.name() == constants.groupQName){
if (!decodeGroupReference(_local15, _arg2, _arg3, _arg4, _arg5, _local12)){
break;
};
} else {
if (_local15.name() == constants.choiceQName){
if (!decodeChoice(_local15, _arg2, _arg3, _arg4, _arg5, _local12)){
break;
};
} else {
if (_local15.name() == constants.sequenceQName){
if (!decodeSequence(_local15, _arg2, _arg3, _arg4, _arg5, _local12)){
break;
};
} else {
if (_local15.name() == constants.anyQName){
if (!decodeAnyElement(_local15, _arg2, _arg3, _arg4, _arg5, _local12)){
break;
};
};
};
};
};
};
_local13 = true;
};
if (((!(_local13)) && (_local12))){
if (strictOccurenceBounds){
throw (new Error((("Cannot find value for definition " + _local15.toXMLString()) + " in sequence.")));
};
return (false);
};
if (_local14 == _arg5.index){
if (_local13){
++_local10;
_local10 = ((_local10 > _local8)) ? _local10 : _local8;
};
break;
};
_local10++;
};
if (_local10 < _local8){
if (((_arg6) && (strictOccurenceBounds))){
throw (new Error((((((("Value supplied for sequence " + _arg3.toString()) + " occurs ") + _local10) + " times which falls short of minOccurs ") + _local8) + ".")));
};
return (false);
};
return (true);
}
public function setAttribute(_arg1, _arg2, _arg3):void{
var _local4:ContentProxy;
var _local5:*;
var _local6:SimpleContent;
if ((_arg1 is ContentProxy)){
_local4 = (_arg1 as ContentProxy);
if (_local4.object_proxy::isSimple){
_local5 = _local4.object_proxy::content;
if (!(_local5 is SimpleContent)){
_local6 = new SimpleContent(_local5);
_local4.object_proxy::content = _local6;
};
_local4.object_proxy::isSimple = false;
};
};
setValue(_arg1, _arg2, _arg3);
}
public function createContent(_arg1:QName=null){
var c:Class;
var className:String;
var type = _arg1;
var content:* = undefined;
if (((!((type == null))) && (!((typeRegistry == null))))){
c = typeRegistry.getClass(type);
if (c == null){
c = typeRegistry.getCollectionClass(type);
};
if (c != null){
try {
content = new (c);
} catch(e:Error) {
className = getQualifiedClassName(c);
log.debug("Unable to create new instance of Class '{0}' for type '{1}'.", className, type);
};
};
};
return (new ContentProxy(content, makeObjectsBindable));
}
override public function reset():void{
super.reset();
document = null;
}
public function getAttribute(_arg1, _arg2){
var _local3:*;
var _local4:XMLList;
if ((_arg1 is XML)){
_local4 = XML(_arg1).attribute(_arg2);
_local3 = parseValue(_arg2, _local4);
} else {
if ((_arg1 is XMLList)){
_local4 = XMLList(_arg1).attribute(_arg2);
_local3 = parseValue(_arg2, _local4);
};
};
return (_local3);
}
public function decodeSimpleRestriction(_arg1:XML, _arg2, _arg3:QName, _arg4):void{
var _local6:String;
var _local7:QName;
var _local5:XML = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
if (_local5 != null){
decodeSimpleType(_local5, _arg2, _arg3, _arg4, _arg1);
} else {
_local6 = getAttributeFromNode("base", _arg1);
_local7 = schemaManager.getQNameForPrefixedName(_local6, _arg1);
decodeType(_local7, _arg2, _arg3, _arg4, _arg1);
};
}
protected function setXSIType(_arg1, _arg2:QName):void{
if (((!((_arg1 == null))) && (recordXSIType))){
if ((_arg1 is ContentProxy)){
_arg1 = _arg1.object_proxy::content;
};
if (_arg1 != null){
if ((_arg1 is ObjectProxy)){
ObjectProxy(_arg1).object_proxy::type = _arg2;
} else {
if ((_arg1 is IXMLSchemaInstance)){
IXMLSchemaInstance(_arg1).xsiType = _arg2;
};
};
};
};
}
public function decodeSimpleUnion(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local8:QName;
var _local9:*;
var _local12:String;
var _local13:QName;
var _local6:String = getAttributeFromNode("memberTypes", _arg1);
var _local7:Array = _local6.split(" ");
var _local10:int;
while (_local10 < _local7.length) {
_local12 = _local7[_local10];
_local13 = schemaManager.getQNameForPrefixedName(_local12, _arg1);
if (!isBuiltInType(_local13)){
_local9 = getValue(_arg4, _local13);
if (_local9 !== undefined){
_local8 = _local13;
break;
};
};
_local10++;
};
if (!_local8){
_local8 = schemaManager.schemaDatatypes.stringQName;
};
var _local11:* = marshallBuiltInType(_local8, _arg2, _arg3, _arg4, _arg5);
setValue(_arg2, _arg3, _local11, _local8);
}
protected function getExistingValue(_arg1, _arg2:String){
var existingValue:*;
var classInfo:XML;
var properties:XMLList;
var property:XML;
var propertyType:String;
var tempValue:*;
var parent = _arg1;
var propertyName = _arg2;
var object:Object = Object(parent);
if ((parent is ContentProxy)){
object = ContentProxy(parent).object_proxy::content;
};
if ((object is ObjectProxy)){
object = ObjectProxy(object).object_proxy::object;
};
var className:String = getQualifiedClassName(object);
if (className == "Object"){
existingValue = parent[propertyName];
} else {
classInfo = DescribeTypeCache.describeType(object).typeDescription;
properties = (classInfo..accessor.(((@access == "readwrite")) && ((@name == propertyName))) + classInfo..variable.(@name == propertyName));
if (properties.length() > 0){
property = properties[0];
propertyType = property.@type;
tempValue = parent[propertyName];
if ((((((propertyType == "Object")) || ((propertyType == "*")))) || (TypeIterator.isIterable(existingValue)))){
existingValue = tempValue;
};
};
};
return (existingValue);
}
protected function getXSIType(_arg1):QName{
var _local2:QName;
var _local3:XML;
var _local4:String;
if ((_arg1 is XML)){
_local3 = (_arg1 as XML);
} else {
if ((((_arg1 is XMLList)) && ((_arg1.length() == 1)))){
_local3 = _arg1[0];
};
};
if (_local3 != null){
_local4 = XMLUtil.getAttributeByQName(_local3, constants.typeAttrQName).toString();
if (((!((_local4 == null))) && (!((_local4 == ""))))){
_local2 = schemaManager.getQNameForPrefixedName(_local4, _local3);
};
};
return (_local2);
}
public function decode(_arg1, _arg2:QName=null, _arg3:QName=null, _arg4:XML=null){
var content:*;
var elementDefinition:XML;
var xml = _arg1;
var name = _arg2;
var type = _arg3;
var definition = _arg4;
if (((((!((xml is XML))) && (!((xml is XMLList))))) && (!((xml is String))))){
throw (new ArgumentError("The xml argument must be of type XML, XMLList or String."));
};
if ((xml is XML)){
document = xml;
} else {
if ((xml is XMLList)){
if (XMLList(xml).length() != 1){
throw (new ArgumentError("The xml argument must have a length of 1 when passed as an XMLList."));
};
document = XMLList(xml)[0];
} else {
if ((xml is String)){
try {
document = new XML(xml);
} catch(e:Error) {
throw (new ArgumentError(("The xml argument does not contain valid xml. " + xml)));
};
};
};
};
preProcessXML(document);
if (type != null){
content = createContent(type);
decodeType(type, content, name, document);
} else {
elementDefinition = definition;
if (elementDefinition == null){
elementDefinition = schemaManager.getNamedDefinition(name, constants.elementTypeQName);
};
if (elementDefinition == null){
content = createContent(type);
decodeType(constants.anyTypeQName, content, name, document);
} else {
content = decodeElementTopLevel(elementDefinition, name, document);
if (definition == null){
schemaManager.releaseScope();
};
};
};
if ((content is ContentProxy)){
content = ContentProxy(content).object_proxy::content;
};
return (content);
}
public function hasValue(_arg1, _arg2):Boolean{
return (!((getValue(_arg1, _arg2) === undefined)));
}
public function decodeAnyType(_arg1, _arg2:QName, _arg3:XMLList):void{
var _local4:XML;
var _local5:QName;
var _local6:*;
var _local7:QName;
for each (_local4 in _arg3) {
_local5 = (_local4.name() as QName);
_local7 = getXSIType(_local4);
if (_local7 != null){
_local6 = createContent();
decodeType(schemaManager.schemaDatatypes.anyTypeQName, _local6, _local5, _local4);
} else {
_local6 = marshallBuiltInType(schemaManager.schemaDatatypes.anyTypeQName, _arg1, _local5, _local4);
};
setValue(_arg1, _local5, _local6, _local7);
};
}
public function set makeObjectsBindable(_arg1:Boolean):void{
_makeObjectsBindable = _arg1;
}
public function decodeComplexExtension(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:DecodingContext=null):void{
var _local11:XML;
if (_arg5 == null){
_arg5 = new DecodingContext();
};
_arg5.hasContextSiblings = true;
var _local6:String = getAttributeFromNode("base", _arg1);
if (_local6 == null){
throw (new Error("A complexContent extension must declare a base type."));
};
var _local7:QName = schemaManager.getQNameForPrefixedName(_local6, _arg1);
var _local8:XML = schemaManager.getNamedDefinition(_local7, constants.complexTypeQName);
if (_local8 == null){
throw (new Error((("Cannot find base type definition '" + _local7) + "'")));
};
decodeComplexType(_local8, _arg2, _arg3, _arg4, null, _arg5);
schemaManager.releaseScope();
var _local9:XMLList = _arg1.elements();
var _local10:XMLList = new XMLList();
if ((_arg4 is XML)){
_local10 = (_arg4 as XML).elements();
} else {
if ((_arg4 is XMLList)){
_local10 = _arg4;
};
};
for each (_local11 in _local9) {
if (_local11.name() == constants.sequenceQName){
decodeSequence(_local11, _arg2, _arg3, _local10, _arg5);
} else {
if (_local11.name() == constants.groupQName){
decodeGroupReference(_local11, _arg2, _arg3, _local10, _arg5);
} else {
if (_local11.name() == constants.allQName){
decodeAll(_local11, _arg2, _arg3, _local10, _arg5);
} else {
if (_local11.name() == constants.choiceQName){
decodeChoice(_local11, _arg2, _arg3, _local10, _arg5);
} else {
if (_local11.name() == constants.attributeQName){
decodeAttribute(_local11, _arg2, _arg4);
} else {
if (_local11.name() == constants.attributeGroupQName){
decodeAttributeGroup(_local11, _arg2, _arg4);
} else {
if (_local11.name() == constants.anyAttributeQName){
decodeAnyAttribute(_local11, _arg2, _arg4);
};
};
};
};
};
};
};
};
}
public function decodeSimpleList(_arg1:XML, _arg2, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local7:QName;
var _local8:XML;
var _local11:*;
var _local12:*;
var _local13:String;
var _local6:String = _arg1.@itemType;
if (_local6 != ""){
_local7 = schemaManager.getQNameForPrefixedName(_local6, _arg1);
} else {
_local8 = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
};
var _local9 = "";
if (!TypeIterator.isIterable(_arg4)){
_arg4 = [_arg4];
};
var _local10:TypeIterator = new TypeIterator(_arg4);
while (_local10.hasNext()) {
_local11 = _local10.next();
_local12 = createContent();
if (_local7 != null){
decodeType(_local7, _local12, _arg3, _local11, _arg5);
} else {
decodeSimpleType(_local8, _local12, _arg3, _local11, _arg5);
};
_local13 = ((_local12)!=null) ? _local12.toString() : "";
_local9 = _local9.concat(_local13);
if (_local10.hasNext()){
_local9 = _local9.concat(" ");
};
};
setValue(_arg2, _arg3, _local9, _local7);
}
}
}//package mx.rpc.xml
Section 179
//XMLEncoder (mx.rpc.xml.XMLEncoder)
package mx.rpc.xml {
import flash.utils.*;
import mx.collections.*;
import mx.utils.*;
public class XMLEncoder extends SchemaProcessor implements IXMLEncoder {
private var _xmlSpecialCharsFilter:Function;
public function XMLEncoder(){
_xmlSpecialCharsFilter = escapeXML;
super();
}
protected function getXSIType(_arg1):QName{
var _local2:QName;
if (_arg1 != null){
if ((((_arg1 is ObjectProxy)) && (!((_arg1.object_proxy::type == null))))){
_local2 = _arg1.object_proxy::type;
} else {
if ((((_arg1 is IXMLSchemaInstance)) && (!((IXMLSchemaInstance(_arg1).xsiType == null))))){
_local2 = IXMLSchemaInstance(_arg1).xsiType;
};
};
};
return (_local2);
}
public function encodeGroupReference(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true):Boolean{
var _local6:QName;
var _local9:XML;
if (_arg1.attribute("ref").length() == 1){
_local6 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local6, constants.groupQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve group definition for '" + _local6) + "'")));
};
} else {
throw (new Error("A group reference element must have the ref attribute"));
};
var _local7:XMLList = _arg1.elements();
var _local8:Boolean;
for each (_local9 in _local7) {
if (_local9.name() == constants.sequenceQName){
_local8 = encodeSequence(_local9, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local9.name() == constants.allQName){
_local8 = encodeAll(_local9, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local9.name() == constants.choiceQName){
_local8 = encodeChoice(_local9, _arg2, _arg3, _arg4, _arg5);
};
};
};
};
schemaManager.releaseScope();
return (_local8);
}
public function encodeSimpleRestriction(_arg1:XML, _arg2:XML, _arg3:QName, _arg4):void{
var _local6:String;
var _local7:QName;
var _local5:XML = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
if (_local5 != null){
encodeSimpleType(_local5, _arg2, _arg3, _arg4, _arg1);
} else {
_local6 = getAttributeFromNode("base", _arg1);
_local7 = schemaManager.getQNameForPrefixedName(_local6, _arg1);
encodeType(_local7, _arg2, _arg3, _arg4, _arg1);
};
}
public function encodeAnyAttribute(_arg1:XML, _arg2:XML, _arg3:QName, _arg4=undefined, _arg5:XML=null):void{
var _local6:Object;
var _local7:*;
if (_arg4 !== undefined){
if (((!(isSimpleValue(_arg4))) && (!((_arg4 is Array))))){
for (_local6 in getProperties(_arg4)) {
if (((!(hasAttribute(_arg4, _local6))) && (!(hasValue(_arg4, _local6))))){
_local7 = getAttribute(_arg4, _local6);
if (_local7 != null){
setAttribute(_arg2, _local6, _local7);
};
};
};
};
};
}
public function encodeSimpleUnion(_arg1:XML, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local8:QName;
var _local9:*;
var _local11:String;
var _local12:QName;
var _local6:String = getAttributeFromNode("memberTypes", _arg1);
var _local7:Array = _local6.split(" ");
var _local10:int;
while (_local10 < _local7.length) {
_local11 = _local7[_local10];
_local12 = schemaManager.getQNameForPrefixedName(_local11, _arg1);
if (!isBuiltInType(_local12)){
_local9 = getValue(_arg4, _local12);
if (_local9 !== undefined){
_local8 = _local12;
break;
};
};
_local10++;
};
if (!_local8){
_local8 = schemaManager.schemaDatatypes.stringQName;
};
setValue(_arg2, schemaManager.marshall(_arg4, _local8, _arg5));
}
protected function setXSIType(_arg1:XML, _arg2:QName):void{
var _local3:String = _arg2.uri;
var _local4:String = schemaManager.getOrCreatePrefix(_local3);
var _local5:Namespace = new Namespace(_local4, _local3);
_arg1.addNamespace(_local5);
_arg1.@[constants.getXSIToken(constants.typeAttrQName)] = ((_local4 + ":") + _arg2.localName);
}
public function encodeSimpleType(_arg1:XML, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local6:XML = getSingleElementFromNode(_arg1, constants.restrictionQName, constants.listQName, constants.unionQName);
if (_local6.name() == constants.restrictionQName){
encodeSimpleRestriction(_local6, _arg2, _arg3, _arg4);
} else {
if (_local6.name() == constants.listQName){
encodeSimpleList(_local6, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local6.name() == constants.listQName){
encodeSimpleUnion(_local6, _arg2, _arg3, _arg4, _arg5);
};
};
};
}
public function get xmlSpecialCharsFilter():Function{
return (_xmlSpecialCharsFilter);
}
protected function deriveXSIType(_arg1:XML, _arg2:QName, _arg3):void{
}
public function set xmlSpecialCharsFilter(_arg1:Function):void{
if (_arg1 != null){
_xmlSpecialCharsFilter = _arg1;
} else {
_xmlSpecialCharsFilter = escapeXML;
};
}
public function encodeComplexType(_arg1:XML, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local8:XML;
var _local6:XMLList = _arg1.elements();
var _local7:XMLList = new XMLList();
for each (_local8 in _local6) {
if (_local8.name() == constants.sequenceQName){
encodeSequence(_local8, _local7, _arg3, _arg4);
} else {
if (_local8.name() == constants.simpleContentQName){
encodeSimpleContent(_local8, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local8.name() == constants.complexContentQName){
encodeComplexContent(_local8, _arg2, _arg3, _arg4);
} else {
if (_local8.name() == constants.groupQName){
encodeGroupReference(_local8, _local7, _arg3, _arg4);
} else {
if (_local8.name() == constants.allQName){
encodeAll(_local8, _local7, _arg3, _arg4);
} else {
if (_local8.name() == constants.choiceQName){
encodeChoice(_local8, _local7, _arg3, _arg4);
} else {
if (_local8.name() == constants.attributeQName){
encodeAttribute(_local8, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local8.name() == constants.attributeGroupQName){
encodeAttributeGroup(_local8, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local8.name() == constants.anyAttributeQName){
encodeAnyAttribute(_local8, _arg2, _arg3, _arg4, _arg5);
};
};
};
};
};
};
};
};
};
};
setValue(_arg2, _local7);
}
public function encodeElementTopLevel(_arg1:XML, _arg2:QName, _arg3):XML{
var _local6:QName;
var _local7:XML;
var _local4:XML = encodeXSINil(_arg1, _arg2, _arg3);
if (_local4 != null){
return (_local4);
};
if (_arg3 == null){
return (null);
};
_local4 = createElement(_arg2);
var _local5:String = getAttributeFromNode("type", _arg1);
if (_local5 != null){
_local6 = schemaManager.getQNameForPrefixedName(_local5, _arg1);
encodeType(_local6, _local4, _arg2, _arg3);
} else {
if (((!((_arg1 == null))) && (_arg1.hasComplexContent()))){
_local7 = getSingleElementFromNode(_arg1, constants.complexTypeQName, constants.simpleTypeQName);
if (_local7.name() == constants.complexTypeQName){
encodeComplexType(_local7, _local4, _arg2, _arg3);
} else {
if (_local7.name() == constants.simpleTypeQName){
encodeSimpleType(_local7, _local4, _arg2, _arg3);
};
};
} else {
encodeType(constants.anyTypeQName, _local4, _arg2, _arg3);
};
};
return (_local4);
}
public function encode(_arg1, _arg2:QName=null, _arg3:QName=null, _arg4:XML=null):XMLList{
var _local6:XML;
var _local7:XML;
var _local8:Boolean;
var _local5:XMLList = new XMLList();
if (_arg2 == null){
_arg2 = new QName("", "root");
};
if (_arg3 != null){
_local6 = encodeXSINil(null, _arg2, _arg1);
if (_local6 == null){
_local6 = createElement(_arg2);
if (_arg1 == null){
setValue(_local6, null);
} else {
encodeType(_arg3, _local6, _arg2, _arg1);
};
};
} else {
_local7 = _arg4;
_local8 = false;
if (_local7 == null){
_local7 = schemaManager.getNamedDefinition(_arg2, constants.elementTypeQName);
if (_local7 != null){
_local8 = true;
};
};
_local6 = encodeElementTopLevel(_local7, _arg2, _arg1);
if (_local8){
schemaManager.releaseScope();
};
};
if (_local6 != null){
_local5 = (_local5 + _local6);
};
return (_local5);
}
public function encodeChoice(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true):Boolean{
var _local10:uint;
var _local11:uint;
var _local12:XML;
var _local6:uint = getMaxOccurs(_arg1);
var _local7:uint = getMinOccurs(_arg1);
if (_local6 == 0){
return (false);
};
if ((((_arg4 == null)) && ((_local7 == 0)))){
return (true);
};
var _local8:XMLList = _arg1.elements();
var _local9:Boolean;
if (_local8.length() > 0){
_local9 = false;
};
for each (_local12 in _local8) {
if (_local12.name() == constants.elementTypeQName){
_local9 = ((encodeGroupElement(_local12, _arg2, _arg3, _arg4, false)) || (_local9));
} else {
if (_local12.name() == constants.sequenceQName){
_local9 = ((encodeSequence(_local12, _arg2, _arg3, _arg4, false)) || (_local9));
} else {
if (_local12.name() == constants.groupQName){
_local9 = ((encodeGroupReference(_local12, _arg2, _arg3, _arg4, false)) || (_local9));
} else {
if (_local12.name() == constants.choiceQName){
_local9 = ((encodeChoice(_local12, _arg2, _arg3, _arg4, false)) || (_local9));
} else {
if (_local12.name() == constants.anyQName){
_local9 = ((encodeAnyElement(_local12, _arg2, _arg3, _arg4, false)) || (_local9));
};
};
};
};
};
};
return (_local9);
}
public function encodeXSINil(_arg1:XML, _arg2:QName, _arg3, _arg4:Boolean=true):XML{
var _local7:XML;
var _local5:Boolean;
var _local6:Boolean;
if (_local5){
if (_arg1 != null){
_local6 = ((_arg1.@nillable.toString() == "true")) ? true : false;
} else {
_local6 = false;
};
};
var _local8:String = getAttributeFromNode("fixed", _arg1);
if (((!(((_local5) && (_local6)))) && (!((_local8 == null))))){
_local7 = createElement(_arg2);
setValue(_local7, schemaManager.marshall(_local8, schemaManager.schemaDatatypes.stringQName));
return (_local7);
};
if (_arg3 != null){
return (null);
};
var _local9:String = getAttributeFromNode("default", _arg1);
if ((((_arg3 == null)) && (!((_local9 == null))))){
_local7 = createElement(_arg2);
setValue(_local7, schemaManager.marshall(_local9, schemaManager.schemaDatatypes.stringQName));
return (_local7);
};
if (((((_local6) && ((_arg3 === null)))) && ((_arg4 == true)))){
_local7 = createElement(_arg2);
setValue(_local7, null);
return (_local7);
};
return (null);
}
public function setAttribute(_arg1:XML, _arg2, _arg3):void{
if (_arg3 != null){
_arg1.@[_arg2] = _arg3.toString();
};
}
public function resolveNamedProperty(_arg1, _arg2){
var value:*;
var parent = _arg1;
var name = _arg2;
var fallbackName:String;
if (!isSimpleValue(parent)){
try {
value = parent[name];
if (value === undefined){
fallbackName = ("_" + name.toString());
};
} catch(e:Error) {
fallbackName = ("_" + name.toString());
};
if (((!((fallbackName == null))) && (parent.hasOwnProperty(fallbackName)))){
value = parent[fallbackName];
};
};
return (value);
}
public function isSimpleValue(_arg1):Boolean{
if ((((((((((((((_arg1 is String)) || ((_arg1 is Number)))) || ((_arg1 is Boolean)))) || ((_arg1 is Date)))) || ((_arg1 is int)))) || ((_arg1 is uint)))) || ((_arg1 is ByteArray)))){
return (true);
};
return (false);
}
public function encodeComplexContent(_arg1:XML, _arg2:XML, _arg3:QName, _arg4):void{
var _local5:XML = getSingleElementFromNode(_arg1, constants.extensionQName, constants.restrictionQName);
if (_local5.name() == constants.extensionQName){
encodeComplexExtension(_local5, _arg2, _arg3, _arg4);
} else {
if (_local5.name() == constants.restrictionQName){
encodeComplexRestriction(_local5, _arg2, _arg3, _arg4);
};
};
}
public function createElement(_arg1):XML{
var _local2:XML;
var _local3:QName;
var _local4:String;
var _local5:Namespace;
if ((_arg1 is QName)){
_local3 = (_arg1 as QName);
} else {
_local3 = new QName("", _arg1.toString());
};
_local2 = new XML((("<" + _local3.localName) + "/>"));
if (((!((_local3.uri == null))) && ((_local3.uri.length > 0)))){
_local4 = schemaManager.getOrCreatePrefix(_local3.uri);
_local5 = new Namespace(_local4, _local3.uri);
_local2.setNamespace(_local5);
};
return (_local2);
}
public function hasAttribute(_arg1, _arg2):Boolean{
return (!((getAttribute(_arg1, _arg2) === undefined)));
}
public function containsNodeByName(_arg1:XMLList, _arg2:QName, _arg3:Boolean=false):Boolean{
var _local5:XML;
var _local4:String = schemaManager.currentSchema.targetNamespace.uri;
for each (_local5 in _arg1) {
if (((_arg3) || (((!((_arg2.uri == ""))) && (!((_arg2.uri == null))))))){
if ((((_local5.name().uri == "")) && ((_local4 == _arg2.uri)))){
if (_local5.name().localName == _arg2.localName){
return (true);
};
} else {
if (_local5.name() == _arg2){
return (true);
};
};
} else {
if (_local5.name().localName == _arg2.localName){
return (true);
};
};
};
return (false);
}
public function hasValue(_arg1, _arg2):Boolean{
return (!((getValue(_arg1, _arg2) === undefined)));
}
public function encodeComplexExtension(_arg1:XML, _arg2:XML, _arg3:QName, _arg4):void{
var _local10:XML;
var _local11:XML;
var _local5:String = getAttributeFromNode("base", _arg1);
if (_local5 == null){
throw (new Error("A complexContent extension must declare a base type."));
};
var _local6:QName = schemaManager.getQNameForPrefixedName(_local5, _arg1);
var _local7:XML = schemaManager.getNamedDefinition(_local6, constants.complexTypeQName);
if (_local7 == null){
throw (new Error((("Cannot find base type definition '" + _local6) + "'")));
};
encodeComplexType(_local7, _arg2, _arg3, _arg4);
schemaManager.releaseScope();
var _local8:XMLList = _arg1.elements();
var _local9:XMLList = new XMLList();
for each (_local10 in _local8) {
if (_local10.name() == constants.sequenceQName){
encodeSequence(_local10, _local9, _arg3, _arg4);
} else {
if (_local10.name() == constants.groupQName){
encodeGroupReference(_local10, _local9, _arg3, _arg4);
} else {
if (_local10.name() == constants.allQName){
encodeAll(_local10, _local9, _arg3, _arg4);
} else {
if (_local10.name() == constants.choiceQName){
encodeChoice(_local10, _local9, _arg3, _arg4);
} else {
if (_local10.name() == constants.attributeQName){
encodeAttribute(_local10, _arg2, _arg3, _arg4);
} else {
if (_local10.name() == constants.attributeGroupQName){
encodeAttributeGroup(_local10, _arg2, _arg3, _arg4);
} else {
if (_local10.name() == constants.anyAttributeQName){
encodeAnyAttribute(_local10, _arg2, _arg3, _arg4);
};
};
};
};
};
};
};
};
for each (_local11 in _local9) {
delete _arg2[_local11.name()];
delete _arg2[new QName("", _local11.name().localName)];
delete _arg2[new QName(null, _local11.name().localName)];
};
setValue(_arg2, _local9);
}
public function encodeSimpleList(_arg1:XML, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local7:QName;
var _local8:XML;
var _local11:*;
var _local12:*;
var _local6:String = _arg1.@itemType;
if (_local6 != ""){
_local7 = schemaManager.getQNameForPrefixedName(_local6, _arg1);
} else {
_local8 = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
};
var _local9 = "";
if (!TypeIterator.isIterable(_arg4)){
_arg4 = [_arg4];
};
var _local10:TypeIterator = new TypeIterator(_arg4);
while (_local10.hasNext()) {
_local11 = _local10.next();
_local12 = <temp/>
;
if (_local11 == null){
} else {
if (_local7 != null){
encodeType(_local7, _local12, _arg3, _local11, _arg5);
} else {
encodeSimpleType(_local8, _local12, _arg3, _local11, _arg5);
};
_local9 = _local9.concat(_local12.toString());
if (_local10.hasNext()){
_local9 = _local9.concat(" ");
};
};
};
setValue(_arg2, _local9);
}
public function getProperties(_arg1):Array{
var _local2:Object = ObjectUtil.getClassInfo((_arg1 as Object), null, {includeReadOnly:false});
return (_local2.properties);
}
public function encodeAll(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true):Boolean{
return (encodeSequence(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public function encodeAttribute(_arg1:XML, _arg2:XML, _arg3:QName, _arg4=undefined, _arg5:XML=null):void{
var _local6:QName;
var _local9:QName;
var _local10:String;
var _local11:*;
var _local12:Boolean;
var _local13:String;
var _local14:XML;
var _local15:String;
var _local16:QName;
if (_arg1.attribute("ref").length() == 1){
_local6 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local6, constants.attributeQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve attribute definition for '" + _local6) + "'")));
};
};
var _local7:String = _arg1.@name.toString();
var _local8:String = _arg1.attribute("use").toString();
if (_local8 != "prohibited"){
_local9 = schemaManager.getQNameForAttribute(_local7, getAttributeFromNode("form", _arg1));
_local10 = getAttributeFromNode("fixed", _arg1);
if (_local10 != null){
_arg4 = _local10;
} else {
_arg4 = getValue(_arg4, _local9);
if (_arg4 === undefined){
_local13 = getAttributeFromNode("default", _arg1);
if (_local13 != null){
_arg4 = _local13;
};
};
};
if (_arg4 !== undefined){
_local11 = <temp/>
;
_local15 = getAttributeFromNode("type", _arg1);
if (_local15 != null){
_local16 = schemaManager.getQNameForPrefixedName(_arg1.@type, _arg1);
} else {
_local16 = schemaManager.schemaDatatypes.anySimpleTypeQName;
};
if (_local16 != null){
if (isBuiltInType(_local16)){
_local11.appendChild(schemaManager.marshall(_arg4, _local16, _arg5));
} else {
_local14 = schemaManager.getNamedDefinition(_local16, constants.simpleTypeQName);
if (_local14 != null){
encodeSimpleType(_local14, _local11, _local9, _arg4, _arg5);
} else {
throw (new Error(((("Cannot find simpleType " + _local16) + " for attribute ") + _local9)));
};
schemaManager.releaseScope();
};
} else {
_local14 = getSingleElementFromNode(_arg1, constants.simpleTypeQName);
if (_local14 != null){
encodeSimpleType(_local14, _local11, _local9, _arg4, _arg5);
} else {
if (_arg4 != null){
_local11.appendChild(_arg4.toString());
};
};
};
};
if (_local11 !== undefined){
setAttribute(_arg2, _local9, _local11);
};
};
if (_local6 != null){
schemaManager.releaseScope();
};
}
private function escapeXML(_arg1:Object):String{
var _local2:String = _arg1.toString();
_local2 = _local2.replace(/&/g, "&").replace(/</g, "<");
return (_local2);
}
public function setValue(_arg1, _arg2):void{
var _local3:XML;
if (_arg2 !== undefined){
if ((_arg1 is XML)){
_local3 = (_arg1 as XML);
} else {
if ((((_arg1 is XMLList)) && ((_arg1.length() > 0)))){
_local3 = _arg1[(_arg1.length() - 1)];
};
};
if (_local3 != null){
if (_arg2 === null){
_local3.@[schemaManager.schemaConstants.nilQName] = "true";
_local3.addNamespace(constants.xsiNamespace);
} else {
if ((((_arg2 is XML)) || ((_arg2 is XMLList)))){
_local3.appendChild(_arg2);
} else {
if (_arg2 !== undefined){
_local3.appendChild(xmlSpecialCharsFilter(Object(_arg2)));
};
};
};
};
};
}
public function encodeType(_arg1:QName, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local8:XMLList;
var _local9:QName;
var _local6:QName = getXSIType(_arg4);
if (_local6 != null){
_arg1 = _local6;
};
var _local7:XML = schemaManager.getNamedDefinition(_arg1, constants.complexTypeQName, constants.simpleTypeQName);
if (isBuiltInType(_arg1)){
if ((((_arg1 == constants.anyTypeQName)) && (!(isSimpleValue(_arg4))))){
_local8 = new XMLList();
encodeAnyElement(_local7, _local8, _arg3, _arg4);
setValue(_arg2, _local8);
} else {
setValue(_arg2, schemaManager.marshall(_arg4, _arg1, _arg5));
};
deriveXSIType(_arg2, _arg1, _arg4);
} else {
if (_local7 == null){
throw (new Error((("Cannot find definition for type '" + _arg1) + "'")));
};
_local9 = (_local7.name() as QName);
if (_local9 == constants.complexTypeQName){
encodeComplexType(_local7, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local9 == constants.simpleTypeQName){
encodeSimpleType(_local7, _arg2, _arg3, _arg4, _arg5);
} else {
throw (new Error(("Invalid type definition " + _local9)));
};
};
};
if (_local7 != null){
schemaManager.releaseScope();
};
}
public function encodeSimpleContent(_arg1:XML, _arg2:XML, _arg3:QName, _arg4, _arg5:XML=null):void{
var _local7:String;
var _local8:QName;
var _local9:*;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
var _local6:XML = getSingleElementFromNode(_arg1, constants.extensionQName, constants.restrictionQName);
if (_local6 != null){
_local7 = getAttributeFromNode("base", _local6);
if (_local7 == null){
throw (new Error("A simpleContent extension or restriction must declare a base type."));
};
_local8 = schemaManager.getQNameForPrefixedName(_local7, _local6);
if (!isBuiltInType(_local8)){
_local10 = schemaManager.getNamedDefinition(_local8, constants.complexTypeQName, constants.simpleTypeQName);
if (_local10 == null){
throw (new Error((("Cannot find base type definition '" + _local8) + "'")));
};
schemaManager.releaseScope();
};
if (_local6.name() == constants.extensionQName){
if (isBuiltInType(_local8)){
_local9 = getSimpleValue(_arg4, _arg3);
setValue(_arg2, schemaManager.marshall(_local9, _local8, _arg5));
} else {
encodeType(_local8, _arg2, _arg4, _arg5);
};
_local11 = _local6.elements();
for each (_local12 in _local11) {
if (_local12.name() == constants.attributeQName){
encodeAttribute(_local12, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local12.name() == constants.attributeGroupQName){
encodeAttributeGroup(_local12, _arg2, _arg3, _arg4, _arg5);
} else {
if (_local12.name() == constants.anyAttributeQName){
encodeAnyAttribute(_local12, _arg2, _arg3, _arg4, _arg5);
};
};
};
};
} else {
if (_local6.name() == constants.restrictionQName){
_local9 = getSimpleValue(_arg4, _arg3);
encodeSimpleRestriction(_local6, _arg2, _arg3, _local9);
};
};
};
}
public function encodeComplexRestriction(_arg1:XML, _arg2:XML, _arg3:QName, _arg4):void{
var _local9:XML;
var _local5:String = getAttributeFromNode("base", _arg1);
if (_local5 == null){
throw (new Error("A complexContent restriction must declare a base type."));
};
var _local6:QName = schemaManager.getQNameForPrefixedName(_local5, _arg1);
var _local7:XMLList = _arg1.elements();
var _local8:XMLList = _arg2.elements();
for each (_local9 in _local7) {
if (_local9.name() == constants.sequenceQName){
encodeSequence(_local9, _local8, _arg3, _arg4);
} else {
if (_local9.name() == constants.groupQName){
encodeGroupReference(_local9, _local8, _arg3, _arg4);
} else {
if (_local9.name() == constants.allQName){
encodeAll(_local9, _local8, _arg3, _arg4);
} else {
if (_local9.name() == constants.choiceQName){
encodeChoice(_local9, _local8, _arg3, _arg4);
} else {
if (_local9.name() == constants.attributeQName){
encodeAttribute(_local9, _arg2, _arg3, _arg4, _arg1);
} else {
if (_local9.name() == constants.attributeGroupQName){
encodeAttributeGroup(_local9, _arg2, _arg3, _arg4, _arg1);
} else {
if (_local9.name() == constants.anyAttributeQName){
encodeAnyAttribute(_local9, _arg2, _arg3, _arg4, _arg1);
};
};
};
};
};
};
};
};
_arg2.setChildren(_local8);
}
public function encodeAnyElement(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true, _arg6:Dictionary=null):Boolean{
var _local9:XML;
var _local10:*;
var _local11:*;
var _local12:XMLList;
var _local13:Object;
var _local14:*;
var _local15:QName;
var _local16:XML;
var _local17:XMLList;
var _local7:uint = getMaxOccurs(_arg1);
var _local8:uint = getMinOccurs(_arg1);
if (isSimpleValue(_arg4)){
_local9 = createElement(_arg3);
setValue(_local9, _arg4);
appendValue(_arg2, _local9);
} else {
if ((((_arg4 is XML)) || ((_arg4 is XMLList)))){
appendValue(_arg2, _arg4);
} else {
if (_arg6 == null){
_arg6 = new Dictionary(true);
};
if (!(_arg4 is QName)){
if (_arg6[_arg4] != null){
throw (new Error("Cannot encode complex structure. Cyclic references detected."));
};
_arg6[_arg4] = true;
};
if ((((_arg4 is Array)) || ((_arg4 is IList)))){
if ((_arg4 is IList)){
_arg4 = IList(_arg4).toArray();
};
for each (_local10 in (_arg4 as Array)) {
_local11 = createElement(_arg3);
if (_local10 == null){
setValue(_local11, null);
} else {
if (_local10 != null){
_local12 = new XMLList();
encodeAnyElement(_arg1, _local12, _arg3, _local10, _arg5, _arg6);
if (isSimpleValue(_local10)){
_local11 = _local12[0];
} else {
setValue(_local11, _local12);
};
};
};
appendValue(_arg2, _local11);
};
} else {
for each (_local13 in getProperties(_arg4)) {
_local14 = getValue(_arg4, _local13);
_local15 = new QName(_arg3.uri, _local13);
if (!containsNodeByName(_arg2, _local15)){
_local16 = encodeXSINil(_arg1, _local15, _local14);
if (_local16 != null){
appendValue(_arg2, _local16);
} else {
if (_local14 != null){
_local17 = new XMLList();
encodeAnyElement(_arg1, _local17, _local15, _local14, _arg5, _arg6);
appendValue(_arg2, _local17);
};
};
};
};
};
delete _arg6[_arg4];
};
};
return (true);
}
public function encodeSequence(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true):Boolean{
var _local11:XML;
var _local6:uint = getMaxOccurs(_arg1);
var _local7:uint = getMinOccurs(_arg1);
if (_local6 == 0){
return (true);
};
if ((((_arg4 == null)) && ((_local7 == 0)))){
return (true);
};
var _local8:XMLList = _arg1.elements();
var _local9:Boolean = ((_arg5) && ((_local7 > 0)));
var _local10:Boolean;
for each (_local11 in _local8) {
_local10 = false;
if (_local11.name() == constants.elementTypeQName){
if (!encodeGroupElement(_local11, _arg2, _arg3, _arg4, _arg5)){
break;
};
} else {
if (_local11.name() == constants.groupQName){
if (!encodeGroupReference(_local11, _arg2, _arg3, _arg4, _arg5)){
break;
};
} else {
if (_local11.name() == constants.choiceQName){
if (!encodeChoice(_local11, _arg2, _arg3, _arg4, _arg5)){
break;
};
} else {
if (_local11.name() == constants.sequenceQName){
if (!encodeSequence(_local11, _arg2, _arg3, _arg4, _arg5)){
break;
};
} else {
if (_local11.name() == constants.anyQName){
if (!encodeAnyElement(_local11, _arg2, _arg3, _arg4, _arg5)){
break;
};
};
};
};
};
};
_local10 = true;
};
return (((_local10) || (!(_arg5))));
}
public function getSimpleValue(_arg1, _arg2){
var _local3:* = getValue(_arg1, _arg2);
if (_local3 === undefined){
_local3 = getValue(_arg1, "_value");
};
return (_local3);
}
public function encodeAttributeGroup(_arg1:XML, _arg2:XML, _arg3:QName, _arg4=undefined, _arg5:XML=null):void{
var _local6:QName;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XML;
if (_arg1.attribute("ref").length() == 1){
_local6 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local6, constants.attributeGroupQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve attributeGroup definition for '" + _local6) + "'")));
};
};
var _local7:XMLList = _arg1.elements(constants.attributeQName);
for each (_local8 in _local7) {
encodeAttribute(_local8, _arg2, _arg3, _arg4, _arg5);
};
_local9 = _arg1.elements(constants.attributeGroupQName);
for each (_local10 in _local9) {
encodeAttributeGroup(_local10, _arg2, _arg3, _arg4, _arg5);
};
_local11 = getSingleElementFromNode(_arg1, constants.anyAttributeQName);
if (_local11 != null){
encodeAnyAttribute(_local11, _arg2, _arg3, _arg4, _arg5);
};
if (_local6 != null){
schemaManager.releaseScope();
};
}
public function encodeGroupElement(_arg1:XML, _arg2:XMLList, _arg3:QName, _arg4, _arg5:Boolean=true):Boolean{
var _local8:QName;
var _local12:XML;
var _local13:uint;
var _local14:TypeIterator;
var _local15:uint;
var _local16:*;
var _local6:uint = getMaxOccurs(_arg1);
var _local7:uint = getMinOccurs(_arg1);
_arg5 = ((_arg5) && ((_local7 > 0)));
if (_arg1.attribute("ref").length() == 1){
_local8 = schemaManager.getQNameForPrefixedName(_arg1.@ref, _arg1, true);
_arg1 = schemaManager.getNamedDefinition(_local8, constants.elementTypeQName);
if (_arg1 == null){
throw (new Error((("Cannot resolve element definition for ref '" + _local8) + "'")));
};
};
if (_local6 == 0){
return (true);
};
var _local9:String = _arg1.@name.toString();
var _local10:QName = schemaManager.getQNameForElement(_local9, getAttributeFromNode("form", _arg1));
var _local11:* = getValue(_arg4, _local10);
if (_local11 == null){
_local12 = encodeElementTopLevel(_arg1, _local10, _local11);
if (_local12 != null){
appendValue(_arg2, _local12);
};
if (((_arg5) && ((_local12 == null)))){
return (false);
};
return (true);
};
if (_local6 == 1){
_local12 = encodeElementTopLevel(_arg1, _local10, _local11);
if (_local12 != null){
appendValue(_arg2, _local12);
};
} else {
if (_local6 > 1){
_local13 = getValueOccurence(_local11);
if (_local13 < _local7){
throw (new Error((((((("Value supplied for element '" + _local10) + "' occurs ") + _local13) + " times which falls short of minOccurs ") + _local7) + ".")));
};
if (_local13 > _local6){
throw (new Error((((((("Value supplied for element of type '" + _local10) + "' occurs ") + _local13) + " times which exceeds maxOccurs ") + _local6) + ".")));
};
if (!TypeIterator.isIterable(_local11)){
_local11 = [_local11];
};
_local14 = new TypeIterator(_local11);
_local15 = 0;
while ((((_local15 < _local6)) && ((_local15 < _local13)))) {
if (_local14.hasNext()){
_local16 = _local14.next();
} else {
if (_local15 > _local7){
break;
};
};
_local12 = encodeElementTopLevel(_arg1, _local10, _local16);
if (_local12 == null){
_local12 = createElement(_local10);
setValue(_local12, null);
};
appendValue(_arg2, _local12);
_local15++;
};
};
};
if (_local8 != null){
schemaManager.releaseScope();
};
return (true);
}
public function getValue(_arg1, _arg2){
var _local3:*;
var _local4:XMLList;
if ((((_arg1 is XML)) || ((_arg1 is XMLList)))){
_local4 = _arg1[_arg2];
if (_local4.length() > 0){
_local3 = _local4;
};
} else {
if (TypeIterator.isIterable(_arg1)){
if (((_arg1.hasOwnProperty(_arg2)) && (!((_arg1[_arg2] === undefined))))){
_local3 = resolveNamedProperty(_arg1, _arg2);
} else {
_local3 = _arg1;
};
} else {
if (!isSimpleValue(_arg1)){
if ((_arg2 is QName)){
_arg2 = QName(_arg2).localName;
};
_local3 = resolveNamedProperty(_arg1, _arg2);
} else {
_local3 = _arg1;
};
};
};
return (_local3);
}
public function appendValue(_arg1:XMLList, _arg2):void{
_arg1[_arg1.length()] = _arg2;
}
public function getAttribute(_arg1, _arg2){
return (getValue(_arg1, _arg2));
}
}
}//package mx.rpc.xml
Section 180
//Fault (mx.rpc.Fault)
package mx.rpc {
public class Fault extends Error {
public var rootCause:Object;
protected var _faultCode:String;
protected var _faultString:String;
protected var _faultDetail:String;
public function Fault(_arg1:String, _arg2:String, _arg3:String=null){
super((((((("faultCode:" + _arg1) + " faultString:'") + _arg2) + "' faultDetail:'") + _arg3) + "'"));
this._faultCode = _arg1;
this._faultString = (_arg2) ? _arg2 : "";
this._faultDetail = _arg3;
}
public function toString():String{
var _local1 = "[RPC Fault";
_local1 = (_local1 + ((" faultString=\"" + faultString) + "\""));
_local1 = (_local1 + ((" faultCode=\"" + faultCode) + "\""));
_local1 = (_local1 + ((" faultDetail=\"" + faultDetail) + "\"]"));
return (_local1);
}
public function get faultCode():String{
return (_faultCode);
}
public function get faultString():String{
return (_faultString);
}
public function get faultDetail():String{
return (_faultDetail);
}
}
}//package mx.rpc
Section 181
//IResponder (mx.rpc.IResponder)
package mx.rpc {
public interface IResponder {
function fault(_arg1:Object):void;
function result(_arg1:Object):void;
}
}//package mx.rpc
Section 182
//ArrayUtil (mx.utils.ArrayUtil)
package mx.utils {
import mx.core.*;
public class ArrayUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function getItemIndex(_arg1:Object, _arg2:Array):int{
var _local3:int = _arg2.length;
var _local4:int;
while (_local4 < _local3) {
if (_arg2[_local4] === _arg1){
return (_local4);
};
_local4++;
};
return (-1);
}
public static function toArray(_arg1:Object):Array{
if (!_arg1){
return ([]);
};
if ((_arg1 is Array)){
return ((_arg1 as Array));
};
return ([_arg1]);
}
}
}//package mx.utils
Section 183
//Base64Decoder (mx.utils.Base64Decoder)
package mx.utils {
import flash.utils.*;
import mx.resources.*;
public class Base64Decoder {
private var filled:int;// = 0
private var data:ByteArray;
private var count:int;// = 0
private var work:Array;
private var resourceManager:IResourceManager;
private static const ESCAPE_CHAR_CODE:Number = 61;
private static const inverse:Array = [64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64];
public function Base64Decoder(){
work = [0, 0, 0, 0];
resourceManager = ResourceManager.getInstance();
super();
data = new ByteArray();
}
public function flush():ByteArray{
var _local1:String;
if (count > 0){
_local1 = resourceManager.getString("utils", "partialBlockDropped", [count]);
throw (new Error(_local1));
};
return (drain());
}
public function reset():void{
data = new ByteArray();
count = 0;
filled = 0;
}
public function decode(_arg1:String):void{
var _local3:Number;
var _local2:uint;
for (;_local2 < _arg1.length;_local2++) {
_local3 = _arg1.charCodeAt(_local2);
if (_local3 == ESCAPE_CHAR_CODE){
var _local4 = count++;
work[_local4] = -1;
} else {
if (inverse[_local3] != 64){
_local4 = count++;
work[_local4] = inverse[_local3];
} else {
continue;
};
};
if (count == 4){
count = 0;
data.writeByte(((work[0] << 2) | ((work[1] & 0xFF) >> 4)));
filled++;
if (work[2] == -1){
break;
};
data.writeByte(((work[1] << 4) | ((work[2] & 0xFF) >> 2)));
filled++;
if (work[3] == -1){
break;
};
data.writeByte(((work[2] << 6) | work[3]));
filled++;
};
};
}
public function toByteArray():ByteArray{
var _local1:ByteArray = flush();
reset();
return (_local1);
}
public function drain():ByteArray{
var _local1:ByteArray = new ByteArray();
copyByteArray(data, _local1, filled);
filled = 0;
return (_local1);
}
private static function copyByteArray(_arg1:ByteArray, _arg2:ByteArray, _arg3:uint=0):void{
var _local4:int = _arg1.position;
_arg1.position = 0;
_arg2.position = 0;
var _local5:uint;
while ((((_arg1.bytesAvailable > 0)) && ((_local5 < _arg3)))) {
_arg2.writeByte(_arg1.readByte());
_local5++;
};
_arg1.position = _local4;
_arg2.position = 0;
}
}
}//package mx.utils
Section 184
//Base64Encoder (mx.utils.Base64Encoder)
package mx.utils {
import flash.utils.*;
public class Base64Encoder {
private var _line:uint;
private var _count:uint;
private var _buffers:Array;
public var insertNewLines:Boolean;// = true
private var _work:Array;
private static const MAX_BUFFER_SIZE:uint = 0xFFFF;
private static const ALPHABET_CHAR_CODES:Array = [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47];
public static const CHARSET_UTF_8:String = "UTF-8";
private static const ESCAPE_CHAR_CODE:Number = 61;
public static var newLine:int = 10;
public function Base64Encoder(){
_work = [0, 0, 0];
super();
reset();
}
public function flush():String{
if (_count > 0){
encodeBlock();
};
var _local1:String = drain();
reset();
return (_local1);
}
public function toString():String{
return (flush());
}
public function reset():void{
_buffers = [];
_buffers.push([]);
_count = 0;
_line = 0;
_work[0] = 0;
_work[1] = 0;
_work[2] = 0;
}
public function encodeBytes(_arg1:ByteArray, _arg2:uint=0, _arg3:uint=0):void{
if (_arg3 == 0){
_arg3 = _arg1.length;
};
var _local4:uint = _arg1.position;
_arg1.position = _arg2;
var _local5:uint = _arg2;
while (_local5 < _arg3) {
_work[_count] = _arg1[_local5];
_count++;
if ((((_count == _work.length)) || ((((_arg2 + _arg3) - _local5) == 1)))){
encodeBlock();
_count = 0;
_work[0] = 0;
_work[1] = 0;
_work[2] = 0;
};
_local5++;
};
_arg1.position = _local4;
}
public function encode(_arg1:String, _arg2:uint=0, _arg3:uint=0):void{
if (_arg3 == 0){
_arg3 = _arg1.length;
};
var _local4:uint = _arg2;
while (_local4 < (_arg2 + _arg3)) {
_work[_count] = _arg1.charCodeAt(_local4);
_count++;
if ((((_count == _work.length)) || ((((_arg2 + _arg3) - _local4) == 1)))){
encodeBlock();
_count = 0;
_work[0] = 0;
_work[1] = 0;
_work[2] = 0;
};
_local4++;
};
}
private function encodeBlock():void{
var _local1:Array = (_buffers[(_buffers.length - 1)] as Array);
if (_local1.length >= MAX_BUFFER_SIZE){
_local1 = [];
_buffers.push(_local1);
};
_local1.push(ALPHABET_CHAR_CODES[((_work[0] & 0xFF) >> 2)]);
_local1.push(ALPHABET_CHAR_CODES[(((_work[0] & 3) << 4) | ((_work[1] & 240) >> 4))]);
if (_count > 1){
_local1.push(ALPHABET_CHAR_CODES[(((_work[1] & 15) << 2) | ((_work[2] & 192) >> 6))]);
} else {
_local1.push(ESCAPE_CHAR_CODE);
};
if (_count > 2){
_local1.push(ALPHABET_CHAR_CODES[(_work[2] & 63)]);
} else {
_local1.push(ESCAPE_CHAR_CODE);
};
if (insertNewLines){
if ((_line = (_line + 4)) == 76){
_local1.push(newLine);
_line = 0;
};
};
}
public function encodeUTFBytes(_arg1:String):void{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
_local2.position = 0;
encodeBytes(_local2);
}
public function drain():String{
var _local3:Array;
var _local1 = "";
var _local2:uint;
while (_local2 < _buffers.length) {
_local3 = (_buffers[_local2] as Array);
_local1 = (_local1 + String.fromCharCode.apply(null, _local3));
_local2++;
};
_buffers = [];
_buffers.push([]);
return (_local1);
}
}
}//package mx.utils
Section 185
//DescribeTypeCache (mx.utils.DescribeTypeCache)
package mx.utils {
import mx.core.*;
import flash.utils.*;
import mx.binding.*;
public class DescribeTypeCache {
mx_internal static const VERSION:String = "3.0.0.0";
private static var cacheHandlers:Object = {};
private static var typeCache:Object = {};
public static function describeType(_arg1):DescribeTypeCacheRecord{
var _local2:String;
var _local3:XML;
var _local4:DescribeTypeCacheRecord;
if ((_arg1 is String)){
_local2 = _arg1;
} else {
_local2 = getQualifiedClassName(_arg1);
};
if ((_local2 in typeCache)){
return (typeCache[_local2]);
};
if ((_arg1 is String)){
_arg1 = getDefinitionByName(_arg1);
};
_local3 = describeType(_arg1);
_local4 = new DescribeTypeCacheRecord();
_local4.typeDescription = _local3;
_local4.typeName = _local2;
typeCache[_local2] = _local4;
return (_local4);
}
public static function registerCacheHandler(_arg1:String, _arg2:Function):void{
cacheHandlers[_arg1] = _arg2;
}
static function extractValue(_arg1:String, _arg2:DescribeTypeCacheRecord){
if ((_arg1 in cacheHandlers)){
return (cacheHandlers[_arg1](_arg2));
};
return (undefined);
}
private static function bindabilityInfoHandler(_arg1:DescribeTypeCacheRecord){
return (new BindabilityInfo(_arg1.typeDescription));
}
registerCacheHandler("bindabilityInfo", bindabilityInfoHandler);
}
}//package mx.utils
Section 186
//DescribeTypeCacheRecord (mx.utils.DescribeTypeCacheRecord)
package mx.utils {
import flash.utils.*;
public dynamic class DescribeTypeCacheRecord extends Proxy {
public var typeDescription:XML;
public var typeName:String;
private var cache:Object;
public function DescribeTypeCacheRecord(){
cache = {};
super();
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:* = cache[_arg1];
if (_local2 === undefined){
_local2 = DescribeTypeCache.extractValue(_arg1, this);
cache[_arg1] = _local2;
};
return (_local2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if ((_arg1 in cache)){
return (true);
};
var _local2:* = DescribeTypeCache.extractValue(_arg1, this);
if (_local2 === undefined){
return (false);
};
cache[_arg1] = _local2;
return (true);
}
}
}//package mx.utils
Section 187
//HexDecoder (mx.utils.HexDecoder)
package mx.utils {
import flash.utils.*;
public class HexDecoder {
private var _output:ByteArray;
private var _work:Array;
public function HexDecoder(){
_work = [0, 0];
super();
_output = new ByteArray();
}
public function flush():ByteArray{
return (drain());
}
public function drain():ByteArray{
var _local1:ByteArray = _output;
_output = new ByteArray();
_local1.position = 0;
return (_local1);
}
public function digit(_arg1:String):int{
switch (_arg1){
case "A":
case "a":
return (10);
case "B":
case "b":
return (11);
case "C":
case "c":
return (12);
case "D":
case "d":
return (13);
case "E":
case "e":
return (14);
case "F":
case "f":
return (15);
default:
return (new Number(_arg1));
};
}
public function decode(_arg1:String):void{
var _local2:int;
while (_local2 < _arg1.length) {
_work[0] = digit(_arg1.charAt(_local2));
_local2++;
_work[1] = digit(_arg1.charAt(_local2));
_output.writeByte((((_work[0] << 4) | _work[1]) & 0xFF));
_local2++;
};
}
}
}//package mx.utils
Section 188
//HexEncoder (mx.utils.HexEncoder)
package mx.utils {
import flash.utils.*;
public class HexEncoder {
private var _work:int;// = 0
private var _buffers:Array;
public var encodingStyle:String;
private static const MAX_BUFFER_SIZE:uint = 0xFFFF;
public static const UPPER_CASE:String = "upper";
public static const LOWER_CASE:String = "lower";
private static const UPPER_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70];
private static const LOWER_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102];
public static var encodingStyle:String = "upper";
public function HexEncoder(){
_buffers = [];
_buffers.push([]);
}
public function flush():String{
return (drain());
}
public function encode(_arg1:ByteArray, _arg2:uint=0, _arg3:uint=0):void{
if (_arg3 == 0){
_arg3 = _arg1.length;
};
if (_arg2 < _arg3){
_arg1.position = _arg2;
};
var _local4:String = ((this.encodingStyle)!=null) ? this.encodingStyle : HexEncoder.encodingStyle;
if (((!((_local4 == UPPER_CASE))) && (!((_local4 == LOWER_CASE))))){
_local4 = UPPER_CASE;
};
var _local5:Array = ((_local4)==UPPER_CASE) ? UPPER_CHAR_CODES : LOWER_CHAR_CODES;
while (_arg1.bytesAvailable > 0) {
encodeBlock(_arg1.readByte(), _local5);
};
}
private function encodeBlock(_arg1:int, _arg2:Array):void{
var _local3:Array = (_buffers[(_buffers.length - 1)] as Array);
if (_local3.length >= MAX_BUFFER_SIZE){
_local3 = [];
_buffers.push(_local3);
};
_local3.push(_arg2[((_arg1 & 240) >>> 4)]);
_local3.push(_arg2[(_arg1 & 15)]);
}
public function drain():String{
var _local3:Array;
var _local1 = "";
var _local2:uint;
while (_local2 < _buffers.length) {
_local3 = (_buffers[_local2] as Array);
_local1 = (_local1 + String.fromCharCode.apply(null, _local3));
_local2++;
};
_buffers = [];
_buffers.push([]);
return (_local1);
}
}
}//package mx.utils
Section 189
//IXMLNotifiable (mx.utils.IXMLNotifiable)
package mx.utils {
public interface IXMLNotifiable {
function xmlNotification(_arg1:Object, _arg2:String, _arg3:Object, _arg4:Object, _arg5:Object):void;
}
}//package mx.utils
Section 190
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 191
//object_proxy (mx.utils.object_proxy)
package mx.utils {
public namespace object_proxy = "http://www.adobe.com/2006/actionscript/flash/objectproxy";
}//package mx.utils
Section 192
//ObjectProxy (mx.utils.ObjectProxy)
package mx.utils {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import mx.events.*;
public dynamic class ObjectProxy extends Proxy implements IExternalizable, IPropertyChangeNotifier {
private var _id:String;
protected var notifiers:Object;
protected var propertyList:Array;
private var _proxyLevel:int;
private var _type:QName;
protected var dispatcher:EventDispatcher;
protected var proxyClass:Class;
private var _item:Object;
public function ObjectProxy(_arg1:Object=null, _arg2:String=null, _arg3:int=-1){
proxyClass = ObjectProxy;
super();
if (!_arg1){
_arg1 = {};
};
_item = _arg1;
_proxyLevel = _arg3;
notifiers = {};
dispatcher = new EventDispatcher(this);
if (_arg2){
_id = _arg2;
};
}
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local4:IPropertyChangeNotifier;
var _local5:PropertyChangeEvent;
var _local3:* = _item[_arg1];
if (_local3 !== _arg2){
_item[_arg1] = _arg2;
_local4 = IPropertyChangeNotifier(notifiers[_arg1]);
if (_local4){
_local4.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
delete notifiers[_arg1];
};
if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)){
if ((_arg1 is QName)){
_arg1 = QName(_arg1).localName;
};
_local5 = PropertyChangeEvent.createUpdateEvent(this, _arg1.toString(), _local3, _arg2);
dispatcher.dispatchEvent(_local5);
};
};
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function readExternal(_arg1:IDataInput):void{
var _local2:Object = _arg1.readObject();
_item = _local2;
}
public function writeExternal(_arg1:IDataOutput):void{
_arg1.writeObject(_item);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
var _local2:*;
if (notifiers[_arg1.toString()]){
return (notifiers[_arg1]);
};
_local2 = _item[_arg1];
if (_local2){
if ((((_proxyLevel == 0)) || (ObjectUtil.isSimple(_local2)))){
return (_local2);
};
_local2 = getComplexProperty(_arg1, _local2);
};
return (_local2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
return ((_arg1 in _item));
}
public function get uid():String{
if (_id === null){
_id = UIDUtil.createUID();
};
return (_id);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
if (_arg1 == 0){
setupPropertyList();
};
if (_arg1 < propertyList.length){
return ((_arg1 + 1));
};
return (0);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (propertyList[(_arg1 - 1)]);
}
public function set uid(_arg1:String):void{
_id = _arg1;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function callProperty(_arg1, ... _args){
return (_item[_arg1].apply(_item, _args));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
protected function setupPropertyList():void{
var _local1:String;
if (getQualifiedClassName(_item) == "Object"){
propertyList = [];
for (_local1 in _item) {
propertyList.push(_local1);
};
} else {
propertyList = ObjectUtil.getClassInfo(_item, null, {includeReadOnly:true, uris:["*"]}).properties;
};
}
object_proxy function getComplexProperty(_arg1, _arg2){
if ((_arg2 is IPropertyChangeNotifier)){
_arg2.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
notifiers[_arg1] = _arg2;
return (_arg2);
};
if (getQualifiedClassName(_arg2) == "Object"){
_arg2 = new proxyClass(_item[_arg1], null, ((_proxyLevel > 0)) ? (_proxyLevel - 1) : _proxyLevel);
_arg2.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
notifiers[_arg1] = _arg2;
return (_arg2);
};
return (_arg2);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
var _local5:PropertyChangeEvent;
var _local2:IPropertyChangeNotifier = IPropertyChangeNotifier(notifiers[_arg1]);
if (_local2){
_local2.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangeHandler);
delete notifiers[_arg1];
};
var _local3:* = _item[_arg1];
var _local4 = delete _item[_arg1];
if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)){
_local5 = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
_local5.kind = PropertyChangeEventKind.DELETE;
_local5.property = _arg1;
_local5.oldValue = _local3;
_local5.source = this;
dispatcher.dispatchEvent(_local5);
};
return (_local4);
}
object_proxy function get type():QName{
return (_type);
}
object_proxy function set type(_arg1:QName):void{
_type = _arg1;
}
public function propertyChangeHandler(_arg1:PropertyChangeEvent):void{
dispatcher.dispatchEvent(_arg1);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){
return (_item[propertyList[(_arg1 - 1)]]);
}
object_proxy function get object():Object{
return (_item);
}
}
}//package mx.utils
Section 193
//ObjectUtil (mx.utils.ObjectUtil)
package mx.utils {
import mx.core.*;
import flash.utils.*;
import flash.xml.*;
import mx.collections.*;
public class ObjectUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var defaultToStringExcludes:Array = ["password", "credentials"];
private static var CLASS_INFO_CACHE:Object = {};
private static var refCount:int = 0;
public static function isSimple(_arg1:Object):Boolean{
var _local2 = typeof(_arg1);
switch (_local2){
case "number":
case "string":
case "boolean":
return (true);
case "object":
return ((((_arg1 is Date)) || ((_arg1 is Array))));
};
return (false);
}
private static function internalToString(_arg1:Object, _arg2:int=0, _arg3:Dictionary=null, _arg4:Array=null, _arg5:Array=null):String{
var str:String;
var classInfo:Object;
var properties:Array;
var id:Object;
var isArray:Boolean;
var prop:*;
var j:int;
var value = _arg1;
var indent = _arg2;
var refs = _arg3;
var namespaceURIs = _arg4;
var exclude = _arg5;
var type:String = ((value == null)) ? "null" : typeof(value);
switch (type){
case "boolean":
case "number":
return (value.toString());
case "string":
return ((("\"" + value.toString()) + "\""));
case "object":
if ((value is Date)){
return (value.toString());
};
if ((value is XMLNode)){
return (value.toString());
};
if ((value is Class)){
return ((("(" + getQualifiedClassName(value)) + ")"));
};
classInfo = getClassInfo(value, exclude, {includeReadOnly:true, uris:namespaceURIs});
properties = classInfo.properties;
str = (("(" + classInfo.name) + ")");
if (refs == null){
refs = new Dictionary(true);
};
id = refs[value];
if (id != null){
str = (str + ("#" + int(id)));
return (str);
};
if (value != null){
str = (str + ("#" + refCount.toString()));
refs[value] = refCount;
refCount++;
};
isArray = (value is Array);
indent = (indent + 2);
j = 0;
while (j < properties.length) {
str = newline(str, indent);
prop = properties[j];
if (isArray){
str = (str + "[");
};
str = (str + prop.toString());
if (isArray){
str = (str + "] ");
} else {
str = (str + " = ");
};
try {
str = (str + internalToString(value[prop], indent, refs, namespaceURIs, exclude));
} catch(e:Error) {
str = (str + "?");
};
j = (j + 1);
};
indent = (indent - 2);
return (str);
case "xml":
return (value.toString());
default:
return ((("(" + type) + ")"));
};
}
public static function getClassInfo(_arg1:Object, _arg2:Array=null, _arg3:Object=null):Object{
var n:int;
var i:int;
var result:Object;
var cacheKey:String;
var className:String;
var classAlias:String;
var properties:XMLList;
var prop:XML;
var metadataInfo:Object;
var classInfo:XML;
var numericIndex:Boolean;
var p:String;
var pi:Number;
var uris:Array;
var uri:String;
var qName:QName;
var j:int;
var obj = _arg1;
var excludes = _arg2;
var options = _arg3;
if ((obj is ObjectProxy)){
obj = ObjectProxy(obj).object_proxy::object;
};
if (options == null){
options = {includeReadOnly:true, uris:null, includeTransient:true};
};
var propertyNames:Array = [];
var dynamic:Boolean;
if (typeof(obj) == "xml"){
className = "XML";
properties = obj.text();
if (properties.length()){
propertyNames.push("*");
};
properties = obj.attributes();
} else {
classInfo = DescribeTypeCache.describeType(obj).typeDescription;
className = classInfo.@name.toString();
classAlias = classInfo.@alias.toString();
dynamic = (classInfo.@isDynamic.toString() == "true");
if (options.includeReadOnly){
properties = (classInfo..accessor.(@access != "writeonly") + classInfo..variable);
} else {
properties = (classInfo..accessor.(@access == "readwrite") + classInfo..variable);
};
numericIndex = false;
};
if (!dynamic){
cacheKey = getCacheKey(obj, excludes, options);
result = CLASS_INFO_CACHE[cacheKey];
if (result != null){
return (result);
};
};
result = {};
result["name"] = className;
result["alias"] = classAlias;
result["properties"] = propertyNames;
result["dynamic"] = dynamic;
var _local5 = recordMetadata(properties);
metadataInfo = _local5;
result["metadata"] = _local5;
var excludeObject:Object = {};
if (excludes){
n = excludes.length;
i = 0;
while (i < n) {
excludeObject[excludes[i]] = 1;
i = (i + 1);
};
};
var isArray = (className == "Array");
if (dynamic){
for (p in obj) {
if (excludeObject[p] != 1){
if (isArray){
pi = parseInt(p);
if (isNaN(pi)){
propertyNames.push(new QName("", p));
} else {
propertyNames.push(pi);
};
} else {
propertyNames.push(new QName("", p));
};
};
};
numericIndex = ((isArray) && (!(isNaN(Number(p)))));
};
if ((((className == "Object")) || (isArray))){
} else {
if (className == "XML"){
n = properties.length();
i = 0;
while (i < n) {
p = properties[i].name();
if (excludeObject[p] != 1){
propertyNames.push(new QName("", ("@" + p)));
};
i = (i + 1);
};
} else {
n = properties.length();
uris = options.uris;
i = 0;
while (i < n) {
prop = properties[i];
p = prop.@name.toString();
uri = prop.@uri.toString();
if (excludeObject[p] == 1){
} else {
if (((!(options.includeTransient)) && (internalHasMetadata(metadataInfo, p, "Transient")))){
} else {
if (uris != null){
if ((((uris.length == 1)) && ((uris[0] == "*")))){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push();
} catch(e:Error) {
};
} else {
j = 0;
while (j < uris.length) {
uri = uris[j];
if (prop.@uri.toString() == uri){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push(qName);
} catch(e:Error) {
};
};
j = (j + 1);
};
};
} else {
if (uri.length == 0){
qName = new QName(uri, p);
try {
obj[qName];
propertyNames.push(qName);
} catch(e:Error) {
};
};
};
};
};
i = (i + 1);
};
};
};
propertyNames.sort((Array.CASEINSENSITIVE | (numericIndex) ? Array.NUMERIC : 0));
i = 0;
while (i < (propertyNames.length - 1)) {
if (propertyNames[i].toString() == propertyNames[(i + 1)].toString()){
propertyNames.splice(i, 1);
i = (i - 1);
};
i = (i + 1);
};
if (!dynamic){
cacheKey = getCacheKey(obj, excludes, options);
CLASS_INFO_CACHE[cacheKey] = result;
};
return (result);
}
private static function arrayCompare(_arg1:Array, _arg2:Array, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local7:Object;
var _local6:int;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local6 = -1;
} else {
_local6 = 1;
};
} else {
for (_local7 in _arg1) {
if (_arg2.hasOwnProperty(_local7)){
_local6 = internalCompare(_arg1[_local7], _arg2[_local7], _arg3, _arg4, _arg5);
if (_local6 != 0){
return (_local6);
};
} else {
return (-1);
};
};
for (_local7 in _arg2) {
if (!_arg1.hasOwnProperty(_local7)){
return (1);
};
};
};
return (_local6);
}
public static function stringCompare(_arg1:String, _arg2:String, _arg3:Boolean=false):int{
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
if (_arg3){
_arg1 = _arg1.toLocaleLowerCase();
_arg2 = _arg2.toLocaleLowerCase();
};
var _local4:int = _arg1.localeCompare(_arg2);
if (_local4 < -1){
_local4 = -1;
} else {
if (_local4 > 1){
_local4 = 1;
};
};
return (_local4);
}
public static function dateCompare(_arg1:Date, _arg2:Date):int{
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
var _local3:Number = _arg1.getTime();
var _local4:Number = _arg2.getTime();
if (_local3 < _local4){
return (-1);
};
if (_local3 > _local4){
return (1);
};
return (0);
}
public static function numericCompare(_arg1:Number, _arg2:Number):int{
if (((isNaN(_arg1)) && (isNaN(_arg2)))){
return (0);
};
if (isNaN(_arg1)){
return (1);
};
if (isNaN(_arg2)){
return (-1);
};
if (_arg1 < _arg2){
return (-1);
};
if (_arg1 > _arg2){
return (1);
};
return (0);
}
private static function newline(_arg1:String, _arg2:int=0):String{
var _local3:String = _arg1;
_local3 = (_local3 + "\n");
var _local4:int;
while (_local4 < _arg2) {
_local3 = (_local3 + " ");
_local4++;
};
return (_local3);
}
private static function recordMetadata(_arg1:XMLList):Object{
var prop:XML;
var propName:String;
var metadataList:XMLList;
var metadata:Object;
var md:XML;
var mdName:String;
var argsList:XMLList;
var value:Object;
var arg:XML;
var existing:Object;
var argKey:String;
var argValue:String;
var existingArray:Array;
var properties = _arg1;
var result:Object;
try {
for each (prop in properties) {
propName = prop.attribute("name").toString();
metadataList = prop.metadata;
if (metadataList.length() > 0){
if (result == null){
result = {};
};
metadata = {};
result[propName] = metadata;
for each (md in metadataList) {
mdName = md.attribute("name").toString();
argsList = md.arg;
value = {};
for each (arg in argsList) {
argKey = arg.attribute("key").toString();
if (argKey != null){
argValue = arg.attribute("value").toString();
value[argKey] = argValue;
};
};
existing = metadata[mdName];
if (existing != null){
if ((existing is Array)){
existingArray = (existing as Array);
} else {
existingArray = [];
};
existingArray.push(value);
existing = existingArray;
} else {
existing = value;
};
metadata[mdName] = existing;
};
};
};
} catch(e:Error) {
};
return (result);
}
public static function compare(_arg1:Object, _arg2:Object, _arg3:int=-1):int{
return (internalCompare(_arg1, _arg2, 0, _arg3, new Dictionary(true)));
}
private static function listCompare(_arg1:IList, _arg2:IList, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local7:int;
var _local6:int;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local6 = -1;
} else {
_local6 = 1;
};
} else {
_local7 = 0;
while (_local7 < _arg1.length) {
_local6 = internalCompare(_arg1.getItemAt(_local7), _arg2.getItemAt(_local7), (_arg3 + 1), _arg4, _arg5);
if (_local6 != 0){
_local7 = _arg1.length;
};
_local7++;
};
};
return (_local6);
}
private static function internalCompare(_arg1:Object, _arg2:Object, _arg3:int, _arg4:int, _arg5:Dictionary):int{
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Array;
var _local13:Array;
var _local14:QName;
var _local15:Object;
var _local16:Object;
var _local17:int;
if ((((_arg1 == null)) && ((_arg2 == null)))){
return (0);
};
if (_arg1 == null){
return (1);
};
if (_arg2 == null){
return (-1);
};
if ((_arg1 is ObjectProxy)){
_arg1 = ObjectProxy(_arg1).object_proxy::object;
};
if ((_arg2 is ObjectProxy)){
_arg2 = ObjectProxy(_arg2).object_proxy::object;
};
var _local6 = typeof(_arg1);
var _local7 = typeof(_arg2);
var _local8:int;
if (_local6 == _local7){
switch (_local6){
case "boolean":
_local8 = numericCompare(Number(_arg1), Number(_arg2));
break;
case "number":
_local8 = numericCompare((_arg1 as Number), (_arg2 as Number));
break;
case "string":
_local8 = stringCompare((_arg1 as String), (_arg2 as String));
break;
case "object":
_local9 = ((_arg4 > 0)) ? (_arg4 - 1) : _arg4;
_local10 = _arg5[_arg1];
_local11 = _arg5[_arg2];
if (((_local10) && (!(_local11)))){
return (1);
};
if (((_local11) && (!(_local10)))){
return (-1);
};
if (((_local11) && (_local10))){
return (0);
};
_arg5[_arg1] = true;
_arg5[_arg2] = true;
if (((!((_arg4 == -1))) && ((_arg3 > _arg4)))){
_local8 = stringCompare(_arg1.toString(), _arg2.toString());
} else {
if ((((_arg1 is Array)) && ((_arg2 is Array)))){
_local8 = arrayCompare((_arg1 as Array), (_arg2 as Array), _arg3, _arg4, _arg5);
} else {
if ((((_arg1 is Date)) && ((_arg2 is Date)))){
_local8 = dateCompare((_arg1 as Date), (_arg2 as Date));
} else {
if ((((_arg1 is IList)) && ((_arg2 is IList)))){
_local8 = listCompare((_arg1 as IList), (_arg2 as IList), _arg3, _arg4, _arg5);
} else {
if ((((_arg1 is ByteArray)) && ((_arg2 is ByteArray)))){
_local8 = byteArrayCompare((_arg1 as ByteArray), (_arg2 as ByteArray));
} else {
if (getQualifiedClassName(_arg1) == getQualifiedClassName(_arg2)){
_local12 = getClassInfo(_arg1).properties;
if (getQualifiedClassName(_arg1) == "Object"){
_local13 = getClassInfo(_arg2).properties;
_local8 = arrayCompare(_local12, _local13, _arg3, _local9, _arg5);
};
if (_local8 != 0){
return (_local8);
};
_local17 = 0;
while (_local17 < _local12.length) {
_local14 = _local12[_local17];
_local15 = _arg1[_local14];
_local16 = _arg2[_local14];
_local8 = internalCompare(_local15, _local16, (_arg3 + 1), _local9, _arg5);
if (_local8 != 0){
_local17 = _local12.length;
};
_local17++;
};
} else {
return (1);
};
};
};
};
};
};
break;
};
} else {
return (stringCompare(_local6, _local7));
};
return (_local8);
}
public static function hasMetadata(_arg1:Object, _arg2:String, _arg3:String, _arg4:Array=null, _arg5:Object=null):Boolean{
var _local6:Object = getClassInfo(_arg1, _arg4, _arg5);
var _local7:Object = _local6["metadata"];
return (internalHasMetadata(_local7, _arg2, _arg3));
}
private static function internalHasMetadata(_arg1:Object, _arg2:String, _arg3:String):Boolean{
var _local4:Object;
if (_arg1 != null){
_local4 = _arg1[_arg2];
if (_local4 != null){
if (_local4[_arg3] != null){
return (true);
};
};
};
return (false);
}
public static function toString(_arg1:Object, _arg2:Array=null, _arg3:Array=null):String{
if (_arg3 == null){
_arg3 = defaultToStringExcludes;
};
refCount = 0;
return (internalToString(_arg1, 0, null, _arg2, _arg3));
}
private static function byteArrayCompare(_arg1:ByteArray, _arg2:ByteArray):int{
var _local4:int;
var _local3:int;
if (_arg1.length != _arg2.length){
if (_arg1.length < _arg2.length){
_local3 = -1;
} else {
_local3 = 1;
};
} else {
_arg1.position = 0;
_arg2.position = 0;
_local4 = 0;
while (_local4 < _arg1.length) {
_local3 = numericCompare(_arg1.readByte(), _arg2.readByte());
if (_local3 != 0){
_local4 = _arg1.length;
};
_local4++;
};
};
return (_local3);
}
public static function copy(_arg1:Object):Object{
var _local2:ByteArray = new ByteArray();
_local2.writeObject(_arg1);
_local2.position = 0;
var _local3:Object = _local2.readObject();
return (_local3);
}
private static function getCacheKey(_arg1:Object, _arg2:Array=null, _arg3:Object=null):String{
var _local5:uint;
var _local6:String;
var _local7:String;
var _local8:String;
var _local4:String = getQualifiedClassName(_arg1);
if (_arg2 != null){
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = (_arg2[_local5] as String);
if (_local6 != null){
_local4 = (_local4 + _local6);
};
_local5++;
};
};
if (_arg3 != null){
for (_local7 in _arg3) {
_local4 = (_local4 + _local7);
_local8 = (_arg3[_local7] as String);
if (_local8 != null){
_local4 = (_local4 + _local8);
};
};
};
return (_local4);
}
}
}//package mx.utils
Section 194
//StringUtil (mx.utils.StringUtil)
package mx.utils {
import mx.core.*;
public class StringUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function trim(_arg1:String):String{
if (_arg1 == null){
return ("");
};
var _local2:int;
while (isWhitespace(_arg1.charAt(_local2))) {
_local2++;
};
var _local3:int = (_arg1.length - 1);
while (isWhitespace(_arg1.charAt(_local3))) {
_local3--;
};
if (_local3 >= _local2){
return (_arg1.slice(_local2, (_local3 + 1)));
};
return ("");
}
public static function isWhitespace(_arg1:String):Boolean{
switch (_arg1){
case " ":
case "\t":
case "\r":
case "\n":
case "\f":
return (true);
default:
return (false);
};
}
public static function substitute(_arg1:String, ... _args):String{
var _local4:Array;
if (_arg1 == null){
return ("");
};
var _local3:uint = _args.length;
if ((((_local3 == 1)) && ((_args[0] is Array)))){
_local4 = (_args[0] as Array);
_local3 = _local4.length;
} else {
_local4 = _args;
};
var _local5:int;
while (_local5 < _local3) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local5) + "\\}"), "g"), _local4[_local5]);
_local5++;
};
return (_arg1);
}
public static function trimArrayElements(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:int;
var _local5:int;
if (((!((_arg1 == ""))) && (!((_arg1 == null))))){
_local3 = _arg1.split(_arg2);
_local4 = _local3.length;
_local5 = 0;
while (_local5 < _local4) {
_local3[_local5] = StringUtil.trim(_local3[_local5]);
_local5++;
};
if (_local4 > 0){
_arg1 = _local3.join(_arg2);
};
};
return (_arg1);
}
}
}//package mx.utils
Section 195
//UIDUtil (mx.utils.UIDUtil)
package mx.utils {
import mx.core.*;
import flash.utils.*;
public class UIDUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static const ALPHA_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70];
private static var uidDictionary:Dictionary = new Dictionary(true);
public static function fromByteArray(_arg1:ByteArray):String{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:int;
if (((((!((_arg1 == null))) && ((_arg1.length >= 16)))) && ((_arg1.bytesAvailable >= 16)))){
_local2 = new Array(36);
_local3 = 0;
_local4 = 0;
while (_local4 < 16) {
if ((((((((_local4 == 4)) || ((_local4 == 6)))) || ((_local4 == 8)))) || ((_local4 == 10)))){
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local6 = _temp1;
_local2[_local6] = 45;
};
_local5 = _arg1.readByte();
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local6 = _temp2;
_local2[_local6] = ALPHA_CHAR_CODES[((_local5 & 240) >>> 4)];
var _temp3 = _local3;
_local3 = (_local3 + 1);
var _local7 = _temp3;
_local2[_local7] = ALPHA_CHAR_CODES[(_local5 & 15)];
_local4++;
};
return (String.fromCharCode.apply(null, _local2));
};
return (null);
}
public static function isUID(_arg1:String):Boolean{
var _local2:uint;
var _local3:Number;
if (((!((_arg1 == null))) && ((_arg1.length == 36)))){
_local2 = 0;
while (_local2 < 36) {
_local3 = _arg1.charCodeAt(_local2);
if ((((((((_local2 == 8)) || ((_local2 == 13)))) || ((_local2 == 18)))) || ((_local2 == 23)))){
if (_local3 != 45){
return (false);
};
} else {
if ((((((_local3 < 48)) || ((_local3 > 70)))) || ((((_local3 > 57)) && ((_local3 < 65)))))){
return (false);
};
};
_local2++;
};
return (true);
};
return (false);
}
public static function createUID():String{
var _local3:int;
var _local4:int;
var _local1:Array = new Array(36);
var _local2:int;
_local3 = 0;
while (_local3 < 8) {
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local7 = _temp1;
_local1[_local7] = ALPHA_CHAR_CODES[Math.floor((Math.random() * 16))];
_local3++;
};
_local3 = 0;
while (_local3 < 3) {
var _temp2 = _local2;
_local2 = (_local2 + 1);
_local7 = _temp2;
_local1[_local7] = 45;
_local4 = 0;
while (_local4 < 4) {
var _temp3 = _local2;
_local2 = (_local2 + 1);
var _local8 = _temp3;
_local1[_local8] = ALPHA_CHAR_CODES[Math.floor((Math.random() * 16))];
_local4++;
};
_local3++;
};
var _temp4 = _local2;
_local2 = (_local2 + 1);
_local7 = _temp4;
_local1[_local7] = 45;
var _local5:Number = new Date().getTime();
var _local6:String = ("0000000" + _local5.toString(16).toUpperCase()).substr(-8);
_local3 = 0;
while (_local3 < 8) {
var _temp5 = _local2;
_local2 = (_local2 + 1);
_local8 = _temp5;
_local1[_local8] = _local6.charCodeAt(_local3);
_local3++;
};
_local3 = 0;
while (_local3 < 4) {
var _temp6 = _local2;
_local2 = (_local2 + 1);
_local8 = _temp6;
_local1[_local8] = ALPHA_CHAR_CODES[Math.floor((Math.random() * 16))];
_local3++;
};
return (String.fromCharCode.apply(null, _local1));
}
public static function toByteArray(_arg1:String):ByteArray{
var _local2:ByteArray;
var _local3:uint;
var _local4:String;
var _local5:uint;
var _local6:uint;
if (isUID(_arg1)){
_local2 = new ByteArray();
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1.charAt(_local3);
if (_local4 == "-"){
} else {
_local5 = getDigit(_local4);
_local3++;
_local6 = getDigit(_arg1.charAt(_local3));
_local2.writeByte((((_local5 << 4) | _local6) & 0xFF));
};
_local3++;
};
_local2.position = 0;
return (_local2);
};
return (null);
}
private static function getDigit(_arg1:String):uint{
switch (_arg1){
case "A":
case "a":
return (10);
case "B":
case "b":
return (11);
case "C":
case "c":
return (12);
case "D":
case "d":
return (13);
case "E":
case "e":
return (14);
case "F":
case "f":
return (15);
default:
return (new uint(_arg1));
};
}
public static function getUID(_arg1:Object):String{
var result:String;
var xitem:XML;
var nodeKind:String;
var notificationFunction:Function;
var item = _arg1;
result = null;
if (item == null){
return (result);
};
if ((item is IUID)){
result = IUID(item).uid;
if ((((result == null)) || ((result.length == 0)))){
result = createUID();
IUID(item).uid = result;
};
} else {
if ((((item is IPropertyChangeNotifier)) && (!((item is IUIComponent))))){
result = IPropertyChangeNotifier(item).uid;
if ((((result == null)) || ((result.length == 0)))){
result = createUID();
IPropertyChangeNotifier(item).uid = result;
};
} else {
if ((item is String)){
return ((item as String));
};
try {
if ((((item is XMLList)) && ((item.length == 1)))){
item = item[0];
};
if ((item is XML)){
xitem = XML(item);
nodeKind = xitem.nodeKind();
if ((((nodeKind == "text")) || ((nodeKind == "attribute")))){
return (xitem.toString());
};
notificationFunction = xitem.notification();
if (!(notificationFunction is Function)){
notificationFunction = XMLNotifier.initializeXMLForNotification();
xitem.setNotification(notificationFunction);
};
if (notificationFunction["uid"] == undefined){
result = (notificationFunction["uid"] = createUID());
};
result = notificationFunction["uid"];
} else {
if (("mx_internal_uid" in item)){
return (item.mx_internal_uid);
};
if (("uid" in item)){
return (item.uid);
};
result = uidDictionary[item];
if (!result){
result = createUID();
try {
item.mx_internal_uid = result;
} catch(e:Error) {
uidDictionary[item] = result;
};
};
};
} catch(e:Error) {
result = item.toString();
};
};
};
return (result);
}
}
}//package mx.utils
Section 196
//URLUtil (mx.utils.URLUtil)
package mx.utils {
import mx.messaging.config.*;
public class URLUtil {
public static const SERVER_NAME_TOKEN:String = "{server.name}";
private static const SERVER_PORT_REGEX:RegExp = new RegExp("\\{server.port\\}", "g");
private static const SERVER_NAME_REGEX:RegExp = new RegExp("\\{server.name\\}", "g");
public static const SERVER_PORT_TOKEN:String = "{server.port}";
public static function hasUnresolvableTokens():Boolean{
return (!((LoaderConfig.url == null)));
}
public static function getServerName(_arg1:String):String{
var _local2:String = getServerNameWithPort(_arg1);
var _local3:int = _local2.indexOf("]");
_local3 = ((_local3)>-1) ? _local2.indexOf(":", _local3) : _local2.indexOf(":");
if (_local3 > 0){
_local2 = _local2.substring(0, _local3);
};
return (_local2);
}
public static function isHttpsURL(_arg1:String):Boolean{
return (((!((_arg1 == null))) && ((_arg1.indexOf("https://") == 0))));
}
private static function internalObjectToString(_arg1:Object, _arg2:String, _arg3:String, _arg4:Boolean):String{
var _local7:String;
var _local8:Object;
var _local9:String;
var _local5 = "";
var _local6:Boolean;
for (_local7 in _arg1) {
if (_local6){
_local6 = false;
} else {
_local5 = (_local5 + _arg2);
};
_local8 = _arg1[_local7];
_local9 = (_arg3) ? ((_arg3 + ".") + _local7) : _local7;
if (_arg4){
_local9 = encodeURIComponent(_local9);
};
if ((_local8 is String)){
_local5 = (_local5 + ((_local9 + "=") + (_arg4) ? encodeURIComponent((_local8 as String)) : _local8));
} else {
if ((_local8 is Number)){
_local8 = _local8.toString();
if (_arg4){
_local8 = encodeURIComponent((_local8 as String));
};
_local5 = (_local5 + ((_local9 + "=") + _local8));
} else {
if ((_local8 is Boolean)){
_local5 = (_local5 + ((_local9 + "=") + (_local8) ? "true" : "false"));
} else {
if ((_local8 is Array)){
_local5 = (_local5 + internalArrayToString((_local8 as Array), _arg2, _local9, _arg4));
} else {
_local5 = (_local5 + internalObjectToString(_local8, _arg2, _local9, _arg4));
};
};
};
};
};
return (_local5);
}
public static function getFullURL(_arg1:String, _arg2:String):String{
var _local3:Number;
if (((!((_arg2 == null))) && (!(URLUtil.isHttpURL(_arg2))))){
if (_arg2.indexOf("./") == 0){
_arg2 = _arg2.substring(2);
};
if (URLUtil.isHttpURL(_arg1)){
if (_arg2.charAt(0) == "/"){
_local3 = _arg1.indexOf("/", 8);
if (_local3 == -1){
_local3 = _arg1.length;
};
} else {
_local3 = (_arg1.lastIndexOf("/") + 1);
if (_local3 <= 8){
_arg1 = (_arg1 + "/");
_local3 = _arg1.length;
};
};
if (_local3 > 0){
_arg2 = (_arg1.substring(0, _local3) + _arg2);
};
};
};
return (_arg2);
}
public static function getServerNameWithPort(_arg1:String):String{
var _local2:int = (_arg1.indexOf("/") + 2);
var _local3:int = _arg1.indexOf("/", _local2);
return (((_local3 == -1)) ? _arg1.substring(_local2) : _arg1.substring(_local2, _local3));
}
public static function replaceProtocol(_arg1:String, _arg2:String):String{
return (_arg1.replace(getProtocol(_arg1), _arg2));
}
public static function urisEqual(_arg1:String, _arg2:String):Boolean{
if (((!((_arg1 == null))) && (!((_arg2 == null))))){
_arg1 = StringUtil.trim(_arg1).toLowerCase();
_arg2 = StringUtil.trim(_arg2).toLowerCase();
if (_arg1.charAt((_arg1.length - 1)) != "/"){
_arg1 = (_arg1 + "/");
};
if (_arg2.charAt((_arg2.length - 1)) != "/"){
_arg2 = (_arg2 + "/");
};
};
return ((_arg1 == _arg2));
}
public static function getProtocol(_arg1:String):String{
var _local2:int = _arg1.indexOf("/");
var _local3:int = _arg1.indexOf(":/");
if ((((_local3 > -1)) && ((_local3 < _local2)))){
return (_arg1.substring(0, _local3));
};
_local3 = _arg1.indexOf("::");
if ((((_local3 > -1)) && ((_local3 < _local2)))){
return (_arg1.substring(0, _local3));
};
return ("");
}
private static function internalArrayToString(_arg1:Array, _arg2:String, _arg3:String, _arg4:Boolean):String{
var _local9:Object;
var _local10:String;
var _local5 = "";
var _local6:Boolean;
var _local7:int = _arg1.length;
var _local8:int;
while (_local8 < _local7) {
if (_local6){
_local6 = false;
} else {
_local5 = (_local5 + _arg2);
};
_local9 = _arg1[_local8];
_local10 = ((_arg3 + ".") + _local8);
if (_arg4){
_local10 = encodeURIComponent(_local10);
};
if ((_local9 is String)){
_local5 = (_local5 + ((_local10 + "=") + (_arg4) ? encodeURIComponent((_local9 as String)) : _local9));
} else {
if ((_local9 is Number)){
_local9 = _local9.toString();
if (_arg4){
_local9 = encodeURIComponent((_local9 as String));
};
_local5 = (_local5 + ((_local10 + "=") + _local9));
} else {
if ((_local9 is Boolean)){
_local5 = (_local5 + ((_local10 + "=") + (_local9) ? "true" : "false"));
} else {
if ((_local9 is Array)){
_local5 = (_local5 + internalArrayToString((_local9 as Array), _arg2, _local10, _arg4));
} else {
_local5 = (_local5 + internalObjectToString(_local9, _arg2, _local10, _arg4));
};
};
};
};
_local8++;
};
return (_local5);
}
public static function objectToString(_arg1:Object, _arg2:String=";", _arg3:Boolean=true):String{
var _local4:String = internalObjectToString(_arg1, _arg2, null, _arg3);
return (_local4);
}
public static function replaceTokens(_arg1:String):String{
var _local4:String;
var _local5:String;
var _local6:uint;
var _local2:String = ((LoaderConfig.url == null)) ? "" : LoaderConfig.url;
if (_arg1.indexOf(SERVER_NAME_TOKEN) > 0){
_local4 = URLUtil.getProtocol(_local2);
_local5 = "localhost";
if (_local4.toLowerCase() != "file"){
_local5 = URLUtil.getServerName(_local2);
};
_arg1 = _arg1.replace(SERVER_NAME_REGEX, _local5);
};
var _local3:int = _arg1.indexOf(SERVER_PORT_TOKEN);
if (_local3 > 0){
_local6 = URLUtil.getPort(_local2);
if (_local6 > 0){
_arg1 = _arg1.replace(SERVER_PORT_REGEX, _local6);
} else {
if (_arg1.charAt((_local3 - 1)) == ":"){
_arg1 = (_arg1.substring(0, (_local3 - 1)) + _arg1.substring(_local3));
};
_arg1 = _arg1.replace(SERVER_PORT_REGEX, "");
};
};
return (_arg1);
}
public static function getPort(_arg1:String):uint{
var _local5:Number;
var _local2:String = getServerNameWithPort(_arg1);
var _local3:int = _local2.indexOf("]");
_local3 = ((_local3)>-1) ? _local2.indexOf(":", _local3) : _local2.indexOf(":");
var _local4:uint;
if (_local3 > 0){
_local5 = Number(_local2.substring((_local3 + 1)));
if (!isNaN(_local5)){
_local4 = int(_local5);
};
};
return (_local4);
}
public static function stringToObject(_arg1:String, _arg2:String=";", _arg3:Boolean=true):Object{
var _local8:Array;
var _local9:String;
var _local10:Object;
var _local11:Object;
var _local12:int;
var _local13:int;
var _local14:Object;
var _local15:String;
var _local16:String;
var _local17:Object;
var _local4:Object = {};
var _local5:Array = _arg1.split(_arg2);
var _local6:int = _local5.length;
var _local7:int;
while (_local7 < _local6) {
_local8 = _local5[_local7].split("=");
_local9 = _local8[0];
if (_arg3){
_local9 = decodeURIComponent(_local9);
};
_local10 = _local8[1];
if (_arg3){
_local10 = decodeURIComponent((_local10 as String));
};
if (_local10 == "true"){
_local10 = true;
} else {
if (_local10 == "false"){
_local10 = false;
} else {
_local14 = int(_local10);
if (_local14.toString() == _local10){
_local10 = _local14;
} else {
_local14 = Number(_local10);
if (_local14.toString() == _local10){
_local10 = _local14;
};
};
};
};
_local11 = _local4;
_local8 = _local9.split(".");
_local12 = _local8.length;
_local13 = 0;
while (_local13 < (_local12 - 1)) {
_local15 = _local8[_local13];
if ((((_local11[_local15] == null)) && ((_local13 < (_local12 - 1))))){
_local16 = _local8[(_local13 + 1)];
_local17 = int(_local16);
if (_local17.toString() == _local16){
_local11[_local15] = [];
} else {
_local11[_local15] = {};
};
};
_local11 = _local11[_local15];
_local13++;
};
_local11[_local8[_local13]] = _local10;
_local7++;
};
return (_local4);
}
public static function replacePort(_arg1:String, _arg2:uint):String{
var _local6:int;
var _local3 = "";
var _local4:int = _arg1.indexOf("]");
if (_local4 == -1){
_local4 = _arg1.indexOf(":");
};
var _local5:int = _arg1.indexOf(":", (_local4 + 1));
if (_local5 > -1){
_local5++;
_local6 = _arg1.indexOf("/", _local5);
_local3 = ((_arg1.substring(0, _local5) + _arg2.toString()) + _arg1.substring(_local6, _arg1.length));
} else {
_local6 = _arg1.indexOf("/", _local4);
if (_local6 > -1){
if (_arg1.charAt((_local6 + 1)) == "/"){
_local6 = _arg1.indexOf("/", (_local6 + 2));
};
if (_local6 > 0){
_local3 = (((_arg1.substring(0, _local6) + ":") + _arg2.toString()) + _arg1.substring(_local6, _arg1.length));
} else {
_local3 = ((_arg1 + ":") + _arg2.toString());
};
} else {
_local3 = ((_arg1 + ":") + _arg2.toString());
};
};
return (_local3);
}
public static function isHttpURL(_arg1:String):Boolean{
return (((!((_arg1 == null))) && ((((_arg1.indexOf("http://") == 0)) || ((_arg1.indexOf("https://") == 0))))));
}
}
}//package mx.utils
Section 197
//XMLNotifier (mx.utils.XMLNotifier)
package mx.utils {
import mx.core.*;
import flash.utils.*;
public class XMLNotifier {
mx_internal static const VERSION:String = "3.0.0.0";
private static var instance:XMLNotifier;
public function XMLNotifier(_arg1:XMLNotifierSingleton){
}
public function watchXML(_arg1:Object, _arg2:IXMLNotifiable, _arg3:String=null):void{
var _local6:Dictionary;
var _local4:XML = XML(_arg1);
var _local5:Object = _local4.notification();
if (!(_local5 is Function)){
_local5 = initializeXMLForNotification();
_local4.setNotification((_local5 as Function));
if (((_arg3) && ((_local5["uid"] == null)))){
_local5["uid"] = _arg3;
};
};
if (_local5["watched"] == undefined){
_local6 = new Dictionary(true);
_local5["watched"] = _local6;
} else {
_local6 = _local5["watched"];
};
_local6[_arg2] = true;
}
public function unwatchXML(_arg1:Object, _arg2:IXMLNotifiable):void{
var _local5:Dictionary;
var _local3:XML = XML(_arg1);
var _local4:Object = _local3.notification();
if (!(_local4 is Function)){
return;
};
if (_local4["watched"] != undefined){
_local5 = _local4["watched"];
delete _local5[_arg2];
};
}
public static function getInstance():XMLNotifier{
if (!instance){
instance = new XMLNotifier(new XMLNotifierSingleton());
};
return (instance);
}
mx_internal static function initializeXMLForNotification():Function{
var notificationFunction:Function = function (_arg1:Object, _arg2:String, _arg3:Object, _arg4:Object, _arg5:Object):void{
var _local8:Object;
var _local7:Dictionary = arguments.callee.watched;
if (_local7 != null){
for (_local8 in _local7) {
IXMLNotifiable(_local8).xmlNotification(_arg1, _arg2, _arg3, _arg4, _arg5);
};
};
};
return (notificationFunction);
}
}
}//package mx.utils
class XMLNotifierSingleton {
private function XMLNotifierSingleton(){
}
}
Section 198
//XMLUtil (mx.utils.XMLUtil)
package mx.utils {
import mx.core.*;
import flash.xml.*;
public class XMLUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function createXMLDocument(_arg1:String):XMLDocument{
var _local2:XMLDocument = new XMLDocument();
_local2.ignoreWhite = true;
_local2.parseXML(_arg1);
return (_local2);
}
public static function qnamesEqual(_arg1:QName, _arg2:QName):Boolean{
return ((((_arg1.uri == _arg2.uri)) && ((_arg1.localName == _arg2.localName))));
}
public static function getAttributeByQName(_arg1:XML, _arg2:QName):XMLList{
var _local4:XML;
var _local5:QName;
var _local3:XMLList = _arg1.attribute(_arg2);
for each (_local4 in _local3) {
_local5 = _local4.name();
if (_local5.uri == _arg2.uri){
return (new XMLList(_local4));
};
};
return (new XMLList());
}
public static function qnameToString(_arg1:QName):String{
return ((((_arg1.uri) && (!((_arg1.uri == ""))))) ? ((_arg1.uri + ":") + _arg1.localName) : _arg1.localName);
}
}
}//package mx.utils
Section 199
//_CompiledResourceBundleInfo (_CompiledResourceBundleInfo)
package {
public class _CompiledResourceBundleInfo {
public static function get compiledLocales():Array{
return (["en_US"]);
}
public static function get compiledResourceBundleNames():Array{
return (["collections", "logging", "rpc", "utils"]);
}
}
}//package
Section 200
//en_US$collections_properties (en_US$collections_properties)
package {
import mx.resources.*;
public class en_US$collections_properties extends ResourceBundle {
public function en_US$collections_properties(){
super("en_US", "collections");
}
override protected function getContent():Object{
var _local1:Object = {findCondition:"Find criteria must contain all sort fields leading up to '{0}'.", noComparatorSortField:"Cannot determine comparator for SortField with name '{0}'.", outOfBounds:"Index '{0}' specified is out of bounds.", nonUnique:"Non-unique values in items.", incorrectAddition:"Attempt to add an item already in the view.", findRestriction:"Find criteria must contain at least one sort field value.", invalidType:"Incorrect type. Must be of type XML or a XMLList that contains one XML object. ", unknownMode:"Unknown find mode.", invalidIndex:"Invalid index: '{0}'.", invalidRemove:"Cannot remove when current is beforeFirst or afterLast.", unknownProperty:"Unknown Property: '{0}'.", invalidInsert:"Cannot insert when current is beforeFirst.", itemNotFound:"Cannot find when view is not sorted.", bookmarkInvalid:"Bookmark no longer valid.", noComparator:"Cannot determine comparator for '{0}'.", invalidCursor:"Cursor no longer valid.", noItems:"No items to search.", bookmarkNotFound:"Bookmark is not from this view."};
return (_local1);
}
}
}//package
Section 201
//en_US$logging_properties (en_US$logging_properties)
package {
import mx.resources.*;
public class en_US$logging_properties extends ResourceBundle {
public function en_US$logging_properties(){
super("en_US", "logging");
}
override protected function getContent():Object{
var _local1:Object = {invalidTarget:"Invalid target specified.", charsInvalid:"Error for filter '{0}': The following characters are not valid: []~$^&/(){}<>+=_-`!@#%?,:;'\".", charPlacement:"Error for filter '{0}': '*' must be the right most character.", levelLimit:"Level must be less than LogEventLevel.ALL.", invalidChars:"Categories can not contain any of the following characters: []`~,!@#$%*^&()]{}+=|';?><./\".", invalidLen:"Categories must be at least one character in length."};
return (_local1);
}
}
}//package
Section 202
//en_US$rpc_properties (en_US$rpc_properties)
package {
import mx.resources.*;
public class en_US$rpc_properties extends ResourceBundle {
public function en_US$rpc_properties(){
super("en_US", "rpc");
}
override protected function getContent():Object{
var _local1:Object = {noBaseSchemaAddress:"Cannot resolve relative schema import without a fully qualified base address.", unrecognizedPortTypeName:"The WSDL parser couldn't find a portType named '{0}' in namespace '{1}'", noListenerForHeader:"No event listener for header {0}", cannotConnectToDestination:"Couldn't establish a connection to '{0}'", unexpectedException:"Runtime exception {0}", noServiceElement.details:"No <wsdl:service> elements found in WSDL at {0}.", unableToLoadWSDL:"Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL ({0})", errorWhileLoadingFromParent:"Error while loading imported schema from parent location: {0}", unexpectedSchemaException:"Error while importing schema: {0}", unrecognizedBindingName:"The WSDL parser couldn't find a binding named '{0}' in namespace '{1}'", cannotResetService:"Cannot reset the service of an Operation", mustSpecifyWSDLLocation:"You must specify the WSDL location with useProxy set to false.", urlNotSpecified:"A URL must be specified with useProxy set to false.", unexpectedInputParameter:"Unexpected parameter '{0}' found in input arguments.", noBaseWSDLAddress:"Cannot resolve relative WSDL import without a fully qualified base address.", noListenerForEvent:"An event was received for which no listener was defined. Please add an event listener. {0}", unknownSchemaVersion:"Unknown schema version", missingInputParameter:"Array of input arguments did not contain a required parameter at position {0}", unrecognizedNamespace:"The WSDL parser had no registered document for the namespace '{0}'", multiplePortsFound:"A valid port was not specified. Unable to select a default port as there are multiple ports in the WSDL file.", wsdlDefinitionsNotFirst:"Definitions must be the first element in a WSDL document", xmlEncodeReturnNoXMLNode:"xmlEncode did not return XMLNode", xmlDecodeReturnNull:"xmlDecode returned null", tooFewInputParameters:"Too few parameters - expected at least {0} but found {1}", noPortsInWSDL:"There are no valid ports in the WSDL file for the {0} service.", invalidResultFormat:"Invalid resultFormat '{0}' valid formats are [{1}, {2}, {3}, {4}, {5}]", unrecognizedMessageName:"The WSDL parser couldn't find a message named '{0}' in namespace '{1}'", operationsNotAllowedInService:"Cannot assign operations into an RPC Service ({0})", badSchemaNode:"Bad schema node", noSuchServiceInWSDL:"The requested service '{0}' was not found in the WSDL file.", destinationOrWSDLNotSpecified:"A destination and/or WSDL must be specified.", noBaseWSDLAddress.details:"Please specify the location of the WSDL document for the WebService.", missingInputParameterWithName:"Required parameter '{0}' not found in input arguments.", badElement:"Element {0}:{1} not resolvable", overloadedOperation:"The WSDL contains an overloaded operation ({0}) - we do not currently support this usage.", defaultDecoderFailed:"Default decoder could not decode result", faultyWSDLFormat:"Faulty WSDL format", soapVersionMismatch:"Request implements version: {0}, Response implements version {1}", badType:"Type {0} not resolvable", noSuchService:"Couldn't find service '{0}'", cannotResetOperationName:"Cannot reset the name of an Operation", unknownSchemaElement:"Unknown element: {0}", pendingCallExists:"Attempt to invoke while another call is pending. Either change concurrency options or avoid multiple calls.", noServiceAndPort:"Couldn't find a matching port (service = '{0}', port = '{1}')", noServices:"There are no valid services in the WSDL file.", unknownProtocol:"Unknown protocol '{0}'", unknownSchemaType:"Unknown schema type system", invalidSoapResultFormat:"Invalid resultFormat '{0}'. Valid formats are 'object', 'xml', and 'e4x'", xmlEncodeReturnNull:"xmlEncode returned null", cannotFindType:"Cannot find type for: {0}", noServiceElement:"Could not load WSDL"};
return (_local1);
}
}
}//package
Section 203
//en_US$utils_properties (en_US$utils_properties)
package {
import mx.resources.*;
public class en_US$utils_properties extends ResourceBundle {
public function en_US$utils_properties(){
super("en_US", "utils");
}
override protected function getContent():Object{
var _local1:Object = {partialBlockDropped:"A partial block ({0} of 4 bytes) was dropped. Decoded data is probably truncated!"};
return (_local1);
}
}
}//package