새로운 (ish) AS3 전역 오류 처리 클래스를 사용하려고합니다. Flex mxml 응용 프로그램 내에서 사용하려고합니다. 나는 전혀 작동하지 않습니다. 아래는 문제를 보여주는 전체 프로그램입니다. 이것을 Flash Player 10.2를 사용하고 Flex 4.5 SDK로 컴파일하도록 설정했습니다.Flex 4.0/4.5 전역 오류 처리
Flex SDK 4.0 및 4.5를 사용해 보았지만 두 경우 모두 오류가 발생합니다. 나는 명백한 무엇인가 여기에서 놓치고 있어야하다. 이것은 웹 페이지에 표시 될 일반 Flex SWF 파일입니다. 나는 UncaughtErrorEvent를 가져올 수있는 가정, 그때 설정에 이벤트 핸들러를 이런 짓을 할 것이다 :
if(systemManager.loaderInfo.hasOwnProperty("uncaughtErrorEvents")) {
IEventDispatcher(
systemManager.loaderInfo["uncaughtErrorEvents"]).addEventListener(
"uncaughtError", uncaughtErrorHandler);
}
이 모두가 끔찍하게 미봉책 보이지만 나는 그것이 작동하지 않는 것을 제외하고 그와 함께 살 수! 필자는 웹을 샅샅이 뒤졌으며 필자의 맥락에서이 작업을 수행하는 방법을 설명하는 문서 나 예제를 찾을 수 없습니다. 어떤 충고?
전체 프로그램 : (난 당신이 다음을 통해 볼 권장)을 API에서
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="onApplicationComplete();"
>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
private function onApplicationComplete() : void {
systemManager.loaderInfo.uncaughtErrorEvents.addEventListener("uncaughtError", uncaughtErrorHandler);
}
private function uncaughtErrorHandler(event:Event) : void {
trace(event.toString());
}
]]>
</fx:Script>
<s:Button x="153" y="64" label="Trigger Error" id="triggerButton" click="throw new Error('myError')"/>
</s:Application>
사용해보십시오 systemManager 대신 stage.loaderInfo? http://stackoverflow.com/questions/3315904/global-error-handler-for-flash-player-10-1-not-working – Satish
음, 그 스레드는 내가 가지고있는 문제를 확인합니다. addEventListener가 on 인 loaderInfo에 관계없이 작동하지 않습니다. –