1 Reply Latest reply on Nov 24, 2009 9:27 AM by Ladislav Navrátil

    How do I create a local AIR app that loads a network resource that loads a network resource?

    Fullmanator
      Ok, when you think about it, what I'm trying to accomplish isn't that difficult, yet I'm running into security sandbox violations all over the place.

      Here's the scenario:
      - I have a network-enabled SWF that lives in a web server, that pulls external content via the network. That part works fine when you run it as itself.
      - THEN, I have an AIR application that is nothing but a "stub" that loads that network-enabled SWF from a web server, that in turn is supposed to pull the external content from the network.

      It seems easy: I don't want to have to bundle up that same main SWF as an AIR application as that would create two code bases to maintain should there be any future bug fixes. Count that against countless installs on both the web-version and the desktop version, and there's lots of variables. So I just wanted the AIR application to pull that single SWF off the server and have it do its work, independent of the AIR application.

      However, the problem I'm running into is:
      quote:

      SecurityError: Error #2142: Security sandbox violation: local SWF files cannot use the LoaderContext.securityDomain property. app:/buzztv_desktop_0.1.swf was attempting to load http://localhost/widget/widget.swf.
      at flash.display::Loader/_load()
      at flash.display::Loader/load()


      There was a previous instance of that same error that referenced Stage, but I solved that by wrapping the main function in an if (stage) {}, so this is the next error on the list. I have a feeling that if I've encountered these two errors already, there are more lined up behind them.

      So I tried something like
      quote:

      _loader.load(request, new LoaderContext(true, null, SecurityDomain.currentDomain));

      ...thinking that it might help, but it didn't.

      Is there a reasonable solution to this without changing the entire workflow of the project, or do I simply have to have the same main SWF as two code bases, one for the embeddable web version, and one for the desktop version (read: they are intended to do the same exact thing, no differing features, no desktop notifications, etc.)?

      Thanks in advance!