0 Replies Latest reply on Feb 20, 2007 4:36 PM by JJordache

    Problem loading AS SWF code a run time

      I’m trying to use SWF files generated by MapServer http://www2.dmsolutions.ca/mapserver/dl/FlashMapserverUserDoc.html inside a Flex 2.0 / ActionScript 3.0 application, and I can’t figure out how to dynamically load AS code from these files.
      In a few words, MapServer generates a “main” SWF file which contains an index of several layer SWF files that contain the actual graphics. In order to get the paths to these layers, I need to be able to read programmatically the properties of an Object defined in this “main” SWF file.

      I’m new to Flex/AS and so I’m confused as how exactly I have to load this file and access its code. As far as I understand it, there are 2 different ways to load SWF resources from an URL: through flash.net.URLLoader (1) and flash.display.Loader (2).
      Method (2), as I understand it, is supposed to be used for display purposes and loading of graphical resources at run time. Method (1) seems more appropriate for what I’m trying to do, but the data gets loaded as generic “binary” and I can’t seem to access its AS structure.
      Anyways, I tried both methods and I can’t get access to the objects stored in this main SWF file.

      Now, I’m aware of the cross-scripting limitations and compatibility issues, but I don’t have any control over the MapServer generated content, so I can’t add an allowDomain call. Instead, I’ve added a “crossdomain.xm” file to the root of my test web server, allowing access from all domains. Don’t know if this solves the access problem or not…

      Note that my test web server and MapServer applications that generates the SWF files reside on a local virtual machine that I use for development. The Flex/Flash application in which I’m trying to load the index file runs on my local machine.

      So, does anyone have any tips on how I may dynamically load this content in the context I just described?

      Sorry for the long post… Thanks much!
      -Johnny J.