RE: [flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Tracy Spratt
Rohan, did you miss the solutions posted by Mike and Flexing?  I would
prefer Mikes solution myself.

Tracy

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Rohan Pinto
Sent: Thursday, May 31, 2007 10:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: PopUpManager.createPopUp

 

exactly..

see my demo app: http://demo.rohanpinto.com 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 http://konkan.tv 

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Michael Schmalle
[EMAIL PROTECTED] 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... [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
http://www.teotigraphix.com phix.com
 
  Blog - Flex2Components
  http://www.flex2com http://www.flex2components.com
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 http://www.teotigraphix.com 
 
 Blog - Flex2Components
 http://www.flex2components.com http://www.flex2components.com 
 
 You can find more by solving the problem then by 'asking the
question'.


 



Re: [flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Michael Schmalle

Hi,

I gave an answer to this a couple threads back. See all the threads to this
post and you will see the answer.

Peace, Mike

On 5/31/07, Rohan Pinto [EMAIL PROTECTED] 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 flexcoders%40yahoogroups.com, Michael
Schmalle
[EMAIL PROTECTED] 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... [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.comphix.com
 
  Blog - Flex2Components
  http://www.flex2com http://www.flex2components.components.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'.


 





--
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'.


[flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Rohan Pinto
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
{

[flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Rohan Pinto
I tried running the example code as is.. COPY/PASTE.. and get this error:

private var tw:MyTitleWindow = new MyTitleWindow(); 
1046: Type was not found or was not a compile-time constant: MyTitleWindow
1080: Call to a possibly undefined method MyTitleWindow

tw = new TitleWindow();
1080: Call to a possibly undefined method MyTitleWindow

any tips/advise.. ?
(I'm a flex (infant)newbee, so if i'm doing something wrong here,
please do correct me, it's been less than a week since i have been
playing around with this... )

Rohan
http://demo.rohanpinto.com
--- 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 

[flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Rohan Pinto
Hi Mike,

i did follow all threrads and tried every possible combination... I
could not get it to work..

here's my index.mxml

mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
autoLayout=true layout=vertical 
creationComplete=openWin()
horizontalScrollPolicy=off verticalScrollPolicy=auto
height=100% width=100%
paddingTop=0 paddingBottom=0 x=0 y=0
xmlns:com=com.*
applicationComplete=initApp()

mx:Script
![CDATA[
import mx.containers.TitleWindow;
import mx.effects.Move;
import mx.controls.Menu;
import mx.events.MenuEvent; 
import mx.managers.PopUpManager;
import flash.net.URLRequest;  
import flash.events.MouseEvent; 

[Bindable]
public var vkey:String;
  
[Bindable]
public var chid:String;

public function initApp():void{
vkey=Application.application.parameters.vkey;
chid=Application.application.parameters.chid;
}


public var isOpen : Boolean = false;

private function openWin():void{
if(!isOpen){
PopUpManager.createPopUp(this,main,false);  
isOpen = true;
}


PopUpManager.createPopUp(this,Desktop_Control,false);   

}


]]
/mx:Script
mx:ApplicationControlBar dock=true paddingTop=0 paddingLeft=0
paddingRight=0 paddingBottom=0 x=0 y=0 width=100%
height=40 verticalAlign=middle 
com:LinkImage source=images/logo.png maintainAspectRatio=true
buttonMode=true imageURL=/ click=openWin() /
/mx:ApplicationControlBar
/mx:Application

and here's my main.mxml
mx:TitleWindow width=800 height=500 autoLayout=true
layout=absolute title=Web Desktop showCloseButton=true 
xmlns:mx=http://www.adobe.com/2006/mxml;
backgroundColor=#ff
verticalGap=0 horizontalCenter=0 verticalCenter=0
x=10 y=55
dropShadowEnabled=true
creationComplete=init()
close=closeWindow()
xmlns:ns1=*
   mx:Script
![CDATA[
import mx.core.Application;
import mx.managers.PopUpManager;

public var isOpen : Boolean = true;
//called by the close event raised byclicking the close 
button
public function closeWindow():void
{
PopUpManager.removePopUp(this);
isOpen = false;
}//closeWindow 

  
]]
/mx:Script
mx:VBox x=0 y=0 borderStyle=none paddingTop=20
paddingBottom=10 paddingLeft=10 paddingRight=10 width=100%
height=99%
ns1:FrontPageRecentlyViewedVideos/
/mx:VBox
/mx:TitleWindow

i just cant figure out what i'm doing wrong 

Rohan
--- In flexcoders@yahoogroups.com, Michael Schmalle
[EMAIL PROTECTED] wrote:

 Hi,
 
 I gave an answer to this a couple threads back. See all the threads
to this
 post and you will see the answer.
 
 Peace, Mike
 
 On 5/31/07, Rohan Pinto [EMAIL PROTECTED] 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 flexcoders%40yahoogroups.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 

[flexcoders] Re: PopUpManager.createPopUp

2007-06-01 Thread Rohan Pinto

I got it to work using the following approach: (please let me know if
i've done something stupid)

index.mxml i have this function
   public var isOpen : Boolean = false;

public function openWin():void{
if(!isOpen){
PopUpManager.createPopUp(this,main,false);  
isOpen = true;
}

in main.mxml i have this function

public function closeWindow():void
{
PopUpManager.removePopUp(this);
Application.application.isOpen = false;
}//closeWindow 


Rohan

--- In flexcoders@yahoogroups.com, Rohan Pinto [EMAIL PROTECTED] wrote:

 Hi Mike,
 
 i did follow all threrads and tried every possible combination... I
 could not get it to work..
 
 here's my index.mxml
 
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 autoLayout=true layout=vertical 
   creationComplete=openWin()
   horizontalScrollPolicy=off verticalScrollPolicy=auto
   height=100% width=100%
   paddingTop=0 paddingBottom=0 x=0 y=0
   xmlns:com=com.*
   applicationComplete=initApp()
   
 mx:Script
   ![CDATA[
   import mx.containers.TitleWindow;
   import mx.effects.Move;
   import mx.controls.Menu;
   import mx.events.MenuEvent; 
   import mx.managers.PopUpManager;
 import flash.net.URLRequest;  
 import flash.events.MouseEvent; 
 
   [Bindable]
 public var vkey:String;
   
 [Bindable]
 public var chid:String;
 
 public function initApp():void{
   vkey=Application.application.parameters.vkey;
 chid=Application.application.parameters.chid;
 }
 
 
   public var isOpen : Boolean = false;
   
   private function openWin():void{
   if(!isOpen){
   PopUpManager.createPopUp(this,main,false);  
   isOpen = true;
   }
   
   
   PopUpManager.createPopUp(this,Desktop_Control,false);   
 
   }
 
   
   ]]
 /mx:Script
 mx:ApplicationControlBar dock=true paddingTop=0 paddingLeft=0
 paddingRight=0 paddingBottom=0 x=0 y=0 width=100%
 height=40 verticalAlign=middle 
 com:LinkImage source=images/logo.png maintainAspectRatio=true
 buttonMode=true imageURL=/ click=openWin() /
 /mx:ApplicationControlBar
 /mx:Application
 
 and here's my main.mxml
 mx:TitleWindow width=800 height=500 autoLayout=true
 layout=absolute title=Web Desktop showCloseButton=true 
   xmlns:mx=http://www.adobe.com/2006/mxml;
   backgroundColor=#ff
   verticalGap=0 horizontalCenter=0 verticalCenter=0
   x=10 y=55
   dropShadowEnabled=true
   creationComplete=init()
   close=closeWindow()
   xmlns:ns1=*
mx:Script
 ![CDATA[
   import mx.core.Application;
   import mx.managers.PopUpManager;
   
   public var isOpen : Boolean = true;
   //called by the close event raised byclicking the close 
 button
   public function closeWindow():void
   {
   PopUpManager.removePopUp(this);
   isOpen = false;
   }//closeWindow 
   
   
 ]]
 /mx:Script
 mx:VBox x=0 y=0 borderStyle=none paddingTop=20
 paddingBottom=10 paddingLeft=10 paddingRight=10 width=100%
 height=99%
 ns1:FrontPageRecentlyViewedVideos/
 /mx:VBox
 /mx:TitleWindow
 
 i just cant figure out what i'm doing wrong 
 
 Rohan
 --- In flexcoders@yahoogroups.com, Michael Schmalle
 teoti.graphix@ wrote:
 
  Hi,
  
  I gave an answer to this a couple threads back. See all the threads
 to this
  post and you will see the answer.
  
  Peace, Mike
  
  On 5/31/07, Rohan Pinto rohan@ 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 flexcoders%40yahoogroups.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 

[flexcoders] Re: PopUpManager.createPopUp

2007-05-31 Thread Rohan Pinto
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
[EMAIL PROTECTED] 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... [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.comphix.com
 
  Blog - Flex2Components
  http://www.flex2com http://www.flex2components.components.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'.





[flexcoders] Re: PopupManager.createPopUp - varying the className argument

2005-10-07 Thread fowleryj
I've also got a huge if-statement in my OpenWindowCommand, so the
opportunity to decrease the lines of code in that class was appealing.
I had the same thing happen (white background, then white screen) when
I tried the _global suggestion, though.

--- In flexcoders@yahoogroups.com, Derrick Grigg [EMAIL PROTECTED] wrote:

 Thanks Matt and Jester
  
 No luck though. The background of my app goes white the first time
this function gets called, and the app completely disappears the
second time. If I put hard codeed class names in everything works. I
have come up another solution that seems to work. Each option that
calls the loadWin function is based on a class so instead of
dispatching an event to loadWin I am having the class use popupmanager
to open it's respective window.
  
  var win1: views.elements.image;
  var win2: views.elements.swf;
  var win3: views.elements.text;
  
  function loadWin(event){
   var cn:String = views.elements.+ event.target.type;
   var initObj = {
helpButton: true,
stateButton: true,
resizeButton: true,
closeButton: true
   }
   var win = mx.managers.PopUpManager.createPopUp( _root,
_global[cn], true, initObj, false ); 
   win.centerPopUp(_root);
  }
  
 Thanks for the help though.
 
 
 
 From: flexcoders@yahoogroups.com on behalf of Matt Chotin
 Sent: Fri 07/10/2005 10:44 AM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] PopupManager.createPopUp - varying the
className argument
 
 
 
 Also you need to make sure that the class still gets linked into
your app.  Create some dummy variables of the potential types that
could be loaded:
 
  
 
 Var linkhelper1:MyWindow1;
 
 Var linkhelper2:MyWindow2;
 
  
 
 Etc.
 
  
 
 Matt
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of JesterXL
 Sent: Friday, October 07, 2005 7:38 AM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] PopupManager.createPopUp - varying the
className argument
 
  
 
 Close!
 
 var yourClass:String = Pooki;
 PopUpManager.createPopUp(this, _global[yourClass], false);
 
 - Original Message - 
 From: Derrick Grigg [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Friday, October 07, 2005 10:04 AM
 Subject: RE: [flexcoders] PopupManager.createPopUp - varying the
className 
 argument
 
 
 Tried the string idea, no luck. The switch/if looks like the only
way. I was 
 hoping not to have to do that since I want to have a lot of
variability on 
 the user's window options but not luck apparenetly.
 
 Thanks.
 
 
 
 From: flexcoders@yahoogroups.com on behalf of Mink, Joseph
 Sent: Fri 07/10/2005 9:48 AM
 To: flexcoders@yahoogroups.com
 Subject: RE: [flexcoders] PopupManager.createPopUp - varying the
className 
 argument
 
 
 I would guess you could use a string...like, instead of ...createPopUp( 
 _root, SomeClass, true, initObj, false ); maybe you could do
createPopUp( 
 _root, SomeClass, true, initObj, false );
 
 But I would guess your best bet is to arrange your implementation in
such a 
 way that you can just go through a few if-statements and based on your 
 user's input, execute the necessary call to createPopUp.
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On 
 Behalf Of derrickgrigg
 Sent: Friday, October 07, 2005 9:39 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] PopupManager.createPopUp - varying the className 
 argument
 
 
 I have a instance where I want to vary the pop window that gets
 created based on a user's selection. Instead of having to hard code in
 the a seperate instance of:
 
 var popup = mx.managers.PopUpManager.createPopUp( _root,
 views.OptionX, true, initObj , false );
 
 in a switch statement I would like to just be able to use a variable
 for the className argument.
 
 Ideally I would like to do the following:
 
 var winClass = options_cmb.value;
 var popup = mx.managers.PopUpManager.createPopUp( _root, winClass,
 true, initObj, false );
 
 I have tried unsuccessfully using a shared libray. Does anyone know if
 this is even possible, and it so how I would go about it.
 
 
 
 
 
 
 --
 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
 
 
 
 * Visit your group flexcoders
http://groups.yahoo.com/group/flexcoders  
 on the web.
 
 * To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED]
 
 * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
 http://docs.yahoo.com/info/terms/ .
 
 
 
 
 
 
 
 
 --
 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