开发者

Dynamically loading style in Flex AIR App

So i decided to implement some themes in my AIR app. I have converted my CSS files into SWF files, removed the Style linkage from my main file. Based on the user preferences stored in a file, I decide which theme to use. i.e; load the SWF file using StyleManager class.

I made my application window invisible, added a StyleEvent.COMPLETE event listener for the IEventDispatcher object returned by StyleManager.loadStyleDeclarations method. After the Style开发者_C百科Event.COMPLETE occurs, I made my main window visible.

The problem i have now is, for a few seconds, i can see white canvases and all my components without any styles before using the style selected. I want to know if my approach is correct or do I need to make any changes to implement this properly?


Alright, so I seem to have figured it out myself. Getting some help from this link albeit.

Previously i read the settings in my applicationComplete and loaded the styles. So i guess all the UI components were created and added to the display list. They were bare naked without any style values.

So i changed the reading of the settings file to preinitialize, so that by the time the applicationComplete is triggered, AIR has already loaded the SWF stylesheet. So it will display the UI as i wanted.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜