【问题标题】:Why Alert.show() don't display text为什么 Alert.show() 不显示文本
【发布时间】:2013-05-28 11:07:20
【问题描述】:
Alert.show('Text Copied!', 'Alert Box', mx.controls.Alert.OK);

“文本已复制!” - 不显示

mx.controles.Alert.OK - 也​​不显示在按钮本身

标题中只显示“警告框”,为什么会这样?

【问题讨论】:

  • 可以分享截图吗?是否有可能您在 CSS 中设置的样式无意中影响了警报框?
  • 无法发布图片,因为我没有 10 名声望 :(( 给我点赞,我会发布图片 :),在 CSS 中,我所有的 VBox、HBox、Box 都被锁定了styleName,不,它不是样式......还有什么?
  • @NoobKraker 已投票,您现在应该可以发布屏幕截图了。
  • @NoobKraker 请参阅我的回答中的示例。

标签: apache-flex actionscript mxml


【解决方案1】:

我猜这个常数很糟糕。警报可能使用火花警报,而您传入​​参数 mx.controls.Alert.OK,这意味着它是 mx,而不是火花。试试

mx.controls.Alert.show('Text Copied!', 'Alert Box', mx.controls.Alert.OK);

或使用火花警报参数

【讨论】:

    【解决方案2】:

    试试下面的代码(css source),非常简单,完美运行:

        <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.controls.Alert;
    
                public function init():void{
                    Alert.show('Text Copied!', 'Alert Box', mx.controls.Alert.OK);
                }
            ]]>
        </mx:Script>
    
        <mx:Style>
            Alert{
                color : #124332;
                background-color: #ffffff;
                header-colors : #243322, #243322;
                header-height:19;
                drop-shadow-enabled: true;
                drop-shadow-color :#243322;
                corner-radius :6;
                border-style :solid;
                border-thickness: 1;
                border-color : #243322;
                footer-colors : #243322, #ffffff;
                title-style-name : "title";
            }
            .title{
                font-family :Verdana;
                font-size :10;
                font-weight :bold;
                color :#ffffff;
            }
        </mx:Style>
    </mx:Application>
    

    【讨论】:

      猜你喜欢
      • 2011-08-14
      • 2013-12-25
      • 1970-01-01
      • 2016-04-19
      • 2019-03-14
      • 1970-01-01
      • 2019-09-29
      • 2011-08-14
      • 1970-01-01
      相关资源
      最近更新 更多