4 Replies Latest reply on Jun 30, 2010 11:17 AM by cdsvvxv

    Changing stylesheets at runtime

    cdsvvxv Level 1

      I am not using Flex Builder but the command line mxmlc compiler instead. I have two css.swf files that I don't seem to be able to access within my code. The code in the mxml file that attempts to access the stylesheet is:

       

      StyleManager.loadStyleDeclarations("theme/purple.css.swf" , true);

       

      but I get an error:

       

      Error: Unable to load style(Error #2035: URL Not Found. URL: theme/purple.css.swf): theme/purple.css.swf.                                    
              at MethodInfo-936()                                                                                                                           
              at flash.events::EventDispatcher/dispatchEventFunction()                                                                                      
              at flash.events::EventDispatcher/dispatchEvent()                                                                                              
              at ModuleInfoProxy/moduleEventHandler()                                                                                                       
              at flash.events::EventDispatcher/dispatchEventFunction()                                                                                      
              at flash.events::EventDispatcher/dispatchEvent()                                                                                              
              at ModuleInfo/errorHandler()

       

       

      I have not managed to get the mxmlc compiler options to be of any use to me and am unsure how to compile the css.swf files into my Flex app so I can access them.

       

      My folder structure is:

       

      src

          locale

          resource

          theme

              purple.css.swf

              white.css.swf

          uk

          Main.mxml

       

      and everything else compiles in correctly.

       

      I have tried embedding the stylesheets but although they do get compiled in when embedded (I can tell as the file size increases) I can't access them as the loadStyleDeclarations takes a String and not a Class as its first argument. They do not get compiled in if I do not embed them. My mxmlc command line is:

       

      mxmlc --strict=true
                 --file-specs ${project.home}/build/src/Main.mxml
                 --output ${project.home}/build/flex-client.swf

       

      Can anyone help?