Aaron I see 2 problems into your code,
1. You are trying to center a children popUp 2. You can't reference to centerPopUp using the reference this, you have to point the right id of your Canvas to center as a popUp. You will see the error #1009 as a reference to a null object. ;) Igor Costa www.igorcosta.org On 9/18/06, aaron smith <[EMAIL PROTECTED]> wrote:
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
-- ---------------------------- Igor Costa www.igorcosta.org www.igorcosta.com skype: igorpcosta

