Calendar

January 2007
S M T W T F S
« Dec   Feb »
 123456
78910111213
14151617181920
21222324252627
28293031  

Tag Cloud

Categories

Archives

Recent Posts

Recent Comments


« Missed 360, how about FlexManiacs | Main | FlexInABox.com »

Flex 2.0.1 Style Swapping

By Rich Tretola | January 19, 2007
2,747 views

One of the cool new features of Flex 2.0.1 is the ability to compile your style sheets to swf and then do real time style changes of your application. This sample creates 2 style sheet swfs and then uses the StyleManager to swap them. Full source is available.

changeit.jpg

Click here to run the application

Rich

Topics: Flex 2, Tutorials | 11 Comments »

11 Responses to “Flex 2.0.1 Style Swapping”

  1. ScaleNine Blog » Blog Archive » Flex 2.0.1 Runtime CSS Example Says:
    January 21st, 2007 at 4:07 pm

    [...] found a great example by Rich Tretola on how to switch styles at runtime in Flex 2.0.1. I think I might try to put [...]

  2. ScaleNine Blog » Blog Archive » Theme Swapper Says:
    January 21st, 2007 at 6:05 pm

    [...] on Rich Tretola’s example mentioned in my last post, I created a Theme Swapper app using the Flex 2.0.1 runtime CSS feature. [...]

  3. everythingflex Says:
    January 21st, 2007 at 6:37 pm

    Glad the sample helped, your styles are excellent.

    Rich

    Reply to this comment

  4. murugast Says:
    February 9th, 2007 at 12:48 am

    Hai,
    Its find Great
    But I am getting Follwoing Error
    —–
    Error: Unable to load style(SWF is not a loadable module):
    at MethodInfo-636()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at ::ModuleInfoProxy/::moduleEventHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at ::ModuleInfo/initHandler()

    Murugan

    Reply to this comment

  5. murugast Says:
    February 9th, 2007 at 12:55 am

    Hai
    I Have tried the vith the Source proivide also i am getting the following error

    Error: Unable to load style(Error #2124: Loaded file is an unknown type. URL: file://D/NewStyleDec/bin/style2.css): style2.css.
    at MethodInfo-636()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at ::ModuleInfoProxy/::moduleEventHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at ::ModuleInfo/errorHandler()

    I can found the Css files are existing in Bin folder

    can u expalin me what might be the Pblm

    Thanks
    Murugan

    Reply to this comment

  6. Cristian Nica Says:
    March 27th, 2007 at 3:26 pm

    Murugast, for that, you must compile CSS to swf. To do that, right click on the css file from the navigator pane and choose compile css to swf.
    If you’ll do that, everithing will be fine

    Reply to this comment

    Rad Reply:

    It seems that when loading a CSS style at runtime, compiled to SWF, the custom ClassReference(”assets.skins.TabSkin”) does not work, more than that it throws 2 errors:

    1120: Access of undefined property TabSkin.
    1172: Definition skins:TabSkin could not be found

    Any ideas?

    Reply to this comment

    Rad Reply:

    OK, THIS SEEMS TO BE AN ADOBE FLEX BUG, SO….

    http://bugs.adobe.com/jira/browse/FB-11925

    Reply to this comment

  7. Logan Says:
    November 20th, 2007 at 6:36 pm

    404 not found, can you fix?

    Reply to this comment

  8. everythingflex Says:
    November 21st, 2007 at 7:50 am

    Sorry, that was a case sensitivity issue that was missed when I moved to a Linux box. It should be fine now.

    Reply to this comment

  9. idea-boss Says:
    May 25th, 2009 at 8:01 am

    I tried it flex 3. Only the panel header text changes. The rest remains un changed. Any fixes ?

    Reply to this comment

Comments