开发者

Rescue Flex HTMLLoader Crash

I use HTMLLoad开发者_如何学运维er component, and I have to load thousand of different websites per days by this component.

But some times, HTML component produce several crash/days of my AIR application ...

How can I rescue or avoid theses crashes ?

Thank you in advance :-)


You can catch unhandled errors listening to UncaughtErrorEvent.UNCAUGHT_ERROR

    loaderInfo.uncaughtErrorEvents.addEventListener( UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler );


you can try this, although it is not perfect, it is work well.

html.htmlText = "";
super.removeElement(html);
html = null;

that means html will be gc at some time.

if you want gc immediately, you can call System.gc() manually, like:

html.htmlText = "";
html.addEventListener(Event.LOCATION_CHANGE, html_locationChangeHandler);
super.removeElement(html);
html = null;

private function html_locationChangeHandler(event:Event):void
{
    super.callLater(function():void{System.gc();});
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜