Hi Matt,

This is an HBox MXML component.

SnippetPane.mxml (This mxml gets loaded in an HBox in the MainApp.mxml file so there IS nesting of mxml components going on here. That is the only difference I can see).
-----------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="*"
    paddingBottom="4" paddingLeft="4" paddingRight="4" paddingTop="4"
    width="100%" height="100%">

    <mx:Script>
        <![CDATA[
       
            import mx.managers.PopUpManager;
            import flash.util.trace;
           
            public var snippetWindow:SnippetTypeWindow;
           
            private function onAddSnippetButton(event:MouseEvent):void
            {
                snippetWindow = PopUpManager.createPopUp(this, SnippetTypeWindow) as SnippetTypeWindow;
                snippetWindow.addEventListener("creationComplete", onWindowComplete);
                //PopUpManager.centerPopUp(snippetWindow);
                snippetWindow.width = 500
                snippetWindow.height = 300
               
            }
           
            private function onWindowComplete(event:Event):void
            {
                //PopUpManager.centerPopUp(snippetWindow);
            }
           
        ]]>
    </mx:Script>

    <mx:Form width="100%" height="100%">
        <mx:FormItem label="Name:" width="100%">
            <mx:TextInput width="100%"/>
        </mx:FormItem>
        <mx:FormItem label="Description:" width="100%">
            <mx:TextArea width="100%" height="75"/>
        </mx:FormItem>
        <mx:FormItem label="Snippet type:" direction="horizontal">
            <mx:ComboBox id="typeComboBox"></mx:ComboBox>
            <mx:Button label="..." width="25" id="addSinppetButton" click="onAddSnippetButton(event)"/>
        </mx:FormItem>
        <mx:FormItem label="Snippet:" width="100%" height="100%">
            <mx:TextArea height="100%" width="100%"/>
        </mx:FormItem>
    </mx:Form>
   
    <mx:VRule height="100%"/>
   
    <mx:VBox height="100%">
   
        <mx:Button width="75" label="OK" id="okButton"/>
        <mx:Button width="75" label="Cancel" id="cancelButton"/>
        <mx:Button width="75" label="Help" id="helpButton"/>
   
    </mx:VBox>
   
</mx:HBox>

------------------------------------------------------------

here is the TitleWindow MXML component subclass.

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="*"
    creationComplete="onWindowComplete(event)"
    layout="horizontal"
    title="Manage Snippet Types"
    width="550" height="300">
   
    <mx:Script>
        <![CDATA[
           
            import mx.managers.PopUpManager;
           
            private function onWindowComplete(event:Event):void
            {
                PopUpManager.centerPopUp(this);
            }           

        ]]>
    </mx:Script>
   
    <mx:List width="200" height="100%"></mx:List>
    <mx:VRule height="100%"/>
   
    <mx:Form width="100%" height="100%">
        <mx:FormHeading label="Add category"/>
        <mx:FormItem label="Author" width="100%">
            <mx:TextInput width="100%" id="authorTextInput"/>
        </mx:FormItem>
        <mx:FormItem label="Name" width="100%">
            <mx:TextInput width="100%" id="nameTextInput"/>
        </mx:FormItem>
        <mx:FormItem label="Description" width="100%">
            <mx:TextArea width="100%" id="descriptionTextArea"/>
        </mx:FormItem>
    </mx:Form>
   
    <mx:ControlBar>
        <mx:Label text="Adds a new snippet category"/>
        <mx:Spacer width="100%"/>
        <mx:Button label="Add" id="addButton"/>
        <mx:Button label="Cancel" id="cancelButton" click="PopUpManager.removePopUp(this)"/>
    </mx:ControlBar>
   
</mx:TitleWindow>


----------------------------------------

I have tried the creationComplete in 3 spots. Yes, I know I shouldn't even have to do that with center popup.

With these two mxml files and a parent mxml application, you should be able to recreate it. I CANNOT get it to work what ever I do.

Peace, Mike






On 5/4/06, Matt Chotin <[EMAIL PROTECTED]> wrote:

Do you have a code example of the failure?

 


From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com] On Behalf Of Michael Schmalle
Sent: Wednesday, May 03, 2006 8:26 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex2 :: PopUpManager.centerPopUp() :: not working

 

Hi,

I have used this method before in Beta 2, and now it is not centering.

The PopUpManager looks like it thinks the TitleWindow width & height are 0,0.

I have tried putting the call in the creationComplete event, setting the height and width explictly on the TitleWindow. Nothing works.

I searched the list to see if this was an occuring problem and found nothing.

Any thoughts? Other than in this instance I have to manually calc the center and set the windows position.

Peace, Mike

--
What goes up, does come down.


--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
What goes up, does come down.

--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to