在 Spark 按钮皮肤上添加图标

发布于 2024-09-05 12:00:34 字数 1395 浏览 4 评论 0原文

我正在尝试为每个按钮添加不同的图标。我已准备好皮肤文件,但不确定是否必须为每个按钮创建不同的皮肤类。听起来效率很低。有什么建议吗?

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏末 2024-09-12 12:00:35

它不是内置的,但一些人创建了支持 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

ら栖息 2024-09-12 12:00:35

安装 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 文件夹中查找。这是 Adob​​e 的一个主要痛点,似乎每个版本都会引入一些小问题,最终会让人们感到沮丧,甚至放弃将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文