I'm trying to understand the popup manager better, i created a quick test just to get it working and test it out.. most works fine but having problems understanding how to center the popup..

here is my code:


MXML:::

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="initApp()">
    <mx:Script>
        import Startup;
       
        private function initApp():void
        {
            var st:Startup = new Startup();
        }
    </mx:Script>
</mx:Application>


Startup.as:::

package
{
   
    import mx.managers.PopUpManager;
    import mx.containers.Canvas;
    import mx.core.Application;
    import mx.containers.TitleWindow;
    import AddSubscriptionModal;
   
    public class Startup
    {   
        public function Startup()
        {
            var cn:Canvas = new Canvas();
            cn.percentWidth = 100;
            cn.percentHeight = 100;
           
            Application.application.addChild( cn );
           
            var asm:AddSubscriptionModal = PopUpManager.createPopUp( cn, AddSubscriptionModal, true ) as AddSubscriptionModal;
        }
    }
}


AddSubscriptionModal.as:::

package
{
   
    import mx.containers.TitleWindow;
    import mx.managers.PopUpManager;
    import mx.events.CloseEvent;
   
    public class AddSubscriptionModal extends TitleWindow
    {
        public function AddSubscriptionModal()
        {
            doInit();
            addEventListener( CloseEvent.CLOSE, handleCloseModal );
        }
       
        private function doInit():void
        {
            title = "test";
            showCloseButton = true;
            width = 400;
            height = 200;
            //PopUpManager.centerPopUp( this ); //this causes an run-time error, not sure why??
        }
       
        private function handleCloseModal( ce:CloseEvent ):void
        {
            PopUpManager.removePopUp( this );
        }
    }
}



I am wondering if giving the createPopUp method the canvas as parent is the problem?

can someone glance at this quick and see if you can help? or does someone have an example already?

thanks all!

smith

__._,_.___

--
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