在 Spark 按钮皮肤上添加图标
我正在尝试为每个按钮添加不同的图标。我已准备好皮肤文件,但不确定是否必须为每个按钮创建不同的皮肤类。听起来效率很低。有什么建议吗?
<s:Button id="pass"
width="110"
height="35"
fontWeight="bold"
fontSize="12"
fontFamily="arial"
label="Past Track"
click="pass_clickHandler(event)"
skinClass="skins.CustomSkin"/>
<s:Button id="future"
width="110"
height="20"
fontWeight="bold"
fontSize="12"
fontFamily="arial"
label="Future Plan"
click="future_clickHandler(event)"
skinClass="skins.CustomSkin"/>
皮肤:
<!-- layer 2: fill -->
<!--- @private -->
<s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="#304fd7"
color.over="#4b6bf6"
color.down="0xAAAAAA"
alpha="0.85" />
<s:GradientEntry color="#1f38a3"
color.over="#3653cf"
color.down="0x929496"
alpha="0.85" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- icon --> // I could add my icon here but that would make me create
// a different icon image for different button
I am trying to add a different icon each of my buttons. I have my skin file ready but not sure if I have to create a different skin class for each button. It sounds inefficient. Any suggestions?
<s:Button id="pass"
width="110"
height="35"
fontWeight="bold"
fontSize="12"
fontFamily="arial"
label="Past Track"
click="pass_clickHandler(event)"
skinClass="skins.CustomSkin"/>
<s:Button id="future"
width="110"
height="20"
fontWeight="bold"
fontSize="12"
fontFamily="arial"
label="Future Plan"
click="future_clickHandler(event)"
skinClass="skins.CustomSkin"/>
The skin:
<!-- layer 2: fill -->
<!--- @private -->
<s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="#304fd7"
color.over="#4b6bf6"
color.down="0xAAAAAA"
alpha="0.85" />
<s:GradientEntry color="#1f38a3"
color.over="#3653cf"
color.down="0x929496"
alpha="0.85" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<!-- icon --> // I could add my icon here but that would make me create
// a different icon image for different button
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它不是内置的,但一些人创建了支持 Spark 按钮中的图标的组件:
http:// /themorphicgroup.net/blog/?p=83
http://www.andymcintosh.com/?p=179
It is not built in, but a few folks have created components that support icons in Spark Buttons:
http://themorphicgroup.net/blog/?p=83
http://www.andymcintosh.com/?p=179
安装 10.2 Flash Player 和稳定的 Hero SDK (4.5.0.19786)。然后您可以使用 Spark 按钮的图标属性。
http://labs.adobe.com/downloads/flashplayer10.html
http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+Hero
请注意,对于您的项目,您必须专门针对播放器版本 10.2.0。除非我的环境有问题,否则在 Flash Builder 的项目编译器设置中使用“使用 Flex SDK 所需的最低版本”选项不适用于此“稳定”sdk。我不明白为什么这样的事情不能像你想象的那样表现。如果有人知道 FB 在哪里找到这个最低播放器版本,请插话。我在 flex-config.xml 文件(sdk 的框架文件夹内)中看到以下内容:
<目标玩家>10.2.0
Flash Builder 似乎忽略了这一点,因为在项目属性中使用所需的最低版本设置时,它仍然尝试在 libs/player/10.1 文件夹中查找。这是 Adobe 的一个主要痛点,似乎每个版本都会引入一些小问题,最终会让人们感到沮丧,甚至放弃将 Flash 作为可行的开发平台。如果这个 adobe 有修复程序,请帮助我们并将其发布在这里。
Install 10.2 Flash Player and stable Hero SDK (4.5.0.19786). You can then use the icon property of the Spark Button.
http://labs.adobe.com/downloads/flashplayer10.html
http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+Hero
Note for your project you will have to specifically target player version 10.2.0. Unless its an issue with my environment, using the 'Use minimum version required by the Flex SDK' option in the project compiler settings of Flash Builder doesn't work with this 'stable' sdk. I don't get why things like this fail to behave as you think they should. If anyone knows where FB finds this minimum player version please chime in. I see the following in the flex-config.xml file (inside frameworks folder of sdk):
<!-- Specifies the minimum player version that will run the compiled SWF. -->
<target-player>10.2.0</target-player>
Flash Builder seems to ignore this, as its still trying to look in the libs/player/10.1 folder when using the minimum required version setting in the project properties. This is a major pain point with Adobe, and it seems every release introduces minor gotchas that will eventually frustrate people to the point of abandoning flash as a viable platform to develop with. If there is a fix for this adobe, please help us out and post it here.