Recently, a flex project is used in different cities, but the customer needs to have different styles for the interface.
I want to use dynamic calls to Implement CSS. But after looking for the compiled project, there are only swfand some image samples, and there is no. CSS file.
Considering that when compiling flex, CSS may be compiled into SWF, so that it cannot be dynamically called...
Finally, I checked the flex help document and found the loadstyledeclarations method under the stylemanager class, and then loaded the style.
It's actually very simple.
Right-click compile CSS to SwF on CSS first
It is to compile CSS into SWF for convenient calling.
Then
Stylemanager. loadstyledeclarations ("CSS/flexblu.swf ");
After the page is loaded, call this compiled SWF.
However, there is still a certain delay, that is, the style is loaded only after the flash is loaded. In this way, the newly loaded flash will be in a stateless state for a short time...
To solve this problem, I wrote a small CSS file, that is, the basic style of the homepage is loaded in mxml, so there is no style at all. After loading the page, I dynamically call the CSS style, in this way, the user experience will be better.