[英]Applying skins through actionscript
I have a problem in applying the styles for scroll bar skins through actionscript. 我在通过actionscript将样式应用于滚动条外观时遇到问题。
In css we specify as thumbOverSkin: Embed(source="assets/thumb_over.png",scaleGridLeft="4",scaleGridTop="4", scaleGridRight="5", scaleGridBottom="5"); 在CSS中,我们指定为thumbOverSkin:Embed(source =“ assets / thumb_over.png”,scaleGridLeft =“ 4”,scaleGridTop =“ 4”,scaleGridRight =“ 5”,scaleGridBottom =“ 5”);
In actionscript we specify as setStyle("thumbOverSkin", someImageClass); 在动作脚本中,我们指定为setStyle(“ thumbOverSkin”,someImageClass);
How can we specify scaleGrid properties in the above statement? 我们如何在上面的语句中指定scaleGrid属性?
Thanks for the help in advance. 我在这里先向您的帮助表示感谢。
If you're using Flex 3, that someImageClass
, if it's just an image, could just be assigned to a variable. 如果您使用的是Flex 3,则可以将someImageClass
(仅作为图像)分配给变量。 Try this out, it shows two ways of setting simple skins on Flex 3 components: 试试看,它显示了在Flex 3组件上设置简单外观的两种方法:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
Button
{
overSkin: Embed("assets/over_button.png");
}
</mx:Style>
<mx:Script>
<![CDATA[
[Embed(source="assets/up_button.png", scaleGridLeft="15",scaleGridTop="15", scaleGridRight="25", scaleGridBottom="25")]
public static const UP_SKIN:Class;
]]>
</mx:Script>
<mx:Button id="button" click="button.setStyle('upSkin', UP_SKIN)"/>
<mx:HSlider id="sizer"
minimum="100" maximum="1000"
liveDragging="true"
change="{button.width = sizer.value;button.height = sizer.value/2}"/>
</mx:Application>
(the up_button.png
was a simple red square shrunken to 40x40 for testing). ( up_button.png
是一个缩小为40x40的简单红色正方形 ,用于测试)。
If you're using Flex 4, the Group, which extends Skin, has full 9-slice scaling baked in and you can do a lot more with them. 如果您使用的是Flex 4,则扩展了Skin的Group具有完整的9切片缩放比例,您可以用它们做更多的事情。
Hope that helps, Lance 希望有帮助,兰斯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.