1 Reply Latest reply on Nov 11, 2009 11:57 AM by Flex harUI

    runtime css WHY BOTHER

    vertex_shader Level 1



      there are a lot of blog posts and excellent documentation on using runtime css.

      however, none of them really address the *why*.


      the adobe docs say:

      "By loading style sheets at run time, you can load images (for graphical skins), fonts, type and class selectors, and programmatic skins into your Flex application without embedding them at compile time. This lets skins and fonts be partitioned into separate SWF files, away from the main application. As a result, the application's SWF file size is smaller, which reduces the initial download time. However, the first time a run-time style sheet is used, it takes longer for the styles and skins to be applied than if you load styles by using the <mx:Style>

      tag. This is because Flex must download the necessary CSS-based SWF file while the application is starting up or running."


      from what i gather:

      - it's good because i've separated my styling code from my application code. ok, fine. not critical tho.

      - reduces initial download time? fine. but I still can't display my app because I have to wait for the css swf to be download first and then be applied (which takes longer to apply at runtime)

      - takes more code to apply the style, when to apply it in the initialization phase, and how to avoid flicker of original halo style

      - i've seen a few posts on problems with css and modules


      do i need to swap css styles at runtime? no.

      but lets assume i want to change the style in the future to give it a fresh look. i could simply replace the css swf on the server and only that swf will be downloaded and updated in the users browser cache. correct? great. for all that architectural pain, i've saved them a few extra kilobytes of download time.


      and what about themes? the halo theme is the default and compiled into your app *regardless* of whether u use runtime css or compile time css. so u may as well build a theme swc to begin with.