Skip to main content
Participant
March 26, 2013
Question

App hangs when clicking button inside imported swf

  • March 26, 2013
  • 1 reply
  • 522 views

Hi all,

          been bangin my head against a wall all day, thought I'd see if anyone can shed some light on this -

I have an iOS air app that imports a remote swf. Once imported, an event listener is added to a button inside the imported swf. Clicking the button causes the app to hang. Here's some code -

private function loadRemoteSWF():void{

     var urlRequest:URLRequest = new URLRequest("http://www.domain.com/remote.swf");

     var loader:Loader = new Loader();

     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);

     loader.load(urlRequest);
}

private function onLoaded(e:Event):void{

     var loaderInfo:LoaderInfo = e.currentTarget as LoaderInfo;

     var adPanel:MovieClip = loaderInfo.content as MovieClip;

     adPanel.continueButton.addEventListener(TouchEvent.TOUCH_BEGIN, onContinueClicked);

     addChild(adPanel)

}

private function onContinueClicked(e:TouchEvent):void{

     trace("onContinueClicked");

}

I'm using Flash Builder 4.7 AIR SDK 3.5 ASC 2.0.

This only happens on a release build, debug builds work fine so near impossible to find the cause. It also works fine when using the legacy compiler on the same SDK version.

Dispatching a touch event programatically on the button also works fine. (thought I could do a try/catch to find an error)

adPanel.continueButton.dispatchEvent(new TouchEvent(TouchEvent.TOUCH_BEGIN));

Touching the button just kills the app, it doesn't even hit the trace.

Anyone got any ideas how to debug this, or why this problem might be happening?

Thanks

Dave

This topic has been closed for replies.

1 reply

Adobe Employee
March 31, 2013

External hosting of swfs was introduced in AIR 3.7. You must be using fast build mechanism in Debug builds where it works. It wont work in standard packaging in AIR 3.5 in release builds. You need to upgrade to AIR 3.7 to use this feature. All details on how to use this feature can be found at https://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air-apps-on-ios/