If you want a quick example, try the following, replacing the var's for
something more meaningfull where required. This will do popup's as well
as setting var's inside them.  You used to be able to do this when
creating a popup in flex 1.5, but now you can do it as below as you
don't pass in an object when you addPopUp anymore. 

Public function openUpAPopUp() : void {

var createdPopUp:YourTitleWindow = 

                                    new YourTitleWindow ();

 

                                    createdPopUp.someVar =
whateverYouWishToInitilise;

                                    createdPopUp.width       = 325;

                                    createdPopUp.height      = 125;   

                                    

 


                                    PopUpManager.addPopUp( 

                                                createdPopUp, 

                                                DisplayObject(
mx.core.Application.application ), 

                                                true

                                    );

                                    

                                    PopUpManager.centerPopUp(
createdPopUp );

}

 

Then just create a file called "YourTitleWindow.mxml" which is a
titleWindow and you'll have an instant pop up in the center of your
application.

Or just go to
http://examples.adobe.com/flex2/inproduct/sdk/explorer/explorer.html for
some flex 2 examples

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of fredsells
Sent: 16 April 2007 20:29
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Newbie createPopUp problems

 

I've copied various examples of using PopUpManager.createPopUp but
cannot get it to work.  I'm running from Eclipse using the flex Eclipse
plug-in under XP.  Eclipse does not show any errors (i.e. red marks) in
either file, but when I run I get a dialog "Errors exist in required
application".  

I have tried creating a new project and still have the same problem.  I
have been searching for 2 days now and cannot find a clue.  My code is
below.  

Is there some way to get better debug/diagnostic info in this case.  Can
anyone see what's wrong?

zflex001.mxml

        <?xml version="1.0" encoding="utf-8"?>
        <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; >
           <mx:Script>
           <![CDATA[
           import dialog;
           function openDialog():Void {
              var popupParent:zflex001 = this;
              var isModal:Boolean = true;
              var initObj:Object = { title:"Delete Record" };
              var verifyPopUp = mx.managers.PopUpManager.createPopUp(
popupParent, dialog, isModal, initObj );
           }
           ]]>
           </mx:Script>
           <mx:Button label="Verify" click="openDialog();" />
        </mx:Application>


dialog.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"; width="300"
height="120" title="Verify Action" >
   <mx:Label id="lblVerify" text="Are you sure you want to do this?" />
   <mx:HBox>
      <mx:Button label="Ok" />
      <mx:Button label="Cancel"  />
   </mx:HBox>
</mx:TitleWindow>





 

Reply via email to