如何指定CSS的高度和宽度的弹性警告框? [英] how to specify height and width of flex alert box in css?

查看:133
本文介绍了如何指定CSS的高度和宽度的弹性警告框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Flex 4应用程序中,我希望所有的警告框都是特定的宽度和高度,我如何在CSS中指定它?我想避免每次我想显示一个警报时指定宽度和高度,这就是为什么我想在CSS中设置它,但看起来没有办法..
类似于这是行不通的:

  mx | Alert 
{
height:100;
width:300;


解决方案

+像这样的代码



样式属性定义为

  Alert {

height:300;
重量:300;注意:身高身高
/ strong>不是警报的默认样式



代码中使用它们

  var alert:Alert = Alert.show(Hello World); 
alert.explicitHeight = Number(alert.getStyle(height));
alert.explicitWidth = Number(alert.getStyle(weight));

Flex3的工作示例是

 <?xml version =1.0encoding =utf-8?> 
creationComplete ={show()}>
< mx:Style>
Alert {

height:300;
重量:300;
}
< / mx:样式>
< mx:Script>
<![CDATA [
import mx.controls.Alert;
private function show():void
{
var alert:Alert = Alert.show(Hello World);
alert.explicitHeight = Number(alert.getStyle(height));
alert.explicitWidth = Number(alert.getStyle(weight));
}
]]>
< / mx:Script>
< / mx:Application>

解释

提示默认情况下 支持高度权重 风格 >将用户定义的保存为变量。



在屏幕上显示 Alert / Popup 使用 Alert 类的静态 show 方法,该方法返回创建/活动的实例/对象 Alert / Popup,使用这个参考,它的属性可以像上面的例子 explicitHeight explicitWidth 那样在运行时进行操作。



希望帮助


In my Flex 4 app I would like all my alert boxes to be a specific width and height, how do I specify that in the CSS? I want to avoid having to specify the width and height every time I want to show an alert, that's why I'd like to set it in the CSS, but does not look like there's a way to.. Something like this does not work:

mx|Alert
{
  height: 100;
  width: 300;
}

解决方案

You can do it Using Style + Code like this

Define Style Properties as

Alert {

        height:300;
        weight:300;
    }

Note: height and weight are not default style of Alert

Using them in Code as

var alert:Alert = Alert.show("Hello World");
alert.explicitHeight = Number(alert.getStyle("height"));
alert.explicitWidth = Number(alert.getStyle("weight"));

Working example of Flex3 is

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    creationComplete="{show()}">
    <mx:Style>
        Alert {

            height:300;
            weight:300;
        }
    </mx:Style>
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            private function show():void
            {
                var alert:Alert = Alert.show("Hello World");
                alert.explicitHeight = Number(alert.getStyle("height"));
                alert.explicitWidth = Number(alert.getStyle("weight"));
            }
        ]]>
    </mx:Script>
</mx:Application>

Explanation

Since Alert Control by default not support height and weight style, so example used them just for holding user defined values as variable.

In routine to display Alert/Popup on screen Static method show of class Alert is used, which returns the instance/object of created/active Alert/Popup, using this refrence its properties can be manipulated at runtime as done in above example i.e. explicitHeight and explicitWidth.

Hopes that Help

这篇关于如何指定CSS的高度和宽度的弹性警告框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆