thanks bhavan

that really really helped... thanks a ton...

whew !!

Rohan

--- In flexcoders@yahoogroups.com, "Flexing..." <[EMAIL PROTECTED]> wrote:
>
> Rohan,
> 
> Its not complex.
> Here's a sample app which will demonstrate what I had suggested in my  
> email:
> 
> http://www.geocities.com/bhuvangupta/flexblog/TWTest.swf
> 
> and Here's the code:
> 
> Code of TWTest.mxml
> =================
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";  
> layout="absolute">
>       <mx:Button id="btn" label="Show Window" click="showWindow()"/>
>       <mx:Script>
>               <![CDATA[
>               
>                       private var tw : MyTitleWindow = new MyTitleWindow();
>                       private function showWindow() : void
>                       {
>                               if(tw == null)
>                               {
>                                       tw = new MyTitleWindow();
>                                       tw.width =200;
>                                       tw.height = 300;
>                               }
>                               tw.showTW();
>                       }
>               ]]>
>       </mx:Script>
> </mx:Application>
> ===================
> 
> 
> Code of MyTitleWindow.mxml
> ========================
> <?xml version="1.0" encoding="utf-8"?>
> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";  
> layout="vertical" width="400" height="300"
>       showCloseButton="true" close="{onClose()}" title="Hello World"  
> horizontalAlign="center" verticalAlign="middle">
>       <mx:Label text="Hello World !!"/>
>       <mx:Script>
>               <![CDATA[
>                       import mx.core.Application;
>                       import mx.managers.PopUpManager;
>                       
>                       
>                       public var isOpen : Boolean = false;
>                       
>                       private function onClose(): void
>                       {
>                               isOpen = false;
>                               PopUpManager.removePopUp(this);
>                       }
>                       
>                       public function showTW() : void
>                       {
>                               if(isOpen)
>                                       return;
>                                       
>                               isOpen = true;
>                               
> PopUpManager.addPopUp(this,Application.application as  
> DisplayObject);
>                               PopUpManager.centerPopUp(this);
>                       }
>               ]]>
>       </mx:Script>
>       
> </mx:TitleWindow>
> =====================
> On May 31, 2007, at 8:29 PM, Rohan Pinto wrote:
> 
> > exactly..
> >
> > see my demo app: http://demo.rohanpinto.com
> >
> > if you click on the logo, the TileWindow opens over and over again...
> > i want to restrict that to just one instance.. any advise.. please.. ?
> >
> > Rohan
> > http://konkan.tv
> >
> > --- In flexcoders@yahoogroups.com, "Michael Schmalle"
> > <teoti.graphix@> wrote:
> > >
> > > 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... <eaiesb@> 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... <eaiesb@> 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