tags:

views:

60

answers:

2

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!

A: 

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.

www.Flextras.com
Ultimately, this will be use to redirect the user to an external payment system, like paypal. In this case, I would like to use a browser window so the user can see the url he is being directed to. I also want the user to complete the transaction (or cancel it correctly) before they continue in the app. In 99% of cases I agree that modals are painful from a user perspective, but necessary in the case of a payment system, am I right?
ginius
I'm still not sure the modal popup is a good idea. Have you investigated ways to integrate Paypal Checkout with Flex? ( http://stackoverflow.com/questions/3655317/navigatetourl-set-modal-property/3655496#3655496 ).
www.Flextras.com
My understanding is that, for security reasons, credit card info shouldn't be handled in flash/flex. Therefore, I'd like a popup w/ html browser to handle the transaction. The user can close the popup at anytime, but w/ modal it would ensure that the user exits "gracefully"
ginius
Ok, with that in mind, I'm going to edit my above answer.
reidLinden
@user374436 Why not? What security concerns does the Flash Player introduce over and above what you have already introduced by accessing credit cards via HTML? Be sure that your SWF communicates with the backend over SSL, but otherwise I do not believe the flash player introduces other vulnerabilities. Do you know different?
www.Flextras.com
ginius
If you send a variable between Flex and an external browser, there is no server side call. Anyone intercepting it will need to have software installed on on the machine in question to intercept it. If that is the case, the machine is already compromised and "all HTML" apps could potentially be exposed similarly. An SSL page has to do with the protocol that the page data is using to communicate with the server. There is no reason a Flex app can't communicate with the server using SSL or be served up over SSL Page.
www.Flextras.com
If all you are doing is redirecting to Amazon.com's payment page; you're site probably isn't even collecting the credit cards or other payment information; you're giving that responsibility to Amazon [At least that's how Paypal works; I assume Amazon is similar]. It won't matter how you bring up the Amazon page.
www.Flextras.com
ginius
Is there a Way to display a URL in a pop-up window? Yes! Is there a way to display the page you'll find at that URL? Not in a Flex web based app, but you can in an AIR Desktop app. I believe there is an MX:HTML tag.
www.Flextras.com
+1  A: 

[[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?

reidLinden
my question is more about how to set modal property
ginius