3 Replies Latest reply on Nov 14, 2012 8:30 PM by Flex harUI

    Loading new swf stylesheet in AIR app

    _del_p_ Level 1

      I have an AIR app (this is for mobile devices - just in case it matters) and I was swapping out stylesheets using something like


      styleManager.loadStyleDeclarations2( 'myTheme.swf' );


      This was working fine in until I did a release build where it didn't work due to the error 'SWF is not a loadable Module' which seems to suggest that its a security domain issue.


      The CSS files compiled into SWF's are all local and inculded inside the IPA (which works when doing a quick build, just not a full release build).


      I can't use



      as they throw errors when called from an AIR application.



      I've tried loading the SWF using a URLLoaderwhich works, but how do I then pass that to the stylemanager to get it to load the new styles?

        • 1. Re: Loading new swf stylesheet in AIR app
          _del_p_ Level 1

          As far as I can tell it is not possible currently to load in a different css (swf) at runtime in a full release build for mobile (certainly on IOS).


          I did change the way I was loading the swf file using a loader and then pushed that into the stylemanger which worked apart from in a full release build (which means no debugging). So I could load in the swf (confirmed that with some visual output frrom the comlpete load event) but the actual loading failed when pushing it into the module. So in the small snippet below the var styleBytes is the loaded swf, but when you call load on the module it didn't fire any events.  Those event did fire when not in a full release build.


          module = ModuleManager.getModule('myTheme.swf');

          module.load(null, null, styleBytes);


          I've had to go down a different route to changes a stylesheet at runtime.

          • 2. Re: Loading new swf stylesheet in AIR app



            I'm attempting to deal with the same issue, and also had been using the same techinque in AIR applications of loading the swf bytes, then loading the bytes into a Module.


            I also find this fails in IOS, but for me it even fails with a debug build - and although no errors are reported I do see what appears to be a failed attempt at an error message in the console log:




            This apparently should resolve to:


            WARNING: Ignoring 'secure' attribute in policy file from %s.  The 'secure' attribute is only permitted in HTTPS and socket policy files.  See http://www.adobe.com/go/strict_policy_files for details.


            Unfortunately, that's all I have to go on - so I am left to wonder if I have set up something incorrectly with a security policy file, or if this "warning" is just a red herring, and there is some other reason this code will not work in IOS.


            I would love to hear of another route to load or change a stylesheet at runtime.

            • 3. Re: Loading new swf stylesheet in AIR app
              Flex harUI Adobe Employee

              Unfortunately, IOS doesn’t support loading actionscript.