自定义复选框/单选按钮

发布于 2024-12-17 22:42:44 字数 259 浏览 2 评论 0原文

感谢您提前帮助我解决问题。

我想知道是否有人有制作自定义复选框/单选按钮的经验。我在舞台上各创造了一个。目标是在影片剪辑中创建每个内容,以便我可以在各种程序中使用它们。当我在以后的界面中使用这些闪存程序时,我发现自己在使用预构建闪存组件时遇到了麻烦。我想建立自己的。如果您对我可以在哪里寻求帮助有任何意见或建议,请告诉我。我还希望他们一次只能点击一次。

快速说明:我的按钮都在影片剪辑中改变了它们的阶段。第 1 帧是上状态,第 2 帧是下状态。

再次感谢!

Thanks for advance for assisting me with my question.

I was wondering if anyone had any experience on making custom checkboxes/radio buttons. I have created one of each on the stage. The goal is to create each in a movie clip so that I can use them in various programs. As I am using these flash programs in an interface down the road, I have found myself to have trouble with the prebuild flash components. I would like to build my own. If you have any advice or suggestion to where I may find help please let me know. I would also like them to be able to only have one clicked at a time.

quick note: I have the buttons both changing their stages in movieclips. Frame 1 is the upstate and frame 2 is the down state.

Thanks again!

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

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

发布评论

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

评论(2

时光倒影 2024-12-24 22:42:44

我自己在 Flash 中从头开始构建了各种 GUI 组件,包括复选框、单选按钮组、屏幕键盘、UIScrollView 和触摸屏的日期选择器相关内容等...

我的一般建议是,避免从尽可能从头开始,因为有许多内置方法和其他一般功能,我们都认为这是理所当然的。

我自己并不喜欢预构建的 Flash 组件,尤其是触摸屏组件。在考虑从头开始构建之前,我建议您研究一下为您想要的组件设置皮肤。网上有很多帮助,包括:

http:// www.adobe.com/devnet/flash/articles/skinning_flash_cs3.html?PID=4176632

我确实听说 Flex 将会获取(或已经拥有)一些为移动设备设计的移动 GUI 组件,这些组件大概也可以在桌面上使用。但不记得具体在哪里。

另一个选择是这个人对 GUI 东西的重新制作,可以在 GitHub 上找到:
http://custardbelly.com/blog/2010/08/24/介绍-as3flobile-components/

单击演示图像,在“miscelany”下您将找到一个很好的无线电组示例。(这个人名叫 Todd也是,所以你应该相信他:)

只有在所有上述选项都被认为没有问题之后,然后从头开始构建我制作的复选框/无线电组类(我无法发布)是迄今为止最基本的。我创建的组件,所以它可能不像重新创建任何其他组件那么糟糕,我所做的是创建一个基本的单选按钮类,然后在需要的地方添加适当的逻辑

。有点帮助,祝你好运!

I have built various GUI components from scratch in Flash myself, including check boxes, radio groups, on screen keyboard, UIScrollView and date picker related things for touch screens, etc...

My general piece of advice, avoid building components from scratch whenever possible as there are many built in methods and other general functionality that we all take for granted.

I am not a fan of the pre-built Flash components myself, especially for touch screens. Before considering building from scratch I recommend you look into skinning the components you want. There is plently of help for this online, including:

http://www.adobe.com/devnet/flash/articles/skinning_flash_cs3.html?PID=4176632

I did hear somewhere that Flex will be getting (or already has) some mobile GUI compenets designed for mobile devices, which presumably can be using on desktop as well. Don't recall where exactly though.

Another option is this guy's recreation of GUI stuff, available on GitHub:
http://custardbelly.com/blog/2010/08/24/introducing-as3flobile-components/

Click on the demo image and under "miscelany' you will find a good radio group example. (This guy is named Todd too, so you should trust him :)

Only after ALL the above options are deemed no bueno, then proceed with building from scratch. The check box / radio group class I made (which I cannot release) was by far the most basic of the components I have created, so it might not be as bad as recreating any of the other components. What I did was make a base radio class, then added radio buttons dynamically to a radio group. Adding the appropriated logic where needed.

I hope that helps a little and good luck!

星星的轨迹 2024-12-24 22:42:44

使用 Flash 从头开始​​创建自定义单选按钮

您可以使用形状中的 3 帧作为单选按钮。

例如:

1-表示启用且未选择 在此处输入图像描述

1.2-for 启用并选择 在此处输入图像描述

3-为禁用且不能选择在此处输入图像描述

你可以这些图像导入到三个框架并使用 gotoAndStop()

这是一个示例类:

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;

    public class Main extends Sprite
    {
        public function Main():void
        {
            active.stop();
            inactive.gotoAndStop(3);
            enabledBox.gotoAndStop(2);
            active.addEventListener(MouseEvent.MOUSE_UP, changeState);
        }

        private function changeState(e:MouseEvent):void
        {
            if (e.target.currentFrame == 1)
            {
                e.target.gotoAndStop(2);
                statusField.text = "[Enabled]";
            }
            else
            {
                e.target.gotoAndStop(1);
                statusField.text = "[Disabled]";
            }
        }
    }
}

有关完整的详细信息,您可以使用它:

https://code.tutsplus.com/tutorials/create-a-custom-radio-button-from-scratch-using-flash--active-4294

Create a Custom Radio Button from Scratch Using Flash

You can use a 3frames from your shape as a radio button.

e.g.:

1-for enable and did not choose enter image description here

1.2-for for enable and choose enter image description here

3-for disable and can not choose enter image description here

You can these image import to three frames and use gotoAndStop()

this is a example class:

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;

    public class Main extends Sprite
    {
        public function Main():void
        {
            active.stop();
            inactive.gotoAndStop(3);
            enabledBox.gotoAndStop(2);
            active.addEventListener(MouseEvent.MOUSE_UP, changeState);
        }

        private function changeState(e:MouseEvent):void
        {
            if (e.target.currentFrame == 1)
            {
                e.target.gotoAndStop(2);
                statusField.text = "[Enabled]";
            }
            else
            {
                e.target.gotoAndStop(1);
                statusField.text = "[Disabled]";
            }
        }
    }
}

For full details you can use it:

https://code.tutsplus.com/tutorials/create-a-custom-radio-button-from-scratch-using-flash--active-4294

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