Hello Guru:
I am using Flash professional with action script 3.
Please recommended me how to check if existing file in drive c: exist or not.
Thanks in advance.
you could attempt to load that file and use an ieerrorevent to catch its non-existance:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorF );
loader.load(new URLRequest(yourpath/yourfile));
function errorF(e:IOErrorEvent):void{
// catch error
}
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorF );
loader.load(new URLRequest("c:\CaptivateLog.txt"));
function errorF(e:IOErrorEvent):void{
trace(IOErrorEvent.IO_ERROR);
trace("file not found");
}
// catch error
-------------------------------------------
Hello Kglad:
I have try above but always got to errorF even file is there.
Please help again.
Thanks in advance.
use:
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorF );
loader.load(new URLRequest("file://c:/CaptivateLog.txt"));
function errorF(e:IOErrorEvent):void{
trace(IOErrorEvent.IO_ERROR);
trace("file not found");
}// catch error
p.s. please mark helpful/correct responses, if there are any.
North America
Europe, Middle East and Africa
Asia Pacific