Can the position of an Alert window be controlled? Rather than centered, I would like my Alert box to be positioned 20 pixels from the top of the stage.

When I have created an Alert instance, I have been unable to get move() or setting x and y to control the position of the Alert window.

I see that the position of a TitleWindow can be controlled. LiveDocs for TitleWindow has an example using localToGlobal() at the bottom of this page:
http://livedocs.macromedia.com/flex/2/langref/mx/containers/TitleWindow.html

When modifying that TitleWindow example to use an Alert instead, the same code fails to control the position of the Alert window (where it did control the TitleWindow). Following below is the TitleWindow example modified to use an Alert.

I appreciate assistance understanding this.

Pete

** TitleWindow example modified to use an Alert **

<?xml version="1.0" encoding="utf-8"?>
<!-- Main application to demonstrate TitleWindow layout container. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
      
            import mx.controls.Alert;
            //import mx.managers.PopUpManager;
            //import mx.containers.TitleWindow;
            import flash.geom.Point;

            private var point1:Point = new Point();
     
            // Open the TitleWindow container.
            // Cast the return value of the createPopUp() method
            // to SimpleTitleWindowExample, the name of the
            // component containing the TitleWindow container.
            private function showWindow():void {
                var login:Alert;
                //var login:SimpleTitleWindowExample=SimpleTitleWindowExample(PopUpManager.createPopUp( this, SimpleTitleWindowExample , true));

                // Calculate position of TitleWindow in Application's coordinates.
                point1.x=myButton.x;
                point1.y=myButton.y;               
                point1=myButton.localToGlobal(point1);

                login = Alert.show('Hello World!', 'Message');

                login.x=point1.x+25;
                login.y=point1.y+25;
            
                // Pass a reference to the TextInput control
                // to the TitleWindow container so that the
                // TitleWindow container can return data to the main application.
                //login.loginName=returnedName;
            }
        ]]>
    </mx:Script>

    <mx:Panel title="TitleWindow Container Example" height="75%" width="75%"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Button id="myButton" label="Click to open the TitleWindow container"
            click="showWindow();"/>
       
        <mx:Text id="returnedName" text="" width="100%"/>

    </mx:Panel>
</mx:Application>


Stay in the know. Pulse on the new Yahoo.com. Check it out. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to