Hi,

There is no problem with what you have but... his question was,

how to i prevent a popup if the popup TileWindow is already Open..

That means, he is asking how does he only create ONE TitleWindow after a
user has clicked the button to create it the first time.

There are two ways, using a boolean flag in the application that holds the
button or doing what I showed by checking if the instance is not null in the
application.

What you said the first time would work IF the boolean flag is in the actual
application. It wouldn't work if the flag was in the title window because
the popup manager would have already created another popup on top of the
first popup.

Peace, Mike

On 5/31/07, Flexing... <[EMAIL PROTECTED]> wrote:

  Hi Mike,

>> The manager will have already created the instance and the TitleWindow
would have to use removePopUp() which is not optimum.
I didn't understand what is the issue in using removePopup inside
Titlewindow ?

Let say if I write the following to handle window closure , is there any
issue in this ?


<mx:TitleWindow showCloseButton="true" close="{onClose(event)}">
<mx:Script>
 <![CDATA[
public var isOpen : Boolean = true;

private function onClose(event : Event) :  void
 {
  PopUpManager.removePopUp(this);
isOpen = false;
 }

public function setOpen() : void
{
isOpen = true;
}
]]>
</mx:TitleWindow>


Thanks

On May 31, 2007, at 5:46 PM, Michael Schmalle wrote:

Hi,

I don't think a boolean flag will help here. The manager will have already
created the instance and the TitleWindow would have to use removePopUp()
which is not optimum.

You need to take that call out of the mxml and create a click handler for
the button.

.. in your app

private var popUpWindow:TitleWindow;

private function button_clickHandler(event:MouseEvent):void
{
   if (!popUpWindow)
   {
      popUpWindow = TitleWindow( PopUpManager.createPopUp(this,main,false));

   }
}

....

<mx:Button click="button_clickHandler(event) ;"/>

Peace, Mike

On 5/31/07, Flexing... <[EMAIL PROTECTED]> wrote:
>
> Store a boolean (flag) in your titlewindow to indicate whether the
> Window is already open or not.
>
> On May 31, 2007, at 9:56 AM, Rohan Pinto wrote:
>
> how to i prevent a popup if the popup TileWindow is already Open..
>
> ie: in my conrtol i have
>
> click="PopUpManager.createPopUp( this,main,false);"
>
> if the user clicks this several times, it opens up multiple popups of
> the same window. how do i prevent the popup to just 1 instance ?
>
>
>


--
Teoti Graphix
http://www.teotigra <http://www.teotigraphix.com>phix.com

Blog - Flex2Components
http://www.flex2com <http://www.flex2components.com>ponents.com

You can find more by solving the problem then by 'asking the question'.






--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to