开发者

Is it possible to use different skins in a class based on some conditions?

开发者 https://www.devze.com 2023-02-28 07:12 出处:网络
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 b

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);
0

精彩评论

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

关注公众号