2011-05-05 3 views
3
내가하려고합니다 alse 내가 & 캐치를 시도 사용하려고

처리되지 않은 의해 IOErrorEvent을 처리하는 방법

Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type. 

내가 AS3 와 무비 클립에 손상된 이미지를로드하려고이 오류하지만 방법 를 \ 처리 잡는 방법

하여 addEventListener

loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError); 

하지만이 오류

어떤 도움을 잡을 수 없습니다!

+0

onIO 오류 수신기 기능이 있습니까? URLLoader를 사용하고 있습니까? – DanielB

+0

yes onIOError 함수를 만들었습니다. 예, URLLoader를 사용하고 있습니다. 이미지를로드 할 때 제대로 작동하지만 손상된 이미지를 사용할 때 오류를 처리 할 수 ​​없습니다. – JustMe

+0

httpStream : http : //help.adobe를 사용하십시오. com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLStream.html – www0z0k

답변

6

보이지 않는 오류를 잡으려면 표준 try-catch 블록을 사용할 수 있습니다. 오류 # 2180 - 당신이로드하려는 SWF는 (AS2로 게시) 오래된 SWF는 같은

var ldr:Loader = new Loader(); 
ldr.contentLoaderInfo.addEventListener("complete", ldrDone); 
ldr.contentLoaderInfo.addEventListener("ioError", ldrError); 
ldr.load(new URLRequest("FILE-NAME-COMES-HERE")); 

function ldrDone(evt:*):void 
{ 
    //if the file can be loaded into a Loader object, this part runs 
    var temp:*; 

    try 
    { 
     temp = evt.target.content; 
     //add it to the stage 
     stage.addChild(temp); 

     //this traces whether the loaded content is a Bitmap (jpg, gif, png) or a MovieClip (swf) 
     var classOfObject:String = flash.utils.getQualifiedClassName(temp); 
     trace(classOfObject); 
    } 
    catch(error:*) 
    { 
     trace("some error was caught, for example swf is AS2, or whatever, like Error #2180"); 
    } 
} 

function ldrError(evt:*):void 
{ 
    //if the file can't be loaded into a Loader object, this part runs 
    trace("this is the error part, Error #2124 won't show up"); 
} 

이 오류를 잡는다.

파일을 찾을 수 없거나로드 가능한 형식으로 보이지 않는 경우 ioError 부분이 실행됩니다 (오류 # 2124).

+0

답변을 추가하기 만하면됩니다 ... 2011 년을 모르지만 AirSDK 19에서 IOErrorEvent.IO_ERROR는 손상된 이미지에 # 2124 오류 메시지를 캐시합니다. – MyFlashLab

관련 문제