Skip to main content
Participating Frequently
April 25, 2013
Question

AS3 code in External swf not working in AIR 3.6 with iOS

  • April 25, 2013
  • 16 replies
  • 3793 views

Hi all, I'm struggling as everybody said it works with AIR 3.6, but no one explain how to get it work. My testing is very straight forward, my main swf file is loading an external swf file (ball.swf). In the ball.swf,  at frame 1, I have these code:

var nCounter:uint = 0;

tbCount.text = String(nCounter);

function countUpdate():void{

    nCounter++;

    tbCount.text = String(nCounter);

    if (nCounter==6){

        this.mcBall.stop();

    }//if

    trace (nCounter)

}//function

At frame 60 of ball.swf, I have these code:

countUpdate();

gotoAndPlay(2);

So the ball.swf basically is just a ball animation that suppose to repeat until it is repeated 7 times. I have a text box to display the counter.

On the desktop, everything is fine but once installed to the iPad mini, it's not.

I have overlayed AIR 3.6 to my Flash Pro CS 5.5. I package everything into and ipa file (tried setting like Quick publishing, Deployment etc). The ball.swf loads and I can see the ball.swf animate in the ipad mini, but the AS code in it is not working, the counter never increase and the animation never stops.

I even tried ADT to make sure I package in AOT ipa. What am I'm doing wrong?

I have a button in my main swf, and once the button is pressed, this is how I load the ball.swf:

function LoadBtn_onRelease (evt:MouseEvent):void{

    //http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/

    var _urlRequest:URLRequest = new URLRequest("ext_grayBall.swf");

    var _loader:Loader = new Loader();

    var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

    _loader.contentLoaderInfo.addEventListener (Event.COMPLETE, loader_onComplete);

    _loader.load(_urlRequest, _lc);

}//function

Any help would be appreciated. My company is not going to upgrad to CS 6 for a long time as IT do not like Cloud software.

The overlay process with CS 5.5 is a bit unclear, but my Airiphone.xml in the \common]configuration\players\airiphone.xml look like this:

  <player id="PFI1_0" version="19" asversion="3" minasversion="3">

    <name>AIR for iOS</name>

    <publishobject2 id="Air2_5" version="3.6" intversion="3.6"></publishobject2>

    <path platform="WIN">Air2_5.dll</path>

    <path platform="MAC">Air2_5.bundle</path>

....

So I think it's not the problem of swf Version that everybody said it has to be version 19 for the main swf to be able to load external swf.

Thanks in advance!

This topic has been closed for replies.

16 replies

Nimisha1
Participating Frequently
April 28, 2013

Hi,

To load an AS3 SWF externally you have to use AIR 3.7 (swf-version=20) as in AIR 3.6 you can load AS3 SWFs only locally.

More info on how to host external SWFs is present @ http://blogs.adobe.com/airodynamics/2013/03/08/external-hosting-of-secondary-swfs-for-air-apps-on-ios/

I hope it helps!

Thanks,

Nimisha

Moses_SUAuthor
Participating Frequently
April 29, 2013

Thanks Nimisha1, I'm confuse now. I believe what I'm doing is loading the external swf locally, by following the suggestion here: http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-m%20ultiple-swfs-in-air-apps-on-ios/

The swf file get package together with the main swf file in an ipa.

I thought about going right in to AIR 3.7 but it's still in Beta right now. I'm doing a proof of concept for my manage to identify the current limitation of AIR with iOS before we start putting a large amount of time to convert our existing online training to iOS platform. Any help is appreciated, thanks!

Moses

Moses_SUAuthor
Participating Frequently
May 1, 2013

Hi, I still couldn't get this resolve, does anyone have some sample working file? I went back and check everything in term of the overlaying process, which I think I did right, so I still don't know why the AS code in the external swf is not working once loaded into the iOS. I only have 1 more week to get it working otherwise we will be forced to abandon Flash for iOS solution. Thanks!