Here is my code i updated and currently running tests with...
there is a second timer on another layer its useless just records the length of how long the whole process takes me...
var timeChk:Boolean = false;
var timeCnt:Number = 0;
var timeDelay:Number = 5;
var file:String = "Snowmen.swf";
var fileU:String = "someFlv";
function saveFunc():void {
addEventListener(Event.ENTER_FRAME, timer);
var variables:URLVariables=new URLVariables();
variables.file=file;
variables.fileU=fileU;
var richiesta:URLRequest=new URLRequest();
richiesta.url=('
http://192.168.70.106/convert.php'); richiesta.method=URLRequestMethod.POST;
richiesta.data=variables;
var loader:URLLoader=new URLLoader();
loader.dataFormat=URLLoaderDataFormat.BINARY;
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
addLoaderListenersSend(loader);
try {
loader.load(richiesta);
} catch (error:Error) {
trace('Unable to load the document.');
}
}
function addLoaderListenersSend(d:IEventDispatcher):void {
d.addEventListener(Event.OPEN,inizioSend);
d.addEventListener(ProgressEvent.PROGRESS,inProgressoSend);
d.addEventListener(Event.COMPLETE,completatoSend);
d.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorSend);
}
function inizioSend(e:Event):void {
trace('start');
}
function inProgressoSend(e:ProgressEvent):void {
trace('Progress: '+e.bytesLoaded+' totale: '+e.bytesTotal);
}
function completatoSend(e:Event):void {
trace("done");
timeCnt = 0;
addEventListener(Event.ENTER_FRAME, timerRe);
}
function securityErrorSend(e:SecurityErrorEvent):void {
trace('error: '+e);
}
function ioErrorHandler(e:IOErrorEvent):void {
trace('error: '+e);
}
//*********************************************************************
function timerRe(e:Event):void {
timeCnt++;
if (timeCnt == timeDelay * 12) {
timeCnt = 0;
timeChk = true;
} else {
timeChk = false;
}
var variables:URLVariables=new URLVariables();
variables.fileU=fileU;
var richiesta:URLRequest=new URLRequest();
richiesta.url=('
http://192.168.70.106/filecheck.php'); richiesta.method=URLRequestMethod.POST;
richiesta.data=variables;
var loaderRe:URLLoader=new URLLoader();
loaderRe.dataFormat=URLLoaderDataFormat.BINARY;
loaderRe.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandlerRe);
addLoaderListenersSendRe(loaderRe);
try {
loaderRe.load(richiesta);
} catch (error:Error) {
trace('Unable to load the document.');
}
}
function addLoaderListenersSendRe(d:IEventDispatcher):void {
d.addEventListener(Event.OPEN,inizioSendRe);
d.addEventListener(ProgressEvent.PROGRESS,inProgressoSendRe);
d.addEventListener(Event.COMPLETE,completatoSendRe);
d.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorSendRe);
}
function inizioSendRe(e:Event):void {
trace('startRe');
}
function inProgressoSendRe(e:ProgressEvent):void {
trace('ProgressRe: '+e.bytesLoaded+' totale: '+e.bytesTotal);
}
function completatoSendRe(e:Event):void {
trace("doneRe");
removeEventListener(Event.ENTER_FRAME, timerRe);
var vars:URLVariables=new URLVariables(e.target.data);
trace(vars.conRe);
if (vars.conRe == "1") {
removeEventListener(Event.ENTER_FRAME, timer);
flvPlayer.source = "
http://192.168.70.106/flv/" + fileU + ".flv";
} else {
timeCnt = 0;
addEventListener(Event.ENTER_FRAME, timerRe);
}
}
function securityErrorSendRe(e:SecurityErrorEvent):void {
trace('errorRe: '+e);
}
function ioErrorHandlerRe(e:IOErrorEvent):void {
trace('errorRe: '+e);
}
saveFunc();