Announcement Announcement Module
Collapse
No announcement yet.
Using a context compiled in a swf when working with a remote server Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using a context compiled in a swf when working with a remote server

    I have a flex application. I compiled my swf with an context.xml in the same folder as the Application mxml.
    Here is the code i am using after application complete.

    _appContext = new XMLApplicationContext();
    _appContext.addConfigLocation("context.xml"); _appContext.addEventListener(Event.COMPLETE,comple tedCallBack);
    _appContext.load();

    When running locally it works fine, when deployed on server i get an IOError.
    I saw you are using the URLLoader. I would like to avoid deploying the context files on the server and prefer using it embedded in the swf. is there a way to do it?

    thanks,
    Nir

  • #2
    yes, its possible

    yes, its possible, first embed your configuration in the usual way:

    Code:
    [Bindable]
    [Embed(source="context.xml",mimeType ="application/octet-stream")]
    public var contextConfig:Class;
    Then add and load your context with the addEmbeddedConfig() method:

    Code:
    var _appContext:XMLApplicationContext = new XMLApplicationContext();
    _appContext.addEmbeddedConfig(contextConfig);
    _appContext.load();
    You don't need to hook up the event.COMPLETE listener, after the call to load the context will be ready.

    cheers,

    Roland

    Comment

    Working...
    X