Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 如何在flex中居中对齐Alert.show()_Actionscript 3_Apache Flex_Actionscript_Flex4_Flex3 - Fatal编程技术网

Actionscript 3 如何在flex中居中对齐Alert.show()

Actionscript 3 如何在flex中居中对齐Alert.show(),actionscript-3,apache-flex,actionscript,flex4,flex3,Actionscript 3,Apache Flex,Actionscript,Flex4,Flex3,我有一个高大的Flex应用程序,它使用Alert.show()来显示错误/警告消息。当错误消息集中在屏幕上,但当屏幕处于极端滚动位置(顶部或底部)时不可见时,这会产生问题。是否有任何方法可以在用户可查看页面的中心显示警报。我尝试了以下方法,但没有成功 var errorMsg:Alert = Alert.show("Error message"); PopUpManager.centerPopUp(errorMsg); 提前感谢。通常以您在参数中提供的父项为中心 使用(FlexGlobal.t

我有一个高大的Flex应用程序,它使用Alert.show()来显示错误/警告消息。当错误消息集中在屏幕上,但当屏幕处于极端滚动位置(顶部或底部)时不可见时,这会产生问题。是否有任何方法可以在用户可查看页面的中心显示警报。我尝试了以下方法,但没有成功

var errorMsg:Alert = Alert.show("Error message");
PopUpManager.centerPopUp(errorMsg);
提前感谢。

通常以您在参数中提供的父项为中心

使用
(FlexGlobal.topLevelApplication作为父级)
作为以下静态方法父参数中的参数

Alert.show(text:String = "", title:String = "", flags:uint = 0x4, parent:Sprite = null, closeHandler:Function = null, iconClass:Class = null, defaultButtonFlag:uint = 0x4, moduleFactory:IFlexModuleFactory = null);
通常以参数中提供的父项为中心

使用
(FlexGlobal.topLevelApplication作为父级)
作为以下静态方法父参数中的参数

Alert.show(text:String = "", title:String = "", flags:uint = 0x4, parent:Sprite = null, closeHandler:Function = null, iconClass:Class = null, defaultButtonFlag:uint = 0x4, moduleFactory:IFlexModuleFactory = null);

这是我的问题的解决方案,我使用javascript调用实现了这一点

var viewPoint:Number = ExternalInterface.call("eval", "window.pageYOffset");
var browserHeight:Number = ExternalInterface.call("eval", "window.innerHeight");
//the following calculation finds the center y coordinate in user's viewable page.
var viewableY : Number = ((browserHeight/2)+viewPoint-50);
var alert : Alert = Alert.show("Error Msg");
PopUpManager.centerPopUp(alert);
alert.move(400,viewableY);

我希望这对某人有所帮助…

以下是我问题的解决方案,我使用javascript调用实现了这一点

var viewPoint:Number = ExternalInterface.call("eval", "window.pageYOffset");
var browserHeight:Number = ExternalInterface.call("eval", "window.innerHeight");
//the following calculation finds the center y coordinate in user's viewable page.
var viewableY : Number = ((browserHeight/2)+viewPoint-50);
var alert : Alert = Alert.show("Error Msg");
PopUpManager.centerPopUp(alert);
alert.move(400,viewableY);

我希望这有助于某人…

嘿,宙斯,谢谢你的回复,但我的主要应用程序高度稍高,因此上述解决方案对我没有帮助。不过,通过使用javascript调用,我现在可以在中心显示警报。再次感谢您的回复。嘿,宙斯,谢谢您的回复,但我的主要应用程序高度稍高,所以上述解决方案对我没有帮助。不过,通过使用javascript调用,我现在可以在中心显示警报。再次感谢您的回复。