Skip to main content
Inspiring
March 9, 2014
Question

How to reconcile the path to an external swf, in a mobile device package vs Flash Pro?

  • March 9, 2014
  • 1 reply
  • 512 views

Hi,

I am running into a small, convenience issue.

In my iOS AIR app, I am loading an external swf which has been included into the root of the ipa, via adt.

The code is :

var loader:Loader = new Loader();

var url:URLRequest = new URLRequest( "SoundLib.swf" );

var loaderContext:LoaderContext = new LoaderContext( false, ApplicationDomain.currentDomain, null

loader.contentLoaderInfo.addEventListener( Event.COMPLETE, onSoundLibLoadComplete, false, 0, true );

loader.load( url, loaderContext );

The swf loads just fine on the device, and I am able to instantiate the sound assets within it.  So far so good.

My issue is that when compiling the main swf in Flash Pro, I am forced to use the absolute path to where the external swf is located on my desktop drive ( C:/projectName/fla/common/SoundLib.swf ). If I just use "SoundLib.swf" ( even if I include the swf via the publish settings window), or if I use a relative path ( "../common/SoundLib.swf" ) to where the main swf gets compiled to, it just doesn't find it.

I would like to avoid having to update the path to the external swf ( SoundLib.swf ), manually, whenever I compile the swf candidate for the device, as opposed to when I am merely testing the swf in Flash Pro on the desktop.

Is there a way to do that?  Can the main swf recognize if it is run on the desktop , as opposed to on the mobile device?

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
March 9, 2014

Don’t know about swf in particular, but for other external files we put them in a deploy holder, where the main swf lives. Those seem to work as path relative whether it’s in Flash or on the device.

Inspiring
March 9, 2014

Right.  Thank's, Colin.

It makes sense to put the external swf in a subfolder within the main swf's folder, but in my case, the external swf is shared with several other projects so that would not be its proper place.