navigateToURL ... set modal property - apache-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.

Related

window.open in web application for iPad running in fullscreen replaces the existing window

I am writing a simple (ASP.NET) web application for the iPad. It is written and works well however one feature is it serving up PDF files (among others). To do this I used window.open to open the file.
When this is done in Safari, it works perfectly. You click the button, the file opens in a new tab; you can then close the tab to return to the previous web page.
However now running the application in fullscreen mode - i.e. with the appropriate "meta names" set and from a shortcut on the home screen - when you click the button to load the file, it loads fullscreen with no means to get back to the last page.
Because it is a file, not a webpage, I can't put a "Back" button on, and when you press the iPad button it simply closes the whole thing.
I know this has been asked before and I have read a number of similar questions - the closest of which was this:
https://stackoverflow.com/questions/9168236/web-app-hyperlinks
If at all possible, it would be far preferable (thanks to the control library I am using) that the button click is done with javascript - it is not easy to set the link href.
The upshot is I really I just want to create a new window from within a fullscreen iPad web application, or allow the "back" navigation somehow...
Is this possible?
Thanks!
Create an iframe on your page rather than using an window.open and set that as the target.
That way your pdf would open within your existing window.
Use some client side javascript like jQuery to style it like a dialog window.

How to make a slide up modal page in Meego?

I'm developing an app which works more or less like the Notes app. When user click the + button a modal window with TextEdits is to be slided up,just like the Notes app did. However I was unable to locate any resource mentioning this kind of thing. Any clues?
I think you are looking for the QML Sheet element. You will need to implement the TextEdit part yourself.

Flex Accessiblity - Tab Focus goes out of flex app

In an accessible flex app, the user can navigate through the control by using the TAB key.
The flex app pops up on top of the html page aftert the user activate a particular link, and is loaded using swfobject.embedSWF.
It works well in most cases, but there are some instances where either or both these happen:
a) The flex app loads ok, the "flex focus" is set on the intro text label to read out loud, but pressing tab seems to still cycle through the links on the page behind. (Now Fixed, see Edit 2)
b) The focus worked well and pressing tab cycle through the controls ok, but after going through them it then tabs out of the flex app and onto the address bar.. it becomes a nightmare to even try to get back to the flex app without clicking on it.. which isn't exactly accessibility friendly.
Is there any way to prevent these from happening?
EDIT: The target browser is IE. Seems to be the most used with Jaws
EDIT: I managed to fix problem (a). The trick was to call focus on the swf object, but after a slight time out - must be something to do with flash/js ready state.
setTimeout(function(){
document.getElementById('swfobject').focus()
},25);
Problem (b) is still an issue though...
In your mx:Application component, add an event listener for the keyFocusChange and add this code :
protected function application1_keyFocusChangeHandler(event:FocusEvent):void
{
event.preventDefault();
focusManager.getNextFocusManagerComponent(event.shiftKey).setFocus();
}
b) Try to place some focusable element after swf in html. When focus leaves flex app, see if onfocus handler of that element gets called. If it is, you can refocus flex app from there or redirect it where you want.

How do I create a popup from Flex without a browser toolbar?

I'm trying to launch a popup window from Flex, but the popup window needs to have certain properties as one can usually specify with the JavaScript window.open. For example, the popup window should not have a browser toolbar or URL box.
I've tried using navigateToURL, which works fine, but I can't find a way to specify the popup window properties.
I've tried using ExternalInterface.call, but the popup gets blocked when calling window.open directly, or even creating a custom JS function that calls window.open.
Help!
Thanks!
I don't think it's even possible to disable the browser toolbar or URL box in a lot of browsers (I certainly do not allow it on any of the browsers I use).
If you're using navigateToURL, why can't the page you're opening run the JS to try to disable the toolbar and URL? I think you can also attach attributes to the URL if you wanted to send properties over.
You can use PopUpManager class of Flex for creating custom pop up box.
This example may help you. Custom PopUp
Check out AndrewT's blog about checking for popup blockers.
If not blocked, then use ExternalInterface; otherwise use the flex popup.
Detecting Popup Blockers
Or better yet, use SWFAddress v2.3 (javascript and AS3) modules. The AS3 has SWFAddress::popup() facade that proxies the poup call to the javascript. You can modify the SWFAdress.js popup function to use Andrew's logic and return a status. This would be a best practice: leveraging superlative SWFAddress library from flex for deeplinking, google analytics, and popups.

Open and Close Popup windows without Javascript in ASP.NET

How can I Open and Close Popup windows without Javascript in ASP.NET?
What do you mean "Popup windows".
JavaScript allows you to manipulate the properties of a window object allowing you to remove the status bar, address bar, set the size and position of the new window and other things.
The only other way (short of using VB script :) is to have links with target set to _blank.
But then you can't customise the new window.
You can't.
Opening and closing popups implies javascript code execution on the client side.
You could eventually create an ASP.Net panel that looks like a popup and set it visible/invisible during the postback but it won't behave like a 'real' popup.
Unless otherwise but I conquer with #Olivier that you can't do that without using Javascript. Even with the solution given by #Avi, you are still using Javascript though it is kinda abstracted from you.
Maybe, you could explain why you don't want to use javascript because even without the AjaxControl, it is kinda pretty easy to open and specify other properties of pop up windows.

Resources