5/10/2010 1:55:19 AM
Title:
how to apply the difference css file to each module instance
i have one doubt for setStyle methode in flex frame work,
i can load the css file at run time to module using styleManger, but my question is if we are using one module instance mean so issue, At the same i want to use difference css file to each module instance,here only i am struggle because styleManager is single ton, it's taking only last style definition, For this case we loop through the display object and using setStyle method to apply corresponding style to that displayObject...
I read lot of Flex performance article ,they recommend to avoid setStyle method ,For this case any other alternative way is there,
5/10/2010 5:24:06 AM
when you apply styles on runtime they take some time to apply , that's the only performance issue. The time depends upon the number of components in an application , An application with 100 components can take upto 1 sec to apply the seconds, what i noticed.Once applied there is no performance issue later on, so you can use runtime style if you are willing to spare some milliseconds for application start up.
you can use this code to load external stylesheet:
StyleManager.loadStyleDeclarations("CSS/myStyleSheet.swf",true,false,ApplicationDomain.currentDomain);
5/10/2010 6:49:23 AM
hi friend ,
if there is one module instance mean no issue, but i am creating two instance for same module in HBox conatainer, here i can load the different css file to each of them, But it is not taking different style definition, Both of them taking last style definition, Beacause StyleManager taking last style definition,
so only we are loop through the displayObject and apply corresponding style to them, for this methodology we are using setStyle method,
5/10/2010 12:42:37 PM
StyleManager is singleton class so the most recent loaded stylesheet is applied to application and modules. An approach is discussed in the below article to apply different styles in modules, hope its useful to you
http://viconflex.blogspot.com/2007/04/flex-modules-compile-and-run-time-css.html
5/10/2010 9:43:20 PM
yes guys,using StyleManager is not possible, any other alternative way to do this,