收录日期:2020/10/28 08:36:39 时间:2010-11-28 04:23:37 标签:flex

When a user clicks a button, I need a separate browser window to popup. How can I set the modal property of the application? (ie, when a popup window opens, the main application is disabled until that popup is closed ... I need to use a browser window rather than a popup window, but can't figure out how to disable the main application)

 PopUpManager.createPopUp (this, navigateToURL( url, "http://www.google.com" ) , true );

thanks!

[[Updated Answer]] Ok, my modal dialog looks like so:

cg = mx.managers.PopUpManager.createPopUp(this, ChoiceGrid, true) as ChoiceGrid;
PopUpManager.centerPopUp(cg);

But, what I would do instead of what you're asking, is embed an IFrame in the modal popup. This is exactly what we're doing in our app to collect CC data (well, not the popup part, just the IFrame bit. http://code.google.com/p/flex-iframe/

This way, you have the standard modal dialog you're looking for, AND an internally managed 'view' out to your checkout server. Something like this:

<code:IFrame id="iFrameWithJSfunctions"
             src="{checkoutURL}" />

The flex-iframe is pretty easy to work with, for the most part. You shouldn't have many problems with it.


[[Original Answer]]
I'm not sure you need a PopUp to do this.

Why don't you simply do:

navigateToURL(urlRequest,"_blank");

instead?

You should think of a Flex App as a self contained entity. The PopUpManager is designed to create Windows (Panels / any UIComponent) that reside over another component inside the SWF. It does not create items that pop up out of the SWF or in new browser windows.

navigateToURL could be used to create a HTML pop-up from your Flex application. However, there is very little--if any--communication between the SWF and the browser pop up. And there is no way to make a modal pop-up.

You might investigate performing an ExternalInterface call and creating your new pop up in JavaScript. Here is an article about creating modal windows in JavaScript. Before going too far down that road, I would think carefully about your requirements. How would feel if one browser window popped open another browser window and prevented you from doing any browsing until you addressed the issues in that window. Or to put it another way, how would you feel if Microsoft Word opened a word document and wouldn't let you edit any other document until you shut down the first one? I'd be pretty upset.

Modal application dialogs are one thing. And the PopUpManager allows you to create those. I would consider Model application windows a bad UI decision.