css - 如何将 CSS 文件动态加载到 Flex 应用程序中?

标签 css apache-flex dynamic-css

我知道您可以应用 CSS 以便使用 StyleManager 为 Flex 中的对象设置样式:
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

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

最佳答案

this comment在 Adob​​e 错误跟踪器 T 中解决与此相关的问题。 Busser 正在描述对您来说可能是可行的解决方案:

"I've created a small class that will 'parse' a CSS file read with an HTTPService object. It takes apart the string that is returned by the HTTPService object, break it down into selectors, and create a new CSSStyleDeclaration object for each selector that is found. Once all the properties are assigned to the CSSStyleDeclaration object it's added to the StyleManager. It doesn't perform any checks, you should make sure the CSS file is well formed, but it will be sufficient 99% of the time. Stuff like @font, Embed() and ClassReference() will hardly be used by my customers. They do need the ability to change colors and stuff like that so they can easily theme the Flex application to their house style."

您可以尝试联系此人寻求解决方案,也可以使用 this as3csslib project 中的代码作为编写类似他们所描述内容的基础。

关于css - 如何将 CSS 文件动态加载到 Flex 应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/204924/

相关文章:

html - 使用 li 代替选择选项

jquery - 视差背景 block 在全尺寸时不起作用

apache-flex - 在 Flex 应用程序中显示 HTML

css - 在 Flex 的 swf 文件中嵌入外部 CSS

css - 在 asp.net 2.0 中动态应用 CSS

css div溢出和动态水平尺寸

html - 防止窗口从某个点向下垂直调整大小

html - 使用 HTML 和 CSS 的邮件图标

apache-flex - 在 Flex 选项卡式 View 导航器之间切换

php - 动态调整 div 大小/重新定位以进行多列查看