Re: [flexcoders] Re: Flex / Web Integration

2007-09-21 Thread Stephen Allison
 For #1 below, I switched to using the javascript window.open
 command instead of navigateToURL() with _blank for the target.

Yes, a window opened with javascript can be closed with javascript  
without warning, but be aware that popup-blockers stop windows being  
opened using window.open when called from ExternalInterface - users  
will see a message like 'blocked one popup from this site, click here  
to see it'. 
  


[flexcoders] Re: Flex / Web Integration

2007-09-20 Thread byte.sensei
I solved my own problem and thought I'd post the result here for 
posterity...

For #1 below, I switched to using the javascript window.open 
command instead of navigateToURL() with _blank for the target. 
Specifically, I'm using the following AS 3 code:

import flash.external.ExternalInterface;

public function open_window(url : String, window : String = _blank, 
features : String = ) : void {
  ExternalInterface.call(window.open, url, window, features);
}

For problem #2 below, I found the activate event and use it to 
detect when Flash Player receives focus after the pop-up window is 
closed, and then call the web service -- works great!


 

--- In flexcoders@yahoogroups.com, byte.sensei [EMAIL PROTECTED] 
wrote:

 I have a Flex 2.0 app that has to open a URL used to configure a 
 shopping cart item. When finished configuring an item and you 
return 
 to Flex, Flex calls a web service to retrieve the item 
configuration 
 and all is good.
 
 Currently, I'm opening a new browser window using navigateToURL() 
 with _blank for the target.  This presents a couple of problems:
 
 1) When the item configuration is done and the window is closed 
 (using Javascript) I get the annoying The webpage you are using is 
 trying to close the window and you have to verify that you want to 
 close the window.
 
 2) I don't have any good way to detect the window was closed and 
then 
 fire off the web service to get the item configuration -- I 
basically 
 have to wait for the user to do something back in the Flex app that 
 causes an event to fire that I can trigger on. (I'm currently using 
 the focusOut event of the Quantity field in the item data grid, but 
 there's no guarantee the user will click/tab into a quantity field 
 and then back out after configuring an item...)
 
 So, does anyone know of a way I could open a new window/url for the 
 item configuration, but then return to the Flex app without the Do 
 you want to close this window? dialog box AND in a way that would 
 fire a Flex event I can use to trigger the web service call?
 
 I don't have any control over the item configuration URL/code -- 
 it's a 3rd party application I'm integrating with...
 
 Thanks in advance for any insight/help!