Guest User

dd

a guest
Dec 20th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package {
  2.     import flash.net.*;
  3.  
  4.     class FileItem {
  5.  
  6.         private static var file_id_sequence:Number = 0;
  7.         public static var FILE_STATUS_QUEUED:int = -1;
  8.         public static var FILE_STATUS_IN_PROGRESS:int = -2;
  9.         public static var FILE_STATUS_ERROR:int = -3;
  10.         public static var FILE_STATUS_SUCCESS:int = -4;
  11.         public static var FILE_STATUS_CANCELLED:int = -5;
  12.         public static var FILE_STATUS_NEW:int = -6;
  13.  
  14.         private var postObject:Object;
  15.         public var file_reference:FileReference;
  16.         public var id:String;
  17.         public var index:Number = -1;
  18.         public var file_status:int = 0;
  19.         private var js_object:Object;
  20.  
  21.         public function FileItem(_arg1:FileReference, _arg2:String, _arg3:Number){
  22.             var file_reference:* = _arg1;
  23.             var control_id:* = _arg2;
  24.             var index:* = _arg3;
  25.             super();
  26.             this.postObject = {};
  27.             this.file_reference = file_reference;
  28.             this.id = ((control_id + "_") + FileItem.file_id_sequence++);
  29.             this.file_status = FileItem.FILE_STATUS_NEW;
  30.             this.index = index;
  31.             this.js_object = {
  32.                 id:this.id,
  33.                 index:this.index,
  34.                 post:this.GetPostObject()
  35.             };
  36.             try {
  37.                 this.js_object.name = this.file_reference.name;
  38.                 this.js_object.size = this.file_reference.size;
  39.                 this.js_object.type = ((this.file_reference.type) || (""));
  40.                 this.js_object.creationdate = ((this.file_reference.creationDate) || (new Date(0)));
  41.                 this.js_object.modificationdate = ((this.file_reference.modificationDate) || (new Date(0)));
  42.             } catch(ex:Error) {
  43.                 this.file_status = FileItem.FILE_STATUS_ERROR;
  44.             };
  45.             this.js_object.filestatus = this.file_status;
  46.         }
  47.         public static function EscapeParamName(_arg1:String):String{
  48.             _arg1 = _arg1.replace(/[^a-z0-9_]/gi, FileItem.EscapeCharacter);
  49.             _arg1 = _arg1.replace(/^[0-9]/, FileItem.EscapeCharacter);
  50.             return (_arg1);
  51.         }
  52.         public static function EscapeCharacter():String{
  53.             return (("$" + ("0000" + arguments[0].charCodeAt(0).toString(16)).substr(-4, 4)));
  54.         }
  55.  
  56.         public function AddParam(_arg1:String, _arg2:String):void{
  57.             this.postObject[_arg1] = _arg2;
  58.         }
  59.         public function RemoveParam(_arg1:String):void{
  60.             delete this.postObject[_arg1];
  61.         }
  62.         public function GetPostObject(_arg1:Boolean=false):Object{
  63.             var _local2:Object;
  64.             var _local3:String;
  65.             var _local4:String;
  66.             if (_arg1){
  67.                 _local2 = {};
  68.                 for (_local3 in this.postObject) {
  69.                     if (this.postObject.hasOwnProperty(_local3)){
  70.                         _local4 = FileItem.EscapeParamName(_local3);
  71.                         _local2[_local4] = this.postObject[_local3];
  72.                     };
  73.                 };
  74.                 return (_local2);
  75.             };
  76.             return (this.postObject);
  77.         }
  78.         public function ToJavaScriptObject():Object{
  79.             this.js_object.filestatus = this.file_status;
  80.             this.js_object.post = this.GetPostObject(true);
  81.             return (this.js_object);
  82.         }
  83.         public function toString():String{
  84.             return (("FileItem - ID: " + this.id));
  85.         }
  86.  
  87.     }
  88. }//package
  89. package {
  90.     import flash.external.*;
  91.  
  92.     class ExternalCall {
  93.  
  94.         public static function Simple(_arg1:String):void{
  95.             ExternalInterface.call(_arg1);
  96.         }
  97.         public static function FileQueued(_arg1:String, _arg2:Object):void{
  98.             ExternalInterface.call(_arg1, EscapeMessage(_arg2));
  99.         }
  100.         public static function FileQueueError(_arg1:String, _arg2:Number, _arg3:Object, _arg4:String):void{
  101.             ExternalInterface.call(_arg1, EscapeMessage(_arg3), EscapeMessage(_arg2), EscapeMessage(_arg4));
  102.         }
  103.         public static function FileDialogComplete(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number):void{
  104.             ExternalInterface.call(_arg1, EscapeMessage(_arg2), EscapeMessage(_arg3), EscapeMessage(_arg4));
  105.         }
  106.         public static function UploadStart(_arg1:String, _arg2:Object):void{
  107.             ExternalInterface.call(_arg1, EscapeMessage(_arg2));
  108.         }
  109.         public static function UploadProgress(_arg1:String, _arg2:Object, _arg3:uint, _arg4:uint):void{
  110.             ExternalInterface.call(_arg1, EscapeMessage(_arg2), EscapeMessage(_arg3), EscapeMessage(_arg4));
  111.         }
  112.         public static function UploadSuccess(_arg1:String, _arg2:Object, _arg3:String, _arg4:Boolean):void{
  113.             ExternalInterface.call(_arg1, EscapeMessage(_arg2), EscapeMessage(_arg3), EscapeMessage(_arg4));
  114.         }
  115.         public static function UploadError(_arg1:String, _arg2:Number, _arg3:Object, _arg4:String):void{
  116.             ExternalInterface.call(_arg1, EscapeMessage(_arg3), EscapeMessage(_arg2), EscapeMessage(_arg4));
  117.         }
  118.         public static function UploadComplete(_arg1:String, _arg2:Object):void{
  119.             ExternalInterface.call(_arg1, EscapeMessage(_arg2));
  120.         }
  121.         public static function Debug(_arg1:String, _arg2:String):void{
  122.             ExternalInterface.call(_arg1, EscapeMessage(_arg2));
  123.         }
  124.         public static function Bool(_arg1:String):Boolean{
  125.             return (ExternalInterface.call(_arg1));
  126.         }
  127.         private static function EscapeMessage(_arg1){
  128.             if ((_arg1 is String)){
  129.                 _arg1 = EscapeString(_arg1);
  130.             } else {
  131.                 if ((_arg1 is Array)){
  132.                     _arg1 = EscapeArray(_arg1);
  133.                 } else {
  134.                     if ((_arg1 is Object)){
  135.                         _arg1 = EscapeObject(_arg1);
  136.                     };
  137.                 };
  138.             };
  139.             return (_arg1);
  140.         }
  141.         private static function EscapeString(_arg1:String):String{
  142.             var _local2:RegExp = /\\/g;
  143.             return (_arg1.replace(_local2, "\\\\"));
  144.         }
  145.         private static function EscapeArray(_arg1:Array):Array{
  146.             var _local2:uint = _arg1.length;
  147.             var _local3:uint;
  148.             while (_local3 < _local2) {
  149.                 _arg1[_local3] = EscapeMessage(_arg1[_local3]);
  150.                 _local3++;
  151.             };
  152.             return (_arg1);
  153.         }
  154.         private static function EscapeObject(_arg1:Object):Object{
  155.             var _local2:String;
  156.             for (_local2 in _arg1) {
  157.                 _arg1[_local2] = EscapeMessage(_arg1[_local2]);
  158.             };
  159.             return (_arg1);
  160.         }
  161.  
  162.     }
  163. }//package
  164. package {
  165.     import flash.events.*;
  166.     import flash.net.*;
  167.     import flash.display.*;
  168.     import flash.utils.*;
  169.     import flash.text.*;
  170.     import flash.external.*;
  171.     import flash.xml.*;
  172.  
  173.     public class SWFUpload extends Sprite {
  174.  
  175.         private const build_number:String = "SWFUPLOAD 2.2.0";
  176.  
  177.         private var fileBrowserMany:FileReferenceList;
  178.         private var fileBrowserOne:FileReference = null;
  179.         private var file_queue:Array;
  180.         private var current_file_item:FileItem = null;
  181.         private var file_index:Array;
  182.         private var successful_uploads:Number = 0;
  183.         private var queue_errors:Number = 0;
  184.         private var upload_errors:Number = 0;
  185.         private var upload_cancelled:Number = 0;
  186.         private var queued_uploads:Number = 0;
  187.         private var valid_file_extensions:Array;
  188.         private var serverDataTimer:Timer = null;
  189.         private var assumeSuccessTimer:Timer = null;
  190.         private var restoreExtIntTimer:Timer;
  191.         private var hasCalledFlashReady:Boolean = false;
  192.         private var flashReady_Callback:String;
  193.         private var fileDialogStart_Callback:String;
  194.         private var fileQueued_Callback:String;
  195.         private var fileQueueError_Callback:String;
  196.         private var fileDialogComplete_Callback:String;
  197.         private var uploadStart_Callback:String;
  198.         private var uploadProgress_Callback:String;
  199.         private var uploadError_Callback:String;
  200.         private var uploadSuccess_Callback:String;
  201.         private var uploadComplete_Callback:String;
  202.         private var debug_Callback:String;
  203.         private var testExternalInterface_Callback:String;
  204.         private var cleanUp_Callback:String;
  205.         private var movieName:String;
  206.         private var uploadURL:String;
  207.         private var filePostName:String;
  208.         private var uploadPostObject:Object;
  209.         private var fileTypes:String;
  210.         private var fileTypesDescription:String;
  211.         private var fileSizeLimit:Number;
  212.         private var fileUploadLimit:Number = 0;
  213.         private var fileQueueLimit:Number = 0;
  214.         private var useQueryString:Boolean = false;
  215.         private var requeueOnError:Boolean = false;
  216.         private var httpSuccess:Array;
  217.         private var assumeSuccessTimeout:Number = 0;
  218.         private var debugEnabled:Boolean;
  219.         private var buttonLoader:Loader;
  220.         private var buttonTextField:TextField;
  221.         private var buttonCursorSprite:Sprite;
  222.         private var buttonImageURL:String;
  223.         private var buttonWidth:Number;
  224.         private var buttonHeight:Number;
  225.         private var buttonText:String;
  226.         private var buttonTextStyle:String;
  227.         private var buttonTextTopPadding:Number;
  228.         private var buttonTextLeftPadding:Number;
  229.         private var buttonAction:Number;
  230.         private var buttonCursor:Number;
  231.         private var buttonStateOver:Boolean;
  232.         private var buttonStateMouseDown:Boolean;
  233.         private var buttonStateDisabled:Boolean;
  234.         private var SIZE_TOO_BIG:Number = 1;
  235.         private var SIZE_ZERO_BYTE:Number = -1;
  236.         private var SIZE_OK:Number = 0;
  237.         private var ERROR_CODE_QUEUE_LIMIT_EXCEEDED:Number = -100;
  238.         private var ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:Number = -110;
  239.         private var ERROR_CODE_ZERO_BYTE_FILE:Number = -120;
  240.         private var ERROR_CODE_INVALID_FILETYPE:Number = -130;
  241.         private var ERROR_CODE_HTTP_ERROR:Number = -200;
  242.         private var ERROR_CODE_MISSING_UPLOAD_URL:Number = -210;
  243.         private var ERROR_CODE_IO_ERROR:Number = -220;
  244.         private var ERROR_CODE_SECURITY_ERROR:Number = -230;
  245.         private var ERROR_CODE_UPLOAD_LIMIT_EXCEEDED:Number = -240;
  246.         private var ERROR_CODE_UPLOAD_FAILED:Number = -250;
  247.         private var ERROR_CODE_SPECIFIED_FILE_ID_NOT_FOUND:Number = -260;
  248.         private var ERROR_CODE_FILE_VALIDATION_FAILED:Number = -270;
  249.         private var ERROR_CODE_FILE_CANCELLED:Number = -280;
  250.         private var ERROR_CODE_UPLOAD_STOPPED:Number = -290;
  251.         private var BUTTON_ACTION_SELECT_FILE:Number = -100;
  252.         private var BUTTON_ACTION_SELECT_FILES:Number = -110;
  253.         private var BUTTON_ACTION_START_UPLOAD:Number = -120;
  254.         private var BUTTON_CURSOR_ARROW:Number = -1;
  255.         private var BUTTON_CURSOR_HAND:Number = -2;
  256.  
  257.         public function SWFUpload(){
  258.             var self:* = null;
  259.             var oSelf:* = null;
  260.             this.fileBrowserMany = new FileReferenceList();
  261.             this.file_queue = new Array();
  262.             this.file_index = new Array();
  263.             this.valid_file_extensions = new Array();
  264.             this.httpSuccess = [];
  265.             super();
  266.             if (((((((((((!(FileReferenceList)) || (!(FileReference)))) || (!(URLRequest)))) || (!(ExternalInterface)))) || (!(ExternalInterface.available)))) || (!(DataEvent.UPLOAD_COMPLETE_DATA)))){
  267.                 return;
  268.             };
  269.             var counter:* = 0;
  270.             root.addEventListener(Event.ENTER_FRAME, function ():void{
  271.                 if (++counter > 100){
  272.                     counter = 0;
  273.                 };
  274.             });
  275.             this.fileBrowserMany.addEventListener(Event.SELECT, this.Select_Many_Handler);
  276.             this.fileBrowserMany.addEventListener(Event.CANCEL, this.DialogCancelled_Handler);
  277.             this.stage.align = StageAlign.TOP_LEFT;
  278.             this.stage.scaleMode = StageScaleMode.NO_SCALE;
  279.             this.buttonLoader = new Loader();
  280.             var doNothing:* = function ():void{
  281.             };
  282.             this.buttonLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, doNothing);
  283.             this.buttonLoader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, doNothing);
  284.             this.stage.addChild(this.buttonLoader);
  285.             self = this;
  286.             this.stage.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent):void{
  287.                 self.UpdateButtonState();
  288.                 self.ButtonClickHandler(_arg1);
  289.             });
  290.             this.stage.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:MouseEvent):void{
  291.                 self.buttonStateMouseDown = true;
  292.                 self.UpdateButtonState();
  293.             });
  294.             this.stage.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:MouseEvent):void{
  295.                 self.buttonStateMouseDown = false;
  296.                 self.UpdateButtonState();
  297.             });
  298.             this.stage.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent):void{
  299.                 self.buttonStateMouseDown = _arg1.buttonDown;
  300.                 self.buttonStateOver = true;
  301.                 self.UpdateButtonState();
  302.             });
  303.             this.stage.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent):void{
  304.                 self.buttonStateMouseDown = false;
  305.                 self.buttonStateOver = false;
  306.                 self.UpdateButtonState();
  307.             });
  308.             this.stage.addEventListener(Event.MOUSE_LEAVE, function (_arg1:Event):void{
  309.                 self.buttonStateMouseDown = false;
  310.                 self.buttonStateOver = false;
  311.                 self.UpdateButtonState();
  312.             });
  313.             this.buttonTextField = new TextField();
  314.             this.buttonTextField.type = TextFieldType.DYNAMIC;
  315.             this.buttonTextField.antiAliasType = AntiAliasType.ADVANCED;
  316.             this.buttonTextField.autoSize = TextFieldAutoSize.NONE;
  317.             this.buttonTextField.cacheAsBitmap = true;
  318.             this.buttonTextField.multiline = true;
  319.             this.buttonTextField.wordWrap = false;
  320.             this.buttonTextField.tabEnabled = false;
  321.             this.buttonTextField.background = false;
  322.             this.buttonTextField.border = false;
  323.             this.buttonTextField.selectable = false;
  324.             this.buttonTextField.condenseWhite = true;
  325.             this.stage.addChild(this.buttonTextField);
  326.             this.buttonCursorSprite = new Sprite();
  327.             this.buttonCursorSprite.graphics.beginFill(0xFFFFFF, 0);
  328.             this.buttonCursorSprite.graphics.drawRect(0, 0, 1, 1);
  329.             this.buttonCursorSprite.graphics.endFill();
  330.             this.buttonCursorSprite.buttonMode = true;
  331.             this.buttonCursorSprite.x = 0;
  332.             this.buttonCursorSprite.y = 0;
  333.             this.buttonCursorSprite.addEventListener(MouseEvent.CLICK, doNothing);
  334.             this.stage.addChild(this.buttonCursorSprite);
  335.             this.movieName = ((root.loaderInfo.parameters.movieName) || (""));
  336.             this.movieName = this.movieName.replace(/[^a-zA-Z0-9\_\.\-]/g, "");
  337.             this.flashReady_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].flashReady");
  338.             this.fileDialogStart_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].fileDialogStart");
  339.             this.fileQueued_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].fileQueued");
  340.             this.fileQueueError_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].fileQueueError");
  341.             this.fileDialogComplete_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].fileDialogComplete");
  342.             this.uploadStart_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].uploadStart");
  343.             this.uploadProgress_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].uploadProgress");
  344.             this.uploadError_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].uploadError");
  345.             this.uploadSuccess_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].uploadSuccess");
  346.             this.uploadComplete_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].uploadComplete");
  347.             this.debug_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].debug");
  348.             this.testExternalInterface_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].testExternalInterface");
  349.             this.cleanUp_Callback = (("SWFUpload.instances[\"" + this.movieName) + "\"].cleanUp");
  350.             this.uploadURL = root.loaderInfo.parameters.uploadURL;
  351.             this.filePostName = root.loaderInfo.parameters.filePostName;
  352.             this.fileTypes = root.loaderInfo.parameters.fileTypes;
  353.             this.fileTypesDescription = (((root.loaderInfo.parameters.fileTypesDescription + " (") + this.fileTypes) + ")");
  354.             this.loadPostParams(root.loaderInfo.parameters.params);
  355.             if (!this.filePostName){
  356.                 this.filePostName = "Filedata";
  357.             };
  358.             if (!this.fileTypes){
  359.                 this.fileTypes = "*.*";
  360.             };
  361.             if (!this.fileTypesDescription){
  362.                 this.fileTypesDescription = "All Files";
  363.             };
  364.             this.LoadFileExensions(this.fileTypes);
  365.             try {
  366.                 this.debugEnabled = ((root.loaderInfo.parameters.debugEnabled == "true")) ? true : false;
  367.             } catch(ex:Object) {
  368.                 this.debugEnabled = false;
  369.             };
  370.             try {
  371.                 this.SetFileSizeLimit(String(root.loaderInfo.parameters.fileSizeLimit));
  372.             } catch(ex:Object) {
  373.                 this.fileSizeLimit = 0;
  374.             };
  375.             try {
  376.                 this.fileUploadLimit = Number(root.loaderInfo.parameters.fileUploadLimit);
  377.                 if (this.fileUploadLimit < 0){
  378.                     this.fileUploadLimit = 0;
  379.                 };
  380.             } catch(ex:Object) {
  381.                 this.fileUploadLimit = 0;
  382.             };
  383.             try {
  384.                 this.fileQueueLimit = Number(root.loaderInfo.parameters.fileQueueLimit);
  385.                 if (this.fileQueueLimit < 0){
  386.                     this.fileQueueLimit = 0;
  387.                 };
  388.             } catch(ex:Object) {
  389.                 this.fileQueueLimit = 0;
  390.             };
  391.             if ((((this.fileQueueLimit > this.fileUploadLimit)) && (!((this.fileUploadLimit == 0))))){
  392.                 this.fileQueueLimit = this.fileUploadLimit;
  393.             };
  394.             if ((((this.fileQueueLimit == 0)) && (!((this.fileUploadLimit == 0))))){
  395.                 this.fileQueueLimit = this.fileUploadLimit;
  396.             };
  397.             try {
  398.                 this.useQueryString = ((root.loaderInfo.parameters.useQueryString == "true")) ? true : false;
  399.             } catch(ex:Object) {
  400.                 this.useQueryString = false;
  401.             };
  402.             try {
  403.                 this.requeueOnError = ((root.loaderInfo.parameters.requeueOnError == "true")) ? true : false;
  404.             } catch(ex:Object) {
  405.                 this.requeueOnError = false;
  406.             };
  407.             try {
  408.                 this.SetHTTPSuccess(String(root.loaderInfo.parameters.httpSuccess));
  409.             } catch(ex:Object) {
  410.                 this.SetHTTPSuccess([]);
  411.             };
  412.             try {
  413.                 this.SetAssumeSuccessTimeout(Number(root.loaderInfo.parameters.assumeSuccessTimeout));
  414.             } catch(ex:Object) {
  415.                 this.SetAssumeSuccessTimeout(0);
  416.             };
  417.             try {
  418.                 this.SetButtonDimensions(Number(root.loaderInfo.parameters.buttonWidth), Number(root.loaderInfo.parameters.buttonHeight));
  419.             } catch(ex:Object) {
  420.                 this.SetButtonDimensions(0, 0);
  421.             };
  422.             try {
  423.                 this.SetButtonImageURL(String(root.loaderInfo.parameters.buttonImageURL));
  424.             } catch(ex:Object) {
  425.                 this.SetButtonImageURL("");
  426.             };
  427.             try {
  428.                 this.SetButtonText(this.htmlEscape(String(root.loaderInfo.parameters.buttonText)));
  429.             } catch(ex:Object) {
  430.                 this.SetButtonText("");
  431.             };
  432.             try {
  433.                 this.SetButtonTextPadding(Number(root.loaderInfo.parameters.buttonTextLeftPadding), Number(root.loaderInfo.parameters.buttonTextTopPadding));
  434.             } catch(ex:Object) {
  435.                 this.SetButtonTextPadding(0, 0);
  436.             };
  437.             try {
  438.                 this.SetButtonTextStyle(String(root.loaderInfo.parameters.buttonTextStyle));
  439.             } catch(ex:Object) {
  440.                 this.SetButtonTextStyle("");
  441.             };
  442.             try {
  443.                 this.SetButtonAction(Number(root.loaderInfo.parameters.buttonAction));
  444.             } catch(ex:Object) {
  445.                 this.SetButtonAction(this.BUTTON_ACTION_SELECT_FILES);
  446.             };
  447.             try {
  448.                 this.SetButtonDisabled(((root.loaderInfo.parameters.buttonDisabled == "true")) ? true : false);
  449.             } catch(ex:Object) {
  450.                 this.SetButtonDisabled(Boolean(false));
  451.             };
  452.             try {
  453.                 this.SetButtonCursor(Number(root.loaderInfo.parameters.buttonCursor));
  454.             } catch(ex:Object) {
  455.                 this.SetButtonCursor(this.BUTTON_CURSOR_ARROW);
  456.             };
  457.             this.SetupExternalInterface();
  458.             this.Debug("SWFUpload Init Complete");
  459.             this.PrintDebugInfo();
  460.             if (ExternalCall.Bool(this.testExternalInterface_Callback)){
  461.                 ExternalCall.Simple(this.flashReady_Callback);
  462.                 this.hasCalledFlashReady = true;
  463.             };
  464.             oSelf = this;
  465.             this.restoreExtIntTimer = new Timer(1000, 0);
  466.             this.restoreExtIntTimer.addEventListener(TimerEvent.TIMER, function ():void{
  467.                 oSelf.CheckExternalInterface();
  468.             });
  469.             this.restoreExtIntTimer.start();
  470.         }
  471.         public static function main():void{
  472.             var _local1:SWFUpload = new (SWFUpload);
  473.         }
  474.  
  475.         private function CheckExternalInterface():void{
  476.             if (!ExternalCall.Bool(this.testExternalInterface_Callback)){
  477.                 this.SetupExternalInterface();
  478.                 this.Debug("ExternalInterface reinitialized");
  479.                 if (!this.hasCalledFlashReady){
  480.                     ExternalCall.Simple(this.flashReady_Callback);
  481.                     this.hasCalledFlashReady = true;
  482.                 };
  483.             };
  484.         }
  485.         private function TestExternalInterface():Boolean{
  486.             return (true);
  487.         }
  488.         private function SetupExternalInterface():void{
  489.             try {
  490.                 ExternalInterface.addCallback("SelectFile", this.SelectFile);
  491.                 ExternalInterface.addCallback("SelectFiles", this.SelectFiles);
  492.                 ExternalInterface.addCallback("StartUpload", this.StartUpload);
  493.                 ExternalInterface.addCallback("ReturnUploadStart", this.ReturnUploadStart);
  494.                 ExternalInterface.addCallback("StopUpload", this.StopUpload);
  495.                 ExternalInterface.addCallback("CancelUpload", this.CancelUpload);
  496.                 ExternalInterface.addCallback("RequeueUpload", this.RequeueUpload);
  497.                 ExternalInterface.addCallback("GetStats", this.GetStats);
  498.                 ExternalInterface.addCallback("SetStats", this.SetStats);
  499.                 ExternalInterface.addCallback("GetFile", this.GetFile);
  500.                 ExternalInterface.addCallback("GetFileByIndex", this.GetFileByIndex);
  501.                 ExternalInterface.addCallback("AddFileParam", this.AddFileParam);
  502.                 ExternalInterface.addCallback("RemoveFileParam", this.RemoveFileParam);
  503.                 ExternalInterface.addCallback("SetUploadURL", this.SetUploadURL);
  504.                 ExternalInterface.addCallback("SetPostParams", this.SetPostParams);
  505.                 ExternalInterface.addCallback("SetFileTypes", this.SetFileTypes);
  506.                 ExternalInterface.addCallback("SetFileSizeLimit", this.SetFileSizeLimit);
  507.                 ExternalInterface.addCallback("SetFileUploadLimit", this.SetFileUploadLimit);
  508.                 ExternalInterface.addCallback("SetFileQueueLimit", this.SetFileQueueLimit);
  509.                 ExternalInterface.addCallback("SetFilePostName", this.SetFilePostName);
  510.                 ExternalInterface.addCallback("SetUseQueryString", this.SetUseQueryString);
  511.                 ExternalInterface.addCallback("SetRequeueOnError", this.SetRequeueOnError);
  512.                 ExternalInterface.addCallback("SetHTTPSuccess", this.SetHTTPSuccess);
  513.                 ExternalInterface.addCallback("SetAssumeSuccessTimeout", this.SetAssumeSuccessTimeout);
  514.                 ExternalInterface.addCallback("SetDebugEnabled", this.SetDebugEnabled);
  515.                 ExternalInterface.addCallback("SetButtonImageURL", this.SetButtonImageURL);
  516.                 ExternalInterface.addCallback("SetButtonDimensions", this.SetButtonDimensions);
  517.                 ExternalInterface.addCallback("SetButtonText", this.SetButtonText);
  518.                 ExternalInterface.addCallback("SetButtonTextPadding", this.SetButtonTextPadding);
  519.                 ExternalInterface.addCallback("SetButtonTextStyle", this.SetButtonTextStyle);
  520.                 ExternalInterface.addCallback("SetButtonAction", this.SetButtonAction);
  521.                 ExternalInterface.addCallback("SetButtonDisabled", this.SetButtonDisabled);
  522.                 ExternalInterface.addCallback("SetButtonCursor", this.SetButtonCursor);
  523.                 ExternalInterface.addCallback("TestExternalInterface", this.TestExternalInterface);
  524.             } catch(ex:Error) {
  525.                 this.Debug(("Callbacks where not set: " + ex.message));
  526.                 return;
  527.             };
  528.             ExternalCall.Simple(this.cleanUp_Callback);
  529.         }
  530.         private function DialogCancelled_Handler(_arg1:Event):void{
  531.             this.Debug("Event: fileDialogComplete: File Dialog window cancelled.");
  532.             ExternalCall.FileDialogComplete(this.fileDialogComplete_Callback, 0, 0, this.queued_uploads);
  533.         }
  534.         private function Open_Handler(_arg1:Event):void{
  535.             this.Debug(("Event: uploadProgress (OPEN): File ID: " + this.current_file_item.id));
  536.             ExternalCall.UploadProgress(this.uploadProgress_Callback, this.current_file_item.ToJavaScriptObject(), 0, this.current_file_item.file_reference.size);
  537.         }
  538.         private function FileProgress_Handler(_arg1:ProgressEvent):void{
  539.             var _local2:Number = ((_arg1.bytesLoaded < 0)) ? 0 : _arg1.bytesLoaded;
  540.             var _local3:Number = ((_arg1.bytesTotal < 0)) ? 0 : _arg1.bytesTotal;
  541.             if ((((((_local2 === _local3)) && ((_local3 > 0)))) && ((this.assumeSuccessTimeout > 0)))){
  542.                 if (this.assumeSuccessTimer !== null){
  543.                     this.assumeSuccessTimer.stop();
  544.                     this.assumeSuccessTimer = null;
  545.                 };
  546.                 this.assumeSuccessTimer = new Timer((this.assumeSuccessTimeout * 1000), 1);
  547.                 this.assumeSuccessTimer.addEventListener(TimerEvent.TIMER_COMPLETE, this.AssumeSuccessTimer_Handler);
  548.                 this.assumeSuccessTimer.start();
  549.             };
  550.             this.Debug(((((("Event: uploadProgress: File ID: " + this.current_file_item.id) + ". Bytes: ") + _local2) + ". Total: ") + _local3));
  551.             ExternalCall.UploadProgress(this.uploadProgress_Callback, this.current_file_item.ToJavaScriptObject(), _local2, _local3);
  552.         }
  553.         private function AssumeSuccessTimer_Handler(_arg1:TimerEvent):void{
  554.             this.Debug((("Event: AssumeSuccess: " + this.assumeSuccessTimeout) + " passed without server response"));
  555.             this.UploadSuccess(this.current_file_item, "", false);
  556.         }
  557.         private function Complete_Handler(_arg1:Event):void{
  558.             if (this.serverDataTimer != null){
  559.                 this.serverDataTimer.stop();
  560.                 this.serverDataTimer = null;
  561.             };
  562.             this.serverDataTimer = new Timer(100, 1);
  563.             this.serverDataTimer.addEventListener(TimerEvent.TIMER, this.ServerDataTimer_Handler);
  564.             this.serverDataTimer.start();
  565.         }
  566.         private function ServerDataTimer_Handler(_arg1:TimerEvent):void{
  567.             this.UploadSuccess(this.current_file_item, "");
  568.         }
  569.         private function ServerData_Handler(_arg1:DataEvent):void{
  570.             this.UploadSuccess(this.current_file_item, _arg1.data);
  571.         }
  572.         private function UploadSuccess(_arg1:FileItem, _arg2:String, _arg3:Boolean=true):void{
  573.             if (this.serverDataTimer !== null){
  574.                 this.serverDataTimer.stop();
  575.                 this.serverDataTimer = null;
  576.             };
  577.             if (this.assumeSuccessTimer !== null){
  578.                 this.assumeSuccessTimer.stop();
  579.                 this.assumeSuccessTimer = null;
  580.             };
  581.             this.successful_uploads++;
  582.             _arg1.file_status = FileItem.FILE_STATUS_SUCCESS;
  583.             this.Debug(((((("Event: uploadSuccess: File ID: " + _arg1.id) + " Response Received: ") + _arg3.toString()) + " Data: ") + _arg2));
  584.             ExternalCall.UploadSuccess(this.uploadSuccess_Callback, _arg1.ToJavaScriptObject(), _arg2, _arg3);
  585.             this.UploadComplete(false);
  586.         }
  587.         private function HTTPError_Handler(_arg1:HTTPStatusEvent):void{
  588.             var _local4:DataEvent;
  589.             var _local2:Boolean;
  590.             var _local3:Number = 0;
  591.             while (_local3 < this.httpSuccess.length) {
  592.                 if (this.httpSuccess[_local3] === _arg1.status){
  593.                     _local2 = true;
  594.                     break;
  595.                 };
  596.                 _local3++;
  597.             };
  598.             if (_local2){
  599.                 this.Debug((("Event: httpError: Translating status code " + _arg1.status) + " to uploadSuccess"));
  600.                 _local4 = new DataEvent(DataEvent.UPLOAD_COMPLETE_DATA, _arg1.bubbles, _arg1.cancelable, "");
  601.                 this.ServerData_Handler(_local4);
  602.             } else {
  603.                 this.upload_errors++;
  604.                 this.current_file_item.file_status = FileItem.FILE_STATUS_ERROR;
  605.                 this.Debug((((("Event: uploadError: HTTP ERROR : File ID: " + this.current_file_item.id) + ". HTTP Status: ") + _arg1.status) + "."));
  606.                 ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_HTTP_ERROR, this.current_file_item.ToJavaScriptObject(), _arg1.status.toString());
  607.                 this.UploadComplete(true);
  608.             };
  609.         }
  610.         private function IOError_Handler(_arg1:IOErrorEvent):void{
  611.             if (this.current_file_item.file_status != FileItem.FILE_STATUS_ERROR){
  612.                 this.upload_errors++;
  613.                 this.current_file_item.file_status = FileItem.FILE_STATUS_ERROR;
  614.                 this.Debug(((("Event: uploadError : IO Error : File ID: " + this.current_file_item.id) + ". IO Error: ") + _arg1.text));
  615.                 ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_IO_ERROR, this.current_file_item.ToJavaScriptObject(), _arg1.text);
  616.             };
  617.             this.UploadComplete(true);
  618.         }
  619.         private function SecurityError_Handler(_arg1:SecurityErrorEvent):void{
  620.             this.upload_errors++;
  621.             this.current_file_item.file_status = FileItem.FILE_STATUS_ERROR;
  622.             this.Debug(((("Event: uploadError : Security Error : File Number: " + this.current_file_item.id) + ". Error text: ") + _arg1.text));
  623.             ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_SECURITY_ERROR, this.current_file_item.ToJavaScriptObject(), _arg1.text);
  624.             this.UploadComplete(true);
  625.         }
  626.         private function Select_Many_Handler(_arg1:Event):void{
  627.             this.Select_Handler(this.fileBrowserMany.fileList);
  628.         }
  629.         private function Select_One_Handler(_arg1:Event):void{
  630.             var _local2:Array = new Array(1);
  631.             _local2[0] = this.fileBrowserOne;
  632.             this.Select_Handler(_local2);
  633.         }
  634.         private function Select_Handler(_arg1:Array):void{
  635.             var _local4:Number;
  636.             var _local5:Number;
  637.             var _local6:FileItem;
  638.             var _local7:Object;
  639.             var _local8:Boolean;
  640.             var _local9:Number;
  641.             var _local10:Boolean;
  642.             this.Debug("Select Handler: Received the files selected from the dialog. Processing the file list...");
  643.             var _local2:Number = 0;
  644.             var _local3:Number = 0;
  645.             if (this.fileUploadLimit == 0){
  646.                 _local3 = ((this.fileQueueLimit == 0)) ? _arg1.length : (this.fileQueueLimit - this.queued_uploads);
  647.             } else {
  648.                 _local4 = ((this.fileUploadLimit - this.successful_uploads) - this.queued_uploads);
  649.                 if (_local4 < 0){
  650.                     _local4 = 0;
  651.                 };
  652.                 if ((((this.fileQueueLimit == 0)) || ((this.fileQueueLimit >= _local4)))){
  653.                     _local3 = _local4;
  654.                 } else {
  655.                     if (this.fileQueueLimit < _local4){
  656.                         _local3 = (this.fileQueueLimit - this.queued_uploads);
  657.                     };
  658.                 };
  659.             };
  660.             if (_local3 < 0){
  661.                 _local3 = 0;
  662.             };
  663.             if (_local3 < _arg1.length){
  664.                 this.Debug((((("Event: fileQueueError : Selected Files (" + _arg1.length) + ") exceeds remaining Queue size (") + _local3) + ")."));
  665.                 ExternalCall.FileQueueError(this.fileQueueError_Callback, this.ERROR_CODE_QUEUE_LIMIT_EXCEEDED, null, _local3.toString());
  666.             } else {
  667.                 _local5 = 0;
  668.                 while (_local5 < _arg1.length) {
  669.                     _local6 = new FileItem(_arg1[_local5], this.movieName, this.file_index.length);
  670.                     this.file_index[_local6.index] = _local6;
  671.                     _local7 = _local6.ToJavaScriptObject();
  672.                     _local8 = !((_local7.filestatus === FileItem.FILE_STATUS_ERROR));
  673.                     if (_local8){
  674.                         _local9 = this.CheckFileSize(_local6);
  675.                         _local10 = this.CheckFileType(_local6);
  676.                         if ((((_local9 == this.SIZE_OK)) && (_local10))){
  677.                             _local6.file_status = FileItem.FILE_STATUS_QUEUED;
  678.                             this.file_queue.push(_local6);
  679.                             this.queued_uploads++;
  680.                             _local2++;
  681.                             this.Debug(("Event: fileQueued : File ID: " + _local6.id));
  682.                             ExternalCall.FileQueued(this.fileQueued_Callback, _local6.ToJavaScriptObject());
  683.                         } else {
  684.                             if (!_local10){
  685.                                 _local6.file_reference = null;
  686.                                 this.queue_errors++;
  687.                                 this.Debug("Event: fileQueueError : File not of a valid type.");
  688.                                 ExternalCall.FileQueueError(this.fileQueueError_Callback, this.ERROR_CODE_INVALID_FILETYPE, _local6.ToJavaScriptObject(), "File is not an allowed file type.");
  689.                             } else {
  690.                                 if (_local9 == this.SIZE_TOO_BIG){
  691.                                     _local6.file_reference = null;
  692.                                     this.queue_errors++;
  693.                                     this.Debug("Event: fileQueueError : File exceeds size limit.");
  694.                                     ExternalCall.FileQueueError(this.fileQueueError_Callback, this.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT, _local6.ToJavaScriptObject(), "File size exceeds allowed limit.");
  695.                                 } else {
  696.                                     if (_local9 == this.SIZE_ZERO_BYTE){
  697.                                         _local6.file_reference = null;
  698.                                         this.queue_errors++;
  699.                                         this.Debug("Event: fileQueueError : File is zero bytes.");
  700.                                         ExternalCall.FileQueueError(this.fileQueueError_Callback, this.ERROR_CODE_ZERO_BYTE_FILE, _local6.ToJavaScriptObject(), "File is zero bytes and cannot be uploaded.");
  701.                                     };
  702.                                 };
  703.                             };
  704.                         };
  705.                     } else {
  706.                         _local6.file_reference = null;
  707.                         this.queue_errors++;
  708.                         this.Debug("Event: fileQueueError : File is zero bytes or FileReference is invalid.");
  709.                         ExternalCall.FileQueueError(this.fileQueueError_Callback, this.ERROR_CODE_ZERO_BYTE_FILE, _local6.ToJavaScriptObject(), "File is zero bytes or cannot be accessed and cannot be uploaded.");
  710.                     };
  711.                     _local5++;
  712.                 };
  713.             };
  714.             this.Debug(((("Event: fileDialogComplete : Finished processing selected files. Files selected: " + _arg1.length) + ". Files Queued: ") + _local2));
  715.             ExternalCall.FileDialogComplete(this.fileDialogComplete_Callback, _arg1.length, _local2, this.queued_uploads);
  716.         }
  717.         private function SelectFile():void{
  718.             this.fileBrowserOne = new FileReference();
  719.             this.fileBrowserOne.addEventListener(Event.SELECT, this.Select_One_Handler);
  720.             this.fileBrowserOne.addEventListener(Event.CANCEL, this.DialogCancelled_Handler);
  721.             var allowed_file_types:* = "*.*";
  722.             var allowed_file_types_description:* = "All Files";
  723.             if (this.fileTypes.length > 0){
  724.                 allowed_file_types = this.fileTypes;
  725.             };
  726.             if (this.fileTypesDescription.length > 0){
  727.                 allowed_file_types_description = this.fileTypesDescription;
  728.             };
  729.             this.Debug(("Event: fileDialogStart : Browsing files. Single Select. Allowed file types: " + allowed_file_types));
  730.             ExternalCall.Simple(this.fileDialogStart_Callback);
  731.             try {
  732.                 this.fileBrowserOne.browse([new FileFilter(allowed_file_types_description, allowed_file_types)]);
  733.             } catch(ex:Error) {
  734.                 this.Debug(("Exception: " + ex.toString()));
  735.             };
  736.         }
  737.         private function SelectFiles():void{
  738.             var allowed_file_types:* = "*.*";
  739.             var allowed_file_types_description:* = "All Files";
  740.             if (this.fileTypes.length > 0){
  741.                 allowed_file_types = this.fileTypes;
  742.             };
  743.             if (this.fileTypesDescription.length > 0){
  744.                 allowed_file_types_description = this.fileTypesDescription;
  745.             };
  746.             this.Debug(("Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: " + allowed_file_types));
  747.             ExternalCall.Simple(this.fileDialogStart_Callback);
  748.             try {
  749.                 this.fileBrowserMany.browse([new FileFilter(allowed_file_types_description, allowed_file_types)]);
  750.             } catch(ex:Error) {
  751.                 this.Debug(("Exception: " + ex.toString()));
  752.             };
  753.         }
  754.         private function StopUpload():void{
  755.             var _local1:Object;
  756.             if (this.current_file_item != null){
  757.                 this.current_file_item.file_reference.cancel();
  758.                 this.removeFileReferenceEventListeners(this.current_file_item);
  759.                 this.current_file_item.file_status = FileItem.FILE_STATUS_QUEUED;
  760.                 this.file_queue.unshift(this.current_file_item);
  761.                 _local1 = this.current_file_item.ToJavaScriptObject();
  762.                 this.current_file_item = null;
  763.                 this.Debug(("Event: uploadError: upload stopped. File ID: " + _local1.ID));
  764.                 ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_UPLOAD_STOPPED, _local1, "Upload Stopped");
  765.                 this.Debug(("Event: uploadComplete. File ID: " + _local1.ID));
  766.                 ExternalCall.UploadComplete(this.uploadComplete_Callback, _local1);
  767.                 this.Debug("StopUpload(): upload stopped.");
  768.             } else {
  769.                 this.Debug("StopUpload(): No file is currently uploading. Nothing to do.");
  770.             };
  771.         }
  772.         private function CancelUpload(_arg1:String, _arg2:Boolean=true):void{
  773.             var _local4:Number;
  774.             var _local3:FileItem;
  775.             if (((!((this.current_file_item == null))) && ((((this.current_file_item.id == _arg1)) || (!(_arg1)))))){
  776.                 this.current_file_item.file_reference.cancel();
  777.                 this.current_file_item.file_status = FileItem.FILE_STATUS_CANCELLED;
  778.                 this.upload_cancelled++;
  779.                 if (_arg2){
  780.                     this.Debug((("Event: uploadError: File ID: " + this.current_file_item.id) + ". Cancelled current upload"));
  781.                     ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_FILE_CANCELLED, this.current_file_item.ToJavaScriptObject(), "File Upload Cancelled.");
  782.                 } else {
  783.                     this.Debug((("Event: cancelUpload: File ID: " + this.current_file_item.id) + ". Cancelled current upload. Suppressed uploadError event."));
  784.                 };
  785.                 this.UploadComplete(false);
  786.             } else {
  787.                 if (_arg1){
  788.                     _local4 = this.FindIndexInFileQueue(_arg1);
  789.                     if (_local4 >= 0){
  790.                         _local3 = FileItem(this.file_queue[_local4]);
  791.                         _local3.file_status = FileItem.FILE_STATUS_CANCELLED;
  792.                         this.file_queue[_local4] = null;
  793.                         this.queued_uploads--;
  794.                         this.upload_cancelled++;
  795.                         _local3.file_reference.cancel();
  796.                         this.removeFileReferenceEventListeners(_local3);
  797.                         _local3.file_reference = null;
  798.                         if (_arg2){
  799.                             this.Debug((("Event: uploadError : " + _local3.id) + ". Cancelled queued upload"));
  800.                             ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_FILE_CANCELLED, _local3.ToJavaScriptObject(), "File Cancelled");
  801.                         } else {
  802.                             this.Debug((("Event: cancelUpload: File ID: " + _local3.id) + ". Cancelled current upload. Suppressed uploadError event."));
  803.                         };
  804.                         _local3 = null;
  805.                     };
  806.                 } else {
  807.                     while ((((this.file_queue.length > 0)) && ((_local3 == null)))) {
  808.                         _local3 = FileItem(this.file_queue.shift());
  809.                         if (typeof(_local3) == "undefined"){
  810.                             _local3 = null;
  811.                         };
  812.                     };
  813.                     if (_local3 != null){
  814.                         _local3.file_status = FileItem.FILE_STATUS_CANCELLED;
  815.                         this.queued_uploads--;
  816.                         this.upload_cancelled++;
  817.                         _local3.file_reference.cancel();
  818.                         this.removeFileReferenceEventListeners(_local3);
  819.                         _local3.file_reference = null;
  820.                         if (_arg2){
  821.                             this.Debug((("Event: uploadError : " + _local3.id) + ". Cancelled queued upload"));
  822.                             ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_FILE_CANCELLED, _local3.ToJavaScriptObject(), "File Cancelled");
  823.                         } else {
  824.                             this.Debug((("Event: cancelUpload: File ID: " + _local3.id) + ". Cancelled current upload. Suppressed uploadError event."));
  825.                         };
  826.                         _local3 = null;
  827.                     };
  828.                 };
  829.             };
  830.         }
  831.         private function RequeueUpload(_arg1):Boolean{
  832.             var _local3:Number;
  833.             var _local2:FileItem;
  834.             if (typeof(_arg1) === "number"){
  835.                 _local3 = Number(_arg1);
  836.                 if ((((_local3 >= 0)) && ((_local3 < this.file_index.length)))){
  837.                     _local2 = this.file_index[_local3];
  838.                 };
  839.             } else {
  840.                 if (typeof(_arg1) === "string"){
  841.                     _local2 = this.FindFileInFileIndex(String(_arg1));
  842.                 } else {
  843.                     return (false);
  844.                 };
  845.             };
  846.             if (_local2 !== null){
  847.                 if ((((_local2.file_status === FileItem.FILE_STATUS_IN_PROGRESS)) || ((_local2.file_status === FileItem.FILE_STATUS_NEW)))){
  848.                     return (false);
  849.                 };
  850.                 if (_local2.file_status !== FileItem.FILE_STATUS_QUEUED){
  851.                     _local2.file_status = FileItem.FILE_STATUS_QUEUED;
  852.                     this.file_queue.unshift(_local2);
  853.                     this.queued_uploads++;
  854.                 };
  855.                 return (true);
  856.             };
  857.             return (false);
  858.         }
  859.         private function GetStats():Object{
  860.             return ({
  861.                 in_progress:((this.current_file_item == null)) ? 0 : 1,
  862.                 files_queued:this.queued_uploads,
  863.                 successful_uploads:this.successful_uploads,
  864.                 upload_errors:this.upload_errors,
  865.                 upload_cancelled:this.upload_cancelled,
  866.                 queue_errors:this.queue_errors
  867.             });
  868.         }
  869.         private function SetStats(_arg1:Object):void{
  870.             this.successful_uploads = ((typeof(_arg1["successful_uploads"]) === "number")) ? _arg1["successful_uploads"] : this.successful_uploads;
  871.             this.upload_errors = ((typeof(_arg1["upload_errors"]) === "number")) ? _arg1["upload_errors"] : this.upload_errors;
  872.             this.upload_cancelled = ((typeof(_arg1["upload_cancelled"]) === "number")) ? _arg1["upload_cancelled"] : this.upload_cancelled;
  873.             this.queue_errors = ((typeof(_arg1["queue_errors"]) === "number")) ? _arg1["queue_errors"] : this.queue_errors;
  874.         }
  875.         private function GetFile(_arg1:String):Object{
  876.             var _local3:FileItem;
  877.             var _local4:Number;
  878.             var _local2:Number = this.FindIndexInFileQueue(_arg1);
  879.             if (_local2 >= 0){
  880.                 _local3 = this.file_queue[_local2];
  881.             } else {
  882.                 if (this.current_file_item != null){
  883.                     _local3 = this.current_file_item;
  884.                 } else {
  885.                     _local4 = 0;
  886.                     while (_local4 < this.file_queue.length) {
  887.                         _local3 = this.file_queue[_local4];
  888.                         if (_local3 != null){
  889.                             break;
  890.                         };
  891.                         _local4++;
  892.                     };
  893.                 };
  894.             };
  895.             if (_local3 == null){
  896.                 return (null);
  897.             };
  898.             return (_local3.ToJavaScriptObject());
  899.         }
  900.         private function GetFileByIndex(_arg1:Number):Object{
  901.             if ((((_arg1 < 0)) || ((_arg1 > (this.file_index.length - 1))))){
  902.                 return (null);
  903.             };
  904.             return (this.file_index[_arg1].ToJavaScriptObject());
  905.         }
  906.         private function AddFileParam(_arg1:String, _arg2:String, _arg3:String):Boolean{
  907.             var _local4:FileItem = this.FindFileInFileIndex(_arg1);
  908.             if (_local4 != null){
  909.                 _local4.AddParam(_arg2, _arg3);
  910.                 return (true);
  911.             };
  912.             return (false);
  913.         }
  914.         private function RemoveFileParam(_arg1:String, _arg2:String):Boolean{
  915.             var _local3:FileItem = this.FindFileInFileIndex(_arg1);
  916.             if (_local3 != null){
  917.                 _local3.RemoveParam(_arg2);
  918.                 return (true);
  919.             };
  920.             return (false);
  921.         }
  922.         private function SetUploadURL(_arg1:String):void{
  923.             if (((!(("string" === "undefined"))) && (!((_arg1 === ""))))){
  924.                 this.uploadURL = _arg1;
  925.             };
  926.         }
  927.         private function SetPostParams(_arg1:Object):void{
  928.             if (((!((typeof(_arg1) === "undefined"))) && (!((_arg1 === null))))){
  929.                 this.uploadPostObject = _arg1;
  930.             };
  931.         }
  932.         private function SetFileTypes(_arg1:String, _arg2:String):void{
  933.             this.fileTypes = _arg1;
  934.             this.fileTypesDescription = _arg2;
  935.             this.LoadFileExensions(this.fileTypes);
  936.         }
  937.         private function SetFileSizeLimit(_arg1:String):void{
  938.             var _local2:Number = 0;
  939.             var _local3 = "kb";
  940.             var _local4:RegExp = /^\s*|\s*$/;
  941.             _arg1 = _arg1.toLowerCase();
  942.             _arg1 = _arg1.replace(_local4, "");
  943.             var _local5:Array = _arg1.match(/^\d+/);
  944.             if (((!((_local5 === null))) && ((_local5.length > 0)))){
  945.                 _local2 = parseInt(_local5[0]);
  946.             };
  947.             if (((isNaN(_local2)) || ((_local2 < 0)))){
  948.                 _local2 = 0;
  949.             };
  950.             var _local6:Array = _arg1.match(/(b|kb|mb|gb)/);
  951.             if (((!((_local6 == null))) && ((_local6.length > 0)))){
  952.                 _local3 = _local6[0];
  953.             };
  954.             var _local7:Number = 0x0400;
  955.             if (_local3 === "b"){
  956.                 _local7 = 1;
  957.             } else {
  958.                 if (_local3 === "mb"){
  959.                     _local7 = 0x100000;
  960.                 } else {
  961.                     if (_local3 === "gb"){
  962.                         _local7 = 1073741824;
  963.                     };
  964.                 };
  965.             };
  966.             this.fileSizeLimit = (_local2 * _local7);
  967.         }
  968.         private function SetFileUploadLimit(_arg1:Number):void{
  969.             if (_arg1 < 0){
  970.                 _arg1 = 0;
  971.             };
  972.             this.fileUploadLimit = _arg1;
  973.         }
  974.         private function SetFileQueueLimit(_arg1:Number):void{
  975.             if (_arg1 < 0){
  976.                 _arg1 = 0;
  977.             };
  978.             this.fileQueueLimit = _arg1;
  979.         }
  980.         private function SetFilePostName(_arg1:String):void{
  981.             if (_arg1 != ""){
  982.                 this.filePostName = _arg1;
  983.             };
  984.         }
  985.         private function SetUseQueryString(_arg1:Boolean):void{
  986.             this.useQueryString = _arg1;
  987.         }
  988.         private function SetRequeueOnError(_arg1:Boolean):void{
  989.             this.requeueOnError = _arg1;
  990.         }
  991.         private function SetHTTPSuccess(_arg1):void{
  992.             var status_code_strings:* = null;
  993.             var http_status_string:* = null;
  994.             var http_status:* = undefined;
  995.             var http_status_codes:* = _arg1;
  996.             this.httpSuccess = [];
  997.             if (typeof(http_status_codes) === "string"){
  998.                 status_code_strings = http_status_codes.replace(" ", "").split(",");
  999.                 for each (http_status_string in status_code_strings) {
  1000.                     try {
  1001.                         this.httpSuccess.push(Number(http_status_string));
  1002.                     } catch(ex:Object) {
  1003.                         this.Debug(("Could not add HTTP Success code: " + http_status_string));
  1004.                     };
  1005.                 };
  1006.             } else {
  1007.                 if ((((typeof(http_status_codes) === "object")) && ((typeof(http_status_codes.length) === "number")))){
  1008.                     for each (http_status in http_status_codes) {
  1009.                         try {
  1010.                             this.Debug(("adding: " + http_status));
  1011.                             this.httpSuccess.push(Number(http_status));
  1012.                         } catch(ex:Object) {
  1013.                             this.Debug(("Could not add HTTP Success code: " + http_status));
  1014.                         };
  1015.                     };
  1016.                 };
  1017.             };
  1018.         }
  1019.         private function SetAssumeSuccessTimeout(_arg1:Number):void{
  1020.             this.assumeSuccessTimeout = ((_arg1 < 0)) ? 0 : _arg1;
  1021.         }
  1022.         private function SetDebugEnabled(_arg1:Boolean):void{
  1023.             this.debugEnabled = _arg1;
  1024.         }
  1025.         private function SetButtonImageURL(_arg1:String):void{
  1026.             this.buttonImageURL = _arg1;
  1027.             try {
  1028.                 if (((!((this.buttonImageURL === null))) && (!((this.buttonImageURL === ""))))){
  1029.                     this.buttonLoader.load(new URLRequest(this.buttonImageURL));
  1030.                 };
  1031.             } catch(ex:Object) {
  1032.             };
  1033.         }
  1034.         private function ButtonClickHandler(_arg1:MouseEvent):void{
  1035.             if (!this.buttonStateDisabled){
  1036.                 if (this.buttonAction === this.BUTTON_ACTION_SELECT_FILE){
  1037.                     this.SelectFile();
  1038.                 } else {
  1039.                     if (this.buttonAction === this.BUTTON_ACTION_START_UPLOAD){
  1040.                         this.StartUpload();
  1041.                     } else {
  1042.                         this.SelectFiles();
  1043.                     };
  1044.                 };
  1045.             };
  1046.         }
  1047.         private function UpdateButtonState():void{
  1048.             var _local1:Number = 0;
  1049.             var _local2:Number = 0;
  1050.             this.buttonLoader.x = _local1;
  1051.             this.buttonLoader.y = _local2;
  1052.             if (this.buttonStateDisabled){
  1053.                 this.buttonLoader.y = ((this.buttonHeight * -3) + _local2);
  1054.             } else {
  1055.                 if (this.buttonStateMouseDown){
  1056.                     this.buttonLoader.y = ((this.buttonHeight * -2) + _local2);
  1057.                 } else {
  1058.                     if (this.buttonStateOver){
  1059.                         this.buttonLoader.y = ((this.buttonHeight * -1) + _local2);
  1060.                     } else {
  1061.                         this.buttonLoader.y = -(_local2);
  1062.                     };
  1063.                 };
  1064.             };
  1065.         }
  1066.         private function SetButtonDimensions(_arg1:Number=-1, _arg2:Number=-1):void{
  1067.             if (_arg1 >= 0){
  1068.                 this.buttonWidth = _arg1;
  1069.             };
  1070.             if (_arg2 >= 0){
  1071.                 this.buttonHeight = _arg2;
  1072.             };
  1073.             this.buttonTextField.width = this.buttonWidth;
  1074.             this.buttonTextField.height = this.buttonHeight;
  1075.             this.buttonCursorSprite.width = this.buttonWidth;
  1076.             this.buttonCursorSprite.height = this.buttonHeight;
  1077.             this.UpdateButtonState();
  1078.         }
  1079.         private function SetButtonText(_arg1:String):void{
  1080.             this.buttonText = _arg1;
  1081.             this.SetButtonTextStyle(this.buttonTextStyle);
  1082.         }
  1083.         private function SetButtonTextStyle(_arg1:String):void{
  1084.             this.buttonTextStyle = _arg1;
  1085.             var _local2:StyleSheet = new StyleSheet();
  1086.             _local2.parseCSS(this.buttonTextStyle);
  1087.             this.buttonTextField.styleSheet = _local2;
  1088.             this.buttonTextField.htmlText = (("<span class=\"button-text\">" + this.buttonText) + "</span>");
  1089.         }
  1090.         private function SetButtonTextPadding(_arg1:Number, _arg2:Number):void{
  1091.             this.buttonTextField.x = (this.buttonTextLeftPadding = _arg1);
  1092.             this.buttonTextField.y = (this.buttonTextTopPadding = _arg2);
  1093.         }
  1094.         private function SetButtonDisabled(_arg1:Boolean):void{
  1095.             this.buttonStateDisabled = _arg1;
  1096.             this.UpdateButtonState();
  1097.         }
  1098.         private function SetButtonAction(_arg1:Number):void{
  1099.             this.buttonAction = _arg1;
  1100.         }
  1101.         private function SetButtonCursor(_arg1:Number):void{
  1102.             this.buttonCursor = _arg1;
  1103.             this.buttonCursorSprite.useHandCursor = (_arg1 === this.BUTTON_CURSOR_HAND);
  1104.         }
  1105.         private function StartUpload(_arg1:String=""):void{
  1106.             var _local2:Number;
  1107.             if (this.current_file_item != null){
  1108.                 this.Debug("StartUpload(): Upload already in progress. Not starting another upload.");
  1109.                 return;
  1110.             };
  1111.             this.Debug(("StartUpload: " + (_arg1) ? ("File ID: " + _arg1) : "First file in queue"));
  1112.             if ((((this.successful_uploads >= this.fileUploadLimit)) && (!((this.fileUploadLimit == 0))))){
  1113.                 this.Debug("Event: uploadError : Upload limit reached. No more files can be uploaded.");
  1114.                 ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_UPLOAD_LIMIT_EXCEEDED, null, "The upload limit has been reached.");
  1115.                 this.current_file_item = null;
  1116.                 return;
  1117.             };
  1118.             if (!_arg1){
  1119.                 while ((((this.file_queue.length > 0)) && ((this.current_file_item == null)))) {
  1120.                     this.current_file_item = FileItem(this.file_queue.shift());
  1121.                     if (typeof(this.current_file_item) == "undefined"){
  1122.                         this.current_file_item = null;
  1123.                     };
  1124.                 };
  1125.             } else {
  1126.                 _local2 = this.FindIndexInFileQueue(_arg1);
  1127.                 if (_local2 >= 0){
  1128.                     this.current_file_item = FileItem(this.file_queue[_local2]);
  1129.                     this.file_queue[_local2] = null;
  1130.                 } else {
  1131.                     this.Debug(("Event: uploadError : File ID not found in queue: " + _arg1));
  1132.                     ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_SPECIFIED_FILE_ID_NOT_FOUND, null, "File ID not found in the queue.");
  1133.                 };
  1134.             };
  1135.             if (this.current_file_item != null){
  1136.                 this.Debug(("Event: uploadStart : File ID: " + this.current_file_item.id));
  1137.                 this.current_file_item.file_status = FileItem.FILE_STATUS_IN_PROGRESS;
  1138.                 ExternalCall.UploadStart(this.uploadStart_Callback, this.current_file_item.ToJavaScriptObject());
  1139.             } else {
  1140.                 this.Debug("StartUpload(): No files found in the queue.");
  1141.             };
  1142.         }
  1143.         private function ReturnUploadStart(_arg1:Boolean):void{
  1144.             var js_object:* = null;
  1145.             var request:* = null;
  1146.             var message:* = null;
  1147.             var start_upload:* = _arg1;
  1148.             if (this.current_file_item == null){
  1149.                 this.Debug("ReturnUploadStart called but no file was prepped for uploading. The file may have been cancelled or stopped.");
  1150.                 return;
  1151.             };
  1152.             if (start_upload){
  1153.                 try {
  1154.                     this.current_file_item.file_reference.addEventListener(Event.OPEN, this.Open_Handler);
  1155.                     this.current_file_item.file_reference.addEventListener(ProgressEvent.PROGRESS, this.FileProgress_Handler);
  1156.                     this.current_file_item.file_reference.addEventListener(IOErrorEvent.IO_ERROR, this.IOError_Handler);
  1157.                     this.current_file_item.file_reference.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityError_Handler);
  1158.                     this.current_file_item.file_reference.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.HTTPError_Handler);
  1159.                     this.current_file_item.file_reference.addEventListener(Event.COMPLETE, this.Complete_Handler);
  1160.                     this.current_file_item.file_reference.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, this.ServerData_Handler);
  1161.                     request = this.BuildRequest();
  1162.                     if (this.uploadURL.length == 0){
  1163.                         this.Debug((("Event: uploadError : IO Error : File ID: " + this.current_file_item.id) + ". Upload URL string is empty."));
  1164.                         this.removeFileReferenceEventListeners(this.current_file_item);
  1165.                         this.current_file_item.file_status = FileItem.FILE_STATUS_QUEUED;
  1166.                         this.file_queue.unshift(this.current_file_item);
  1167.                         js_object = this.current_file_item.ToJavaScriptObject();
  1168.                         this.current_file_item = null;
  1169.                         ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_MISSING_UPLOAD_URL, js_object, "Upload URL string is empty.");
  1170.                     } else {
  1171.                         this.Debug(((("ReturnUploadStart(): File accepted by startUpload event and readied for upload.  Starting upload to " + request.url) + " for File ID: ") + this.current_file_item.id));
  1172.                         this.current_file_item.file_status = FileItem.FILE_STATUS_IN_PROGRESS;
  1173.                         this.current_file_item.file_reference.upload(request, this.filePostName, false);
  1174.                     };
  1175.                 } catch(ex:Error) {
  1176.                     this.Debug(("ReturnUploadStart: Exception occurred: " + message));
  1177.                     this.upload_errors++;
  1178.                     this.current_file_item.file_status = FileItem.FILE_STATUS_ERROR;
  1179.                     message = ((((((ex.errorID + "\n") + ex.name) + "\n") + ex.message) + "\n") + ex.getStackTrace());
  1180.                     this.Debug(("Event: uploadError(): Upload Failed. Exception occurred: " + message));
  1181.                     ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_UPLOAD_FAILED, this.current_file_item.ToJavaScriptObject(), message);
  1182.                     this.UploadComplete(true);
  1183.                 };
  1184.             } else {
  1185.                 this.removeFileReferenceEventListeners(this.current_file_item);
  1186.                 this.current_file_item.file_status = FileItem.FILE_STATUS_QUEUED;
  1187.                 js_object = this.current_file_item.ToJavaScriptObject();
  1188.                 this.file_queue.unshift(this.current_file_item);
  1189.                 this.current_file_item = null;
  1190.                 this.Debug("Event: uploadError : Call to uploadStart returned false. Not uploading the file.");
  1191.                 ExternalCall.UploadError(this.uploadError_Callback, this.ERROR_CODE_FILE_VALIDATION_FAILED, js_object, "Call to uploadStart return false. Not uploading file.");
  1192.                 this.Debug("Event: uploadComplete : Call to uploadStart returned false. Not uploading the file.");
  1193.                 ExternalCall.UploadComplete(this.uploadComplete_Callback, js_object);
  1194.             };
  1195.         }
  1196.         private function UploadComplete(_arg1:Boolean):void{
  1197.             var _local2:Object = this.current_file_item.ToJavaScriptObject();
  1198.             this.removeFileReferenceEventListeners(this.current_file_item);
  1199.             if (((!(_arg1)) || ((this.requeueOnError == false)))){
  1200.                 this.current_file_item.file_reference = null;
  1201.                 this.queued_uploads--;
  1202.             } else {
  1203.                 if (this.requeueOnError == true){
  1204.                     this.current_file_item.file_status = FileItem.FILE_STATUS_QUEUED;
  1205.                     this.file_queue.unshift(this.current_file_item);
  1206.                 };
  1207.             };
  1208.             this.current_file_item = null;
  1209.             this.Debug("Event: uploadComplete : Upload cycle complete.");
  1210.             ExternalCall.UploadComplete(this.uploadComplete_Callback, _local2);
  1211.         }
  1212.         private function CheckFileSize(_arg1:FileItem):Number{
  1213.             if (_arg1.file_reference.size == 0){
  1214.                 return (this.SIZE_ZERO_BYTE);
  1215.             };
  1216.             if (((!((this.fileSizeLimit == 0))) && ((_arg1.file_reference.size > this.fileSizeLimit)))){
  1217.                 return (this.SIZE_TOO_BIG);
  1218.             };
  1219.             return (this.SIZE_OK);
  1220.         }
  1221.         private function CheckFileType(_arg1:FileItem):Boolean{
  1222.             if (this.valid_file_extensions.length == 0){
  1223.                 return (true);
  1224.             };
  1225.             var _local2:FileReference = _arg1.file_reference;
  1226.             var _local3:Number = _local2.name.lastIndexOf(".");
  1227.             var _local4 = "";
  1228.             if (_local3 >= 0){
  1229.                 _local4 = _local2.name.substr((_local3 + 1)).toLowerCase();
  1230.             };
  1231.             var _local5:Boolean;
  1232.             var _local6:Number = 0;
  1233.             while (_local6 < this.valid_file_extensions.length) {
  1234.                 if (String(this.valid_file_extensions[_local6]) == _local4){
  1235.                     _local5 = true;
  1236.                     break;
  1237.                 };
  1238.                 _local6++;
  1239.             };
  1240.             return (_local5);
  1241.         }
  1242.         private function BuildRequest():URLRequest{
  1243.             var _local3:Array;
  1244.             var _local4:String;
  1245.             var _local5:URLVariables;
  1246.             var _local1:URLRequest = new URLRequest();
  1247.             _local1.method = URLRequestMethod.POST;
  1248.             var _local2:Object = this.current_file_item.GetPostObject();
  1249.             if (this.useQueryString){
  1250.                 _local3 = new Array();
  1251.                 for (_local4 in this.uploadPostObject) {
  1252.                     this.Debug(((("Global URL Item: " + _local4) + "=") + this.uploadPostObject[_local4]));
  1253.                     if (this.uploadPostObject.hasOwnProperty(_local4)){
  1254.                         _local3.push(((escape(_local4) + "=") + escape(this.uploadPostObject[_local4])));
  1255.                     };
  1256.                 };
  1257.                 for (_local4 in _local2) {
  1258.                     this.Debug(((("File Post Item: " + _local4) + "=") + _local2[_local4]));
  1259.                     if (_local2.hasOwnProperty(_local4)){
  1260.                         _local3.push(((escape(_local4) + "=") + escape(_local2[_local4])));
  1261.                     };
  1262.                 };
  1263.                 _local1.url = ((this.uploadURL + ((this.uploadURL.indexOf("?") > -1)) ? "&" : "?") + _local3.join("&"));
  1264.             } else {
  1265.                 _local5 = new URLVariables();
  1266.                 for (_local4 in this.uploadPostObject) {
  1267.                     this.Debug(((("Global Post Item: " + _local4) + "=") + this.uploadPostObject[_local4]));
  1268.                     if (this.uploadPostObject.hasOwnProperty(_local4)){
  1269.                         _local5[_local4] = this.uploadPostObject[_local4];
  1270.                     };
  1271.                 };
  1272.                 for (_local4 in _local2) {
  1273.                     this.Debug(((("File Post Item: " + _local4) + "=") + _local2[_local4]));
  1274.                     if (_local2.hasOwnProperty(_local4)){
  1275.                         _local5[_local4] = _local2[_local4];
  1276.                     };
  1277.                 };
  1278.                 _local1.url = this.uploadURL;
  1279.                 _local1.data = _local5;
  1280.             };
  1281.             return (_local1);
  1282.         }
  1283.         private function Debug(_arg1:String):void{
  1284.             var lines:* = null;
  1285.             var i:* = NaN;
  1286.             var msg:* = _arg1;
  1287.             try {
  1288.                 if (this.debugEnabled){
  1289.                     lines = msg.split("\n");
  1290.                     i = 0;
  1291.                     while (i < lines.length) {
  1292.                         lines[i] = ("SWF DEBUG: " + lines[i]);
  1293.                         i = (i + 1);
  1294.                     };
  1295.                     ExternalCall.Debug(this.debug_Callback, lines.join("\n"));
  1296.                 };
  1297.             } catch(ex:Error) {
  1298.             };
  1299.         }
  1300.         private function PrintDebugInfo():void{
  1301.             var _local2:String;
  1302.             var _local1 = "\n----- SWF DEBUG OUTPUT ----\n";
  1303.             _local1 = (_local1 + (("Build Number:           " + this.build_number) + "\n"));
  1304.             _local1 = (_local1 + (("movieName:              " + this.movieName) + "\n"));
  1305.             _local1 = (_local1 + (("Upload URL:             " + this.uploadURL) + "\n"));
  1306.             _local1 = (_local1 + (("File Types String:      " + this.fileTypes) + "\n"));
  1307.             _local1 = (_local1 + (("Parsed File Types:      " + this.valid_file_extensions.toString()) + "\n"));
  1308.             _local1 = (_local1 + (("HTTP Success:           " + this.httpSuccess.join(", ")) + "\n"));
  1309.             _local1 = (_local1 + (("File Types Description: " + this.fileTypesDescription) + "\n"));
  1310.             _local1 = (_local1 + (("File Size Limit:        " + this.fileSizeLimit) + " bytes\n"));
  1311.             _local1 = (_local1 + (("File Upload Limit:      " + this.fileUploadLimit) + "\n"));
  1312.             _local1 = (_local1 + (("File Queue Limit:       " + this.fileQueueLimit) + "\n"));
  1313.             _local1 = (_local1 + "Post Params:\n");
  1314.             for (_local2 in this.uploadPostObject) {
  1315.                 if (this.uploadPostObject.hasOwnProperty(_local2)){
  1316.                     _local1 = (_local1 + (((("                        " + _local2) + "=") + this.uploadPostObject[_local2]) + "\n"));
  1317.                 };
  1318.             };
  1319.             _local1 = (_local1 + "----- END SWF DEBUG OUTPUT ----\n");
  1320.             this.Debug(_local1);
  1321.         }
  1322.         private function FindIndexInFileQueue(_arg1:String):Number{
  1323.             var _local3:FileItem;
  1324.             var _local2:Number = 0;
  1325.             while (_local2 < this.file_queue.length) {
  1326.                 _local3 = this.file_queue[_local2];
  1327.                 if (((!((_local3 == null))) && ((_local3.id == _arg1)))){
  1328.                     return (_local2);
  1329.                 };
  1330.                 _local2++;
  1331.             };
  1332.             return (-1);
  1333.         }
  1334.         private function FindFileInFileIndex(_arg1:String):FileItem{
  1335.             var _local3:FileItem;
  1336.             var _local2:Number = 0;
  1337.             while (_local2 < this.file_index.length) {
  1338.                 _local3 = this.file_index[_local2];
  1339.                 if (((!((_local3 == null))) && ((_local3.id == _arg1)))){
  1340.                     return (_local3);
  1341.                 };
  1342.                 _local2++;
  1343.             };
  1344.             return (null);
  1345.         }
  1346.         private function LoadFileExensions(_arg1:String):void{
  1347.             var _local4:String;
  1348.             var _local5:Number;
  1349.             var _local2:Array = _arg1.split(";");
  1350.             this.valid_file_extensions = new Array();
  1351.             var _local3:Number = 0;
  1352.             while (_local3 < _local2.length) {
  1353.                 _local4 = String(_local2[_local3]);
  1354.                 _local5 = _local4.lastIndexOf(".");
  1355.                 if (_local5 >= 0){
  1356.                     _local4 = _local4.substr((_local5 + 1)).toLowerCase();
  1357.                 } else {
  1358.                     _local4 = _local4.toLowerCase();
  1359.                 };
  1360.                 if (_local4 == "*"){
  1361.                     this.valid_file_extensions = new Array();
  1362.                     break;
  1363.                 };
  1364.                 this.valid_file_extensions.push(_local4);
  1365.                 _local3++;
  1366.             };
  1367.         }
  1368.         private function loadPostParams(_arg1:String):void{
  1369.             var _local3:Array;
  1370.             var _local4:Number;
  1371.             var _local5:String;
  1372.             var _local6:Number;
  1373.             var _local2:Object = {};
  1374.             if (_arg1 != null){
  1375.                 _local3 = _arg1.split("&amp;");
  1376.                 _local4 = 0;
  1377.                 while (_local4 < _local3.length) {
  1378.                     _local5 = String(_local3[_local4]);
  1379.                     _local6 = _local5.indexOf("=");
  1380.                     if (_local6 > 0){
  1381.                         _local2[decodeURIComponent(_local5.substring(0, _local6))] = decodeURIComponent(_local5.substr((_local6 + 1)));
  1382.                     };
  1383.                     _local4++;
  1384.                 };
  1385.             };
  1386.             this.uploadPostObject = _local2;
  1387.         }
  1388.         private function removeFileReferenceEventListeners(_arg1:FileItem):void{
  1389.             if (((!((_arg1 == null))) && (!((_arg1.file_reference == null))))){
  1390.                 _arg1.file_reference.removeEventListener(Event.OPEN, this.Open_Handler);
  1391.                 _arg1.file_reference.removeEventListener(ProgressEvent.PROGRESS, this.FileProgress_Handler);
  1392.                 _arg1.file_reference.removeEventListener(IOErrorEvent.IO_ERROR, this.IOError_Handler);
  1393.                 _arg1.file_reference.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.SecurityError_Handler);
  1394.                 _arg1.file_reference.removeEventListener(HTTPStatusEvent.HTTP_STATUS, this.HTTPError_Handler);
  1395.                 _arg1.file_reference.removeEventListener(DataEvent.UPLOAD_COMPLETE_DATA, this.ServerData_Handler);
  1396.             };
  1397.         }
  1398.         public function htmlEscape(_arg1:String):String{
  1399.             return (XML(new XMLNode(XMLNodeType.TEXT_NODE, _arg1)).toXMLString());
  1400.         }
  1401.  
  1402.     }
  1403. }//package
Add Comment
Please, Sign In to add comment