如何创建自定义错误和通知消息

发布于 2024-10-21 01:46:04 字数 117 浏览 5 评论 0原文

我想创建自定义错误和通知消息,但我不知道应该使用哪个元素。在消息中应该有图标和文本我尝试使用标签,但不知道如何构建我需要的自定义标签。是否有关于如何创建自定义标签的资源或提示如何创建自定义标签?标签还需要边框和一些效果。

I want to create custom error and notify messages, but i don't know which element should I use. In the message there should be icon and text I tried to use Label but don't know how to build custom label the one I need. Is there a resource on how to create a custom label or tip how to do it? Also label needs border and some effects.

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

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

发布评论

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

评论(1

心不设防 2024-10-28 01:46:04

您只需使用默认的Alert 弹出窗口并添加一个图标即可。

来自 http://blog.flexexamples .com/2007/07/21/setting-an-icon-in-an-alert-control/

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        creationComplete="showAlert();"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            // Embed the error.png image.
            [Bindable]
            [Embed(source='assets/error.png')]
            private var Icon:Class;

            private var a:Alert;

            private function showAlert():void {
                var titleText:String = "WARNING";
                var messageText:String = "Are you sure you would like to erase the Internet?\\n\\nPress OK to continue, or Cancel to abort.";
                /* Display the Alert, show the OK and Cancel buttons,
                    and show an icon represented by the Icon binding. */
                a = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
            }

            private function doClose(evt:CloseEvent):void {
                // do nothing.
            }
        ]]>
    </mx:Script>

    <mx:Button label="Launch Alert" click="showAlert();" />

</mx:Application>

You can just use the default Alert popup and add an icon.

From http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        creationComplete="showAlert();"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;

            // Embed the error.png image.
            [Bindable]
            [Embed(source='assets/error.png')]
            private var Icon:Class;

            private var a:Alert;

            private function showAlert():void {
                var titleText:String = "WARNING";
                var messageText:String = "Are you sure you would like to erase the Internet?\\n\\nPress OK to continue, or Cancel to abort.";
                /* Display the Alert, show the OK and Cancel buttons,
                    and show an icon represented by the Icon binding. */
                a = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
            }

            private function doClose(evt:CloseEvent):void {
                // do nothing.
            }
        ]]>
    </mx:Script>

    <mx:Button label="Launch Alert" click="showAlert();" />

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