如何从flex动作脚本的复选框类中获取复选框图标?

发布于 2024-10-12 06:50:04 字数 69 浏览 2 评论 0原文

我想获取 Flex 框架的复选框类中存在的复选框图像,我如何访问该图像。

需要帮助的

问候。

i want to get the checkBox image that is present in the checkBox class of flex Framework how can i access that image.

help needed

regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

时光与爱终年不遇 2024-10-19 06:50:04

正如 Chris 提到的,复选标记是使用 FXG 绘制的,而不是存储为位图。这是复选标记 FXG,取自 CheckBoxSkin(并进行了一些清理):

<s:Path left="2" top="0" id="check"
        data="M 9.2 0.1 L 4.05 6.55 L 3.15 5.0 L 0.05 5.0 L 4.6 9.7 L 12.05 0.1 L 9.2 0.1">        
    <s:fill>
        <s:SolidColor id="checkMarkFill" color="0" alpha="0.8" />
    </s:fill>
</s:Path>

您可以创建一个仅显示此路径的自定义组件并将其插入到您喜欢的任何位置。希望有帮助。

As Chris mentioned, the checkmark is drawn using FXG rather than stored as a bitmap. Here's the checkmark FXG, taken from CheckBoxSkin (and cleaned up a little):

<s:Path left="2" top="0" id="check"
        data="M 9.2 0.1 L 4.05 6.55 L 3.15 5.0 L 0.05 5.0 L 4.6 9.7 L 12.05 0.1 L 9.2 0.1">        
    <s:fill>
        <s:SolidColor id="checkMarkFill" color="0" alpha="0.8" />
    </s:fill>
</s:Path>

You could create a custom component that just displays this path and insert it wherever you like. Hope that helps.

巡山小妖精 2024-10-19 06:50:04

如果您使用的是 Flex 4 组件,则复选框图标不是图像,而是复选框组件的标准外观内的矢量路径。如果您想从类中访问它,您可以这样做:

var mySkin:CheckBoxSkin = this.skin as CheckBoxSkin;
mySkin.check = WhateverYouWannaDoWithIt;

但是如果您只是想更改复选框的外观,只需创建一个自定义 CheckBoxSkin(然后您也可以添加图像图标)并将其分配给您的复选框组件。

If you are using Flex 4 components, the checkbox Icon is not an image but a vector path inside the standard Skin of the checkbox component. If you wanted to access that from within the class you could do:

var mySkin:CheckBoxSkin = this.skin as CheckBoxSkin;
mySkin.check = WhateverYouWannaDoWithIt;

But if you simply want to change the look of your checkbox, just create a custom CheckBoxSkin (you can also add image Icons then) and assign it to your checkbox component.

简美 2024-10-19 06:50:04

我假设您想更改图像?

如果是这样,这是 Flex 3 的一个很好的示例:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/25/changing-a-checkbox-controls-icon/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            [Bindable]
            [Embed(source="assets/icon_accept.gif")]
            public var AcceptIcon:Class;

            [Bindable]
            [Embed(source="assets/icon_alert.gif")]
            public var AlertIcon:Class;
        ]]>
    </mx:Script>

    <mx:CheckBox id="checkBox"
            label="Custom icon test (selected={checkBox.selected})"

            disabledIcon="{AlertIcon}"
            downIcon="{AlertIcon}"
            overIcon="{AlertIcon}"
            upIcon="{AlertIcon}"

            selectedDisabledIcon="{AcceptIcon}"
            selectedDownIcon="{AcceptIcon}"
            selectedOverIcon="{AcceptIcon}"
            selectedUpIcon="{AcceptIcon}"
         />

</mx:Application>

来自 blog.flexexamples.com 的示例(这些天几乎总是关闭!

Im presuming you want to change the image?

If so, this is a good example for Flex 3:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/25/changing-a-checkbox-controls-icon/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            [Bindable]
            [Embed(source="assets/icon_accept.gif")]
            public var AcceptIcon:Class;

            [Bindable]
            [Embed(source="assets/icon_alert.gif")]
            public var AlertIcon:Class;
        ]]>
    </mx:Script>

    <mx:CheckBox id="checkBox"
            label="Custom icon test (selected={checkBox.selected})"

            disabledIcon="{AlertIcon}"
            downIcon="{AlertIcon}"
            overIcon="{AlertIcon}"
            upIcon="{AlertIcon}"

            selectedDisabledIcon="{AcceptIcon}"
            selectedDownIcon="{AcceptIcon}"
            selectedOverIcon="{AcceptIcon}"
            selectedUpIcon="{AcceptIcon}"
         />

</mx:Application>

Example from blog.flexexamples.com (which is almost always down these days!

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