Results 1 to 5 of 5

Thread: Package AIR application

  1. #1
    Join Date
    Dec 2008
    Posts
    18

    Default Package AIR application

    I am trying to package my AIR application but the applicationContext.xml and applicationContext.properties are obviously not found at runtime. For a test I copied them manually next to the main SWF in the exploded AIR application folder (OS-X):

    <MyApp.app>/Contents/Resources/MyApp.swf
    <MyApp.app>/Contents/Resources/applicationContext.xml
    <MyApp.app>/Contents/Resources/applicationContext.properties

    This is the structure that works as a web application. Any hints?

    Thanks,
    Peter

  2. #2
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default not sure

    I think Spring AS uses an URLLoader to retrieve the configuration file. I'm not sure if this is also suitable for a file that lives on the local filesystem, I'm pretty sure its not. I'm not sure if Spring AS has that possibility yet, you'd have to consult the ASDocs a little I guess.
    I'll have a look and see if i can find something...

  3. #3
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default add an embedded config

    Yep, checked the sources, Spring AS uses an URLLoader, so the local filesystem can't be reached by that.

    There's also a method called addEmbeddedConfig() that let's you add a configuration that is embedded into your application. For now that seems to be the best option for you.

    cheers,

    Roland

    P.S.
    Here's a forum entry on the old Prana forum that explains how:
    http://prana.herrodius.com/viewtopic.php?f=3&t=50
    Last edited by 666shooter; Dec 21st, 2008 at 07:49 AM. Reason: added URL

  4. #4
    Join Date
    Dec 2008
    Posts
    18

    Default

    Thanks for the hints. I tried using addEmbeddedConfig() as suggested but with the PureMVC extensions it does not work:
    Code:
    <mx:WindowedApplication applicationComplete="init()">
    
    [Embed(source="applicationContextAIR.xml", mimeType="application/octet-stream")]
    private var embeddedConfig:Class;
    private var applicationContext:XMLApplicationContext = new FlexXMLApplicationContext();
    
    private function init():void {
    	applicationContext.addEmbeddedConfig(embeddedConfig);
    	applicationContext.addEventListener(Event.COMPLETE, startupApp);
    	applicationContext.load();
    }
    
    private function startupApp(e:Event):void {
    	applicationContext.removeEventListener(Event.COMPLETE, startupApp);
    
    	// Initialize PureMVC
    	applicationFacade = ApplicationFacade.getInstance(applicationContext);
    	applicationFacade.initializeIocContainer();
    
        ....
    
    </mx:WindowedApplication>
    The applicationFacade is null - even though it allows passing either a String pointing to a URL or directly an XML object. Trying to find out what's going on in AppliationFacade.

    Peter

  5. #5
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default hmmm, sorry...

    Hey Peter,

    I'm sorry but PureMVC is not one of my areas of expertise, I've worked solely with Cairngorm up til now. So I hope somebody else on the forum can shed some light on this, I'm afraid I won't be of much use...

    good luck,

    Roland

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •