4 Replies Latest reply on May 8, 2008 10:04 AM by srivello2

    Flex 3 Beta 2 runtime error StyleManager.loadStyleDeclarations

    MatteoNY
      Greetings:

      As a test I implemented Flex 3 beta 1 using dynamic runtime CSS, it worked fine without any issues until I upgraded to Flex 3 beta 2. I followed Ted's, ( http://www.onflex.org/ted/2007/01/flex-201-understand-runtime-css.php) approach for Flex 2.01.

      I'm reporting this as it is a great feature that I'd like to use in the future. If there is a new way to implement this for Flex 3 beta 2 that would be great or a new library that is now needed that would be great. It appears that the library "ResourceManager" has changed and is expecting 3 arguments vs 2 that were sent.

      I've called the default style css at initialize, creationComplete and applicationComplete and I get the error. After I get the page and with a combo box as per Ted's example, after a change event and the code runs it causes the same runtime.

      The code that I'm using is: StyleManager.loadStyleDeclarations('style/styleDefault.swf',true); along with other stuff from Ted's article. If I take out the line of code at "all works without a runtime. The call works and the style changes but you get the runtime error.

      Here is the error:
      ArgumentError: Error #1063: Argument count mismatch on mx.resources::ResourceManager/ http://www.adobe.com/2006/flex/mx/internal::installCompiledResourceBundles(). Expected 3, got 2.
      at mx.core::FlexModuleFactory/installCompiledResourceBundles()
      at mx.core::FlexModuleFactory/docFrameHandler()

      Thanks for your help.
      Matt
      P.S This appears to be a bug.


        • 1. Re: Flex 3 Beta 2 runtime error StyleManager.loadStyleDeclarations
          Gaurav J Adobe Employee
          It seems you are trying to run modules which were compiled with Flex 3 beta 1. Would you try after recompiling those as well, with Flex 3 beta 2?

          Thanks,
          Gaurav Jain
          Flex SDK Team
          • 2. Re: Flex 3 Beta 2 runtime error StyleManager.loadStyleDeclarations
            srivello2 Level 1
            Hi,

            Great, simple example. I'm working on something similar; an application that loads runtime css.swf. When the loader and css.swf are online it works fine, and when the loader and the css.swf are offline it works fine. However when the loader is offline and the css.swf is online I get the following error. This situation is desired as it contracts me to use the 'live' styles while I do updates on my loader from my desktop. I can recopy my online css.swf to the offline as a workaround, but that is less desirable. I want to fix the issue so that the loader can be offline and the css.swf can be online. Typically in flash this type of operation (for everything except this css.swf workflow) works fine in my experience. As far as I can tell its because the css.swf does not 'allow' itself, security-wise to be loaded. The css.swf has no as3 scope of course (because its based in a *.css file) so I can't use Security.allowDomain('*'). Likewise it doesn't call a crossdomain automatically either.

            ERROR:
            Error: Unable to load style(SWF is not a loadable module): http://images50.neopets.com/style_set_manager/styles_EN_v1.swf.

            QUESTION:
            Anyone know how to get this to work? I'll check back to this blog daily, and post the solution here if I find it elsewhere.
            • 3. Re: Flex 3 Beta 2 runtime error StyleManager.loadStyleDeclarations
              SilverEarth2005
              Hi,
              Also getting same error that srivello2 has.

              Using Flex Builder 3 and busy trying to get a simple dynamic css loaded during runtime using StyleManager.loadStyleDeclarations("../cssSwf/green.swf",true)

              I checked the path and this is correct.
              I am running this in debug mode through the IDE and get the error "Unable to load style(SWF is not a loadable module): ../cssSwf/green.swf"

              I also tried publishing the swf file to a localhost/test path however the same error comes up!

              Any ideas as to why. Plz Plz
              Im pulling my hair out with this at the moment.

              Cheers
              • 4. Re: Flex 3 Beta 2 runtime error StyleManager.loadStyleDeclarations
                srivello2 Level 1
                I was emailed from a forum post writer with a solution.

                1) I downloaded easyphp.org's easy php server.
                2) Using the server just as it installs by default (not really the php per se),
                3) Check the admin, add an 'alias' with whatever name you like and point to the FOLDER that flex outputs your swf and html each time it publishes. For me it is [server]/[alias]/[flex_html] so '' http://127.0.0.1/StyleSetManagerDemo/StyleSetManagerDemo.html?debug=true""
                4) Now point flex's publish (debug/run) dialog to use the ONLINE(ish) alias so it thinks you have an online app (really offline but using the easyphp server) loading online css swfs (truely online).

                I took a bit to think if these steps are REALLY worth it, but in the end you just set the server to start when windows starts and you never really think about it anymore since the rest of the setup persists. When you start a new project you have to do the setup again, but no biggie.

                Until the Flex SDK security is modified to not require this extra step, I'll use this technique.