How to stop swf when an error occur

I have a project where I am loading in an external swf and when it error loading I want it to show the error on screen which I have accomplished and then I want to provent it from going any further . i.e no more frames entered no more axtionscript run

I tried this and got nothing

 function ioError(e:IOErrorEvent):void {
error_txt.text = e.text;    
trace(e.target.loaderURL);
stop();
 }

Answers


You need to register the ioError function as an event handler on the LoaderInfo object. I assume somewhere you've created a Loader to load your external SWF. Here's the example from Adobe (http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html) edited slightly to remove classes.

import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
var request:URLRequest = new URLRequest("some.swf");
loader.load(request);
addChild(loader);

function ioErrorHandler(event:IOErrorEvent):void {
     trace("ioErrorHandler: " + event);
}

Need Your Help

Upgrading bootstrap-sass from v2.3.2.0 to v3.0.2.1 breaks sample_app CSS

ruby-on-rails twitter-bootstrap railstutorial.org

Working through Hartl's sample_app tutorial...not an issue with the tutorial, but with my own tinkering. Wondering if someone smarter than me can help us all out... I know that often times updating...

MySQL trigger results in error #1064

mysql sql triggers mysql-error-1064

I tried writing this small trigger in MySQL,