I have a tall Flex application that uses Alert.show( ) to display error/warning messages. This created problems when the error messages were centered on the screen, but not visible when the screen was at an extreme scroll position (top or bottom). is there any way that i can display the Alert in the center of the user's viewable page. I've tried the following, but didn't work.
var errorMsg:Alert = Alert.show("Error message");
Thanks in advance.
It depends on what is doing the scrolling. centerPopUp() centers on the stage. If the stage is larger than the viewport and is scrolled you'll need to know about the viewport. If the viewport is the browser, you might be able to get information about the viewport via ExternalInterface
Here is the solutions for my problem.
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");
I hope this helps someone...