I’m writing an Android app and I have a loader that brings in an external swf. I want to create an event so that when the back button is pressed it unloads the swf. But I can’s seem to get it to work.
Any ideas?
private function jumptest (event:TouchEvent):void{
var infoloader:Loader = new Loader();
var infoURL:URLRequest=new URLRequest("MapInspectorGW.swf");
infoloader.contentLoaderInfo.addEventListener(Event.COMPLETE, infoDone);
infoloader.load(infoURL);
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, infoBack);
}
private function infoDone (loadEvent:Event)
{
addChild(loadEvent.currentTarget.content);
}
private function infoBack (event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.BACK)
{
infoloader.unload();
}
}