Perhaps it's because you are using AS to create the canvas. Possibly a race condition (asynchronous) is occurring as the canvas is resized and the popup is centered. You could always just use mx:Canvas in your main application class instead. It all gets turned into AS anyway. Sorry that I couldn't be of more help
-TH --- In [email protected], "aaron smith" <[EMAIL PROTECTED]> wrote: > > doesnt seem to work correctly. It actually puts the popup in the negative > window space. (see attachment) > I wonder why it would do that. is it something to do with canvas / > percentWidth / percentHeight. i've event tried commenting that out and it > still only puts it at 0,0. > > > > > > > > > > > > On 9/18/06, Tim Hoff <[EMAIL PROTECTED]> wrote: > > > > Hi Aaron, > > > > This code will center the popup relative to the popups's parent. In > > your case "cn". > > > > PopUpManager.centerPopUp(asm); > > > > -TH > > > > --- In [email protected] <flexcoders% 40yahoogroups.com>, "aaron > > smith" > > > > <beingthexemplarylists@> 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 > > > > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

