Flex dynamically calls CSS Implementation Method

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.