Quantcast
Channel: Adobe Community : All Content - AIR Development
Viewing all articles
Browse latest Browse all 2954

iOS app using Air 3.9 - how can we reload a swf that was previously loaded?

$
0
0

We are developing an iOS app using the air 3.9 sdk. Our application is such that we have 2 SWFs packaged inside the ipa file i.e.the main.swf and an experience.swf.
The main.swf is loaded initially using application.xml. A button-click within the main.swf loads the experience.swf (which is located within the bin folder in the ipa, NOT remotely downloaded). This experience.swf contains assets and code.

When we create an ad-hoc build, experience.swf loads perfectly the first time, but if the user returns to the main.swf and then tries loading the experience.swf again, it doesn't load. Just the default stage color is visible. (This problem only occurs on the ad-hoc build. The debug build has no such issues)


To load this experience.swf we are using the flash.display.loader with loaderContext set as the ApplicationDomain.currentDomain.

mcExperience = new MovieClip();
var url:URLRequest = new URLRequest("ChristmasExperience.swf");
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

loader.load(url, loaderContext);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, CompleteHandler);

addChild(mcExperience);

 

private function CompleteHandler(e:Event):void
{
trace("I HAVE LOADED .... SWF loaded... , waiting for the constructor call back..." + e.target.loader.content);
//mcExperience.addChild(loader);
mcExperience.addChild(MovieClip(e.target.loader.content));
//TODO : Set the Session ID Here
m_experienceBase.SetSessionID(int(m_ExperienceSessionID));
m_experienceBase.SetLocalPlayer(m_localPlayer);
//(loader.content as MovieClip).soundTransform = new SoundTransform(0);
//addChild(loader);
//setChildIndex(m_tfConsoleMsgDisplay, numChildren - 1);
}

 

When the experience is unloaded, we remove the holder MovieClip of the experience.swf and unload the flash.display.loader. This still does not re-load the previously loaded experience.swf.

if (mcExperience)
{
mcExperience.removeChildren();
removeChild(mcExperience);
mcExperience = null;
}


We are using swf-version=22 for both main and experience swf.

 

This is quite a big problem for us and we've gone through a bunch of posts, to help understand this issue better (a few examples below):

http://stackoverflow.com/questions/20039377/adobe-air-ios-and-multiple -swfs-returning-to-a-previously-loaded-swf

http://stackoverflow.com/questions/19536000/load-and-reload-external-s wf-in-air-for-ios?lq=1

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

 

Is there any way to reload a secondary swf within an ios application?


Viewing all articles
Browse latest Browse all 2954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>