triton
کاربر فعال
سلام
دوستان در مورد این خطا می تونند به من کمک کنند. کد من به صورت زیر هستش:
[JSS] var stream:URLStream = new URLStream();
stream.load(new URLRequest( "http://localhost/index.php" ));
stream.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{
trace(e);
});
stream.addEventListener(Event.COMPLETE, function(e:Event):void
{
var fileData:ByteArray = new ByteArray();
stream.readBytes(fileData, 0,stream.bytesAvailable);
var tempFile:File = File.createTempFile();
var fs:FileStream = new FileStream();
fs.openAsync(tempFile, FileMode.WRITE);
fs.writeBytes( fileData, 0, fileData.bytesAvailable);
fs.close();
fs.addEventListener(Event.CLOSE, function():void{
//file is downloaded.
trace('file downloaded');
});
});
[/JSS]
اگر مسیر فایل از روی هارد باشه مشکلی نیست ولی اگه از وب یا localhost باشه خطای IOErrorEvent.IO_ERROR اتفاق می افته و پیغام زیر trace می شه:
JavaScript Code:
[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost/index.php" errorID=2032]
دوستان می تونند در این مورد کمک کنند.
دوستان در مورد این خطا می تونند به من کمک کنند. کد من به صورت زیر هستش:
[JSS] var stream:URLStream = new URLStream();
stream.load(new URLRequest( "http://localhost/index.php" ));
stream.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{
trace(e);
});
stream.addEventListener(Event.COMPLETE, function(e:Event):void
{
var fileData:ByteArray = new ByteArray();
stream.readBytes(fileData, 0,stream.bytesAvailable);
var tempFile:File = File.createTempFile();
var fs:FileStream = new FileStream();
fs.openAsync(tempFile, FileMode.WRITE);
fs.writeBytes( fileData, 0, fileData.bytesAvailable);
fs.close();
fs.addEventListener(Event.CLOSE, function():void{
//file is downloaded.
trace('file downloaded');
});
});
[/JSS]
اگر مسیر فایل از روی هارد باشه مشکلی نیست ولی اگه از وب یا localhost باشه خطای IOErrorEvent.IO_ERROR اتفاق می افته و پیغام زیر trace می شه:
JavaScript Code:
[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost/index.php" errorID=2032]
دوستان می تونند در این مورد کمک کنند.
آخرین ویرایش: