![](/img/trans.png)
[英]CS3 Flash - Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found
[英]How to fix the error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found
我使用代碼,我得到一個錯誤
味精:錯誤 #2044:未處理的 IOErrorEvent:。 文本=錯誤 #2035:未找到 URL。
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("gallery/test.swf");
myLoader.load(url);
如何解決這個問題?
必須添加聽眾
var context:LoaderContext = new LoaderContext();
context.checkPolicyFile = true;
var url:URLRequest = new URLRequest("gallery/test.swf");
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
myLoader.addEventListener(AsyncErrorEvent.ASYNC_ERROR, errorHandlerAsyncErrorEvent);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandlerIOErrorEvent);
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandlerSecurityErrorEvent);
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, infoIOErrorEvent);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
myLoader.load( url,context );
myLoader.load( url);
function progressListener (e:ProgressEvent):void{
trace("Downloaded " + e.bytesLoaded + " out of " + e.bytesTotal + " bytes");
}
function initHandler( e:Event ):void{
trace( 'load init' );
}
function errorHandlerErrorEvent( e:ErrorEvent ):void{
trace( 'errorHandlerErrorEvent ' + e.toString() );
}
function infoIOErrorEvent( e:IOErrorEvent ):void{
trace( 'infoIOErrorEvent ' + e.toString() );
}
function errorHandlerIOErrorEvent( e:IOErrorEvent ):void{
trace( 'errorHandlerIOErrorEvent ' + e.toString() );
}
function errorHandlerAsyncErrorEvent( e:AsyncErrorEvent ) :void{
trace( 'errorHandlerAsyncErrorEvent ' + e.toString() );
}
function errorHandlerSecurityErrorEvent( e:SecurityErrorEvent ):void{
trace( 'errorHandlerSecurityErrorEvent ' + e.toString(
) );
}
function onLoadComplete( e:Event ):void{
trace( 'onLoadComplete' );
}
您需要確保目錄 gallery/ 相對於 your.swf(而不是 your.fla)存在,並且 swf“test.swf”位於該文件夾內,以便可以加載它。 檢查您的發布設置 (shift+f12) 以確保您的 swf 在您期望的位置發布。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.