开发者

StyleManager: calling getStyleDeclaration after loadStyleDeclarations (Flex 3.5)

An AIR app has default theme compiled in & themes that may be loaded from the external swfs (css-based), that override the default.

Called StyleManager.loadStyleDeclarations with update=true, and then called 开发者_运维问答getStyleDeclaration in the StyleEvent.COMPLETE handler for the dispatcher returned by the loadStyleDeclarations. Expected it to return a declaration from the new loaded theme, got one from the default theme instead.

The question is at what point it is safe to call getStyleDeclaration after loadStyleDeclarations to get the declarations from the loaded theme? Are there any other events to listen for that (haven't found this in documentation yet)?


Solved. The problem was not with getStyleDeclaration itself, it returned the right CSSStyleDeclaration instance, but with the fact that styles loaded in css-based swf don't have a factory function used to get all syles for a selector, just protected overrides object that may be queried using getStyle. I used CSSStyleDeclaration.factory to construct StyleSheet objects at runtime. It works fine on compiled-in styles. With loaded styles, I'll ought to use getStyle on CSSStyleDeclaration objects to get the overriden styles by name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜