Is it possible to use different skins in a class based on some conditions?
We are building an application which is using skin classes in mxml. We plan to build different variants of this application for different user segments, where most of the functionality remains same but only skins vary based on the user segment.
We are adding skins to the application by the following syntax:
<s:BorderContainer id="Banner" height="15开发者_如何转开发%" width="100%" skinClass="mySkins.backgroundSkin"/>
Is there a way we can have a skin based on some condition
i.e if usersegment = "A"
then use myskins.backgroundSkin1
, else use myskins.backgroundSkin2
?
Creat a stylesheet for each user segment where you define the skin classes mapping.
Then you can invoke your stylesheet at runtime with :
styleManager.loadStyleDeclarations("yourStylesheet.swf")
You can also set the skin with actionscript like:
if (usersegment == "A")
Banner.setStyle("skinClass", mySkins.backgroundSkin1);
else
Banner.setStyle("skinClass", mySkins.backgroundSkin2);
精彩评论