2 Replies Latest reply on Apr 17, 2008 7:30 AM by clsimeone

    Pass flashvars to an AIR app?

      I'm converting a Flex app to an AIR app.

      The current flex app uses the SWFObject inthe html template to pass in flashvars...
      var so = new SWFObject("myappp.swf", "myappp", "${width}", "${height}", "9.0.115");
      so.addVariable("XMLData", getXML(document.getElementById("MyXMLData")));

      ...where MyXmlData is defined in the html template as follows....
      <div style="display:none;" id="MyXMLData">
      <clip url="rtmp://cpxxx.edgefcs.net/500k/myflv" hideSkin="false">

      In my ActionScript I get the flashvars as follows...
      if (!loaderInfo.parameters.hasOwnProperty("MyXMLData"))
      throw("Error: Missing XML Data");

      How would I do this with AIR? Is there a way to pass the XML to the loader when the AIR app is starting up? To put it another way... How would I pass flashvars to an AIR app?


        • 1. Re: Pass flashvars to an AIR app?
          Oliver Goldman Adobe Employee
          It depends on how your application is being launched. If it's being launched from a web page via the browser API, you can pass arguments to the launch call. That's not really appropriate for an entire XML file, but you could pass e.g. a URL to one.

          However, if your application is being launched directly by a user on the desktop, then there's no way to pass arguments to it.

          Stepping back a bit, it might be more useful to think about your use case and how to make it work, rather than focusing immediately on Flashvars, which is just a feature.

          Oliver Goldman | Adobe AIR Engineering

          • 2. Re: Pass flashvars to an AIR app?
            clsimeone Level 1
            Thanks for your reply.

            After a lot of searching I realized that the flashvar idea was not going to work. Next I tried adding custom tags to the AIR Application Descriptor File to pass in startup values. That didn't work out to well. Finally I coded to get the XML via http. That worked fine.

            Thanks Again!