如何将CSS文件动态加载到Flex应用程序中? [英] How do you dynamically load a CSS file into a Flex application?

查看:166
本文介绍了如何将CSS文件动态加载到Flex应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以应用CSS为了使用StyleManager对Flex中的对象进行样式化:

http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html

I know that you can apply CSS in order to style objects in Flex using the StyleManager:
http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html

您也可以动态加载编译的 CSS文件(SWF):

http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html

You can also load compiled CSS files (SWFs) dynamically:
http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html

但是,我使用Web GUI和服务器端脚本动态创建我的CSS文件。
如果CSS被改变,那么脚本也需要将CSS编译成SWF(这不是一个可行的选项)。有什么办法解决这个问题吗?

However, I'm dynamically creating my CSS files using a web GUI and a server-side script. If the CSS is changed, then the script would also need to compile the CSS into an SWF (which is not a viable option). Is there any way around this?

推荐答案

Flex中的应用程序在服务器端在编译时处理,而不是在

The application of CSS in Flex is handled on the server side at compilation and not on the client side at run time.

我会看到两个选项(我不知道这是多么实用):

I would see two options then for you (I'm not sure how practical either are):


  1. 使用服务器端脚本将CSS编译为SWF,然后动态加载它们。

  2. 解析CSS样式表并使用setStyle函数在flex中应用样式。此方法的一个类似示例是 Flex Style Explorer ,您可以在其中请查看来源

  1. Use a server side script to compile your CSS as a SWF then load them dynamically.
  2. Parse a CSS Style sheet and use the setStyle functions in flex to apply the styles. An similar example to this approach is the Flex Style Explorer where you can check out the source.

祝你好运。

这篇关于如何将CSS文件动态加载到Flex应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆