alimills / navigatetowindow

navigateToWindow() is a package-level ActionScript function that encapsulates the logic around opening a browser popup window

This URL has Read+Write access

name age message
file .gitignore Thu Apr 16 14:51:39 -0700 2009 adding gitignore [alimills]
file MIT-LICENSE.txt Tue Aug 04 11:21:22 -0700 2009 adding MIT license [alimills]
file README.textile Thu May 14 16:24:51 -0700 2009 updating the README's link to NavigateToWindowT... [alimills]
directory bin/ Thu Apr 16 16:25:08 -0700 2009 adding a README [alimills]
directory lib/ Thu Apr 16 15:07:34 -0700 2009 adding a test case that demonstrates how naviga... [alimills]
file rakefile.rb Thu Apr 16 17:24:02 -0700 2009 updating the navigateToUrl interface to have ex... [alimills]
directory script/ Thu Apr 16 15:07:34 -0700 2009 adding a test case that demonstrates how naviga... [alimills]
directory src/ Tue May 19 10:48:56 -0700 2009 removing unused ContextObject.as [alimills]
directory test/ Thu May 14 16:22:52 -0700 2009 updating the order of navigateToWindow's constr... [alimills]
README.textile

navigateToWindow()

navigateToWindow() is a package-level ActionScript function that encapsulates all of the logic around opening a browser popup window from within Flash.

The function works very similarly to navigateToURL except that you call it with the parameters that JavaScript’s window.open might expect.

The test/patternpark/net/NavigateToWindowTest.as file demonstrates how you might use navigateToWindow(). This project was build with Project Sprouts. To run the test suite, install Sprouts and then run ‘rake html’ from the location where you pulled this project down.

One of the unique and interesting features of this implementation is that the developer using it doesn’t have to write any JavaScript. Using a method derived from the ideas of Abdul Qabiz and his post A MXML component that embeds JavaScript in html, Doug McCune and his post Multi-line strings in Actionscript 3, and Jordan Ambra and his post Popups Blocked in AS3 with navigateToURL() we are able to execute all necessary JavaScript directly from ActionScript.

For background on this project, you can check out my old post Workaround for Safari Blocking Flash Initiated Pop Ups.

For another interesting project that solves this same problem through a JavaScript file and an ActionScript file, check out Matt Lohkampl’s popupfromflash.