AS3 Window

Ok, so one thing that has always bugged me about as3′s navigateToURL is its lack of control over the window that is opened, mainly that you can’t control the width and height. There are of course ways around this with javascript, but wouldn’t it be nice if you could do this from within as3, with no external dependencies! Well turns out you can do just that with this nifty little library.

Introducing AS3 Window.
You can download it via github.

In it’s simplest form, the following will open a new popup window with a width and height of 640×460 and will be placed 100 pixels from the left of the screen and 50 pixels from the top of the screen.

?View Code ACTIONSCRIPT
var window:Window = new Window();
window.width = 640;
window.height = 460;
window.x = 100;
window.y = 50;
window.open('popup.html');

You can close the window by calling the close() function.

?View Code ACTIONSCRIPT
window.close();

Get Adobe Flash player

The library has numerous features, but I’ll leave that for another day.

Submit a Comment

Your email address will not be published. Required fields are marked *