Flex and JavaScript Popups
Jul 30
I was posed with a question the other day about how to keep JavaScript in-line without hosting the mxml file within a container page (ie JSP, HTML, CF, etc). Flex handles in-line JavaScript popups very similar to Flash. If you’ve tried to make a call to:
getURL(“javascript:window.open(‘http://www.google.com’, ‘win’, ‘width=600, height=600′);”); in Flash or Flex you’ll note the inherent problem with the new window being opened but also the child window (the one with the Flash movie) has been redirected a page that reads [object Window]. The Flash player actually redirects you to the URL instead of launching the new window and returning. This describes the exact problem I was questioned about the other day. You can peak at the problem and the solution in an example below along with the code that drives it: The key is to use the void(0) statement, which tells the browser to stop what it’s doing. The popup is launched and the browser is halted. Kind of a nuisance but it’s a little bit of code for what you gain from it.