Quick and easy GetURL class / actionscript 3 urlrequest

Here is a quick basic flash url loader for quickly adding links to buttons and movie clips in Actionscript 3:

// GetURL Class by Rick Nuthman
// 10.4.09
// Usage:
// new GetURL("url", "target");

package com.frigidfish{
    import flash.net.*;
    public class GetURL{
        private var request:URLRequest;
        public function GetURL(url:String, target:String = '_self'){
            request = new URLRequest(url);         
            navigateToURL(request, target);

It’s just a bare bones script that works like the old getURL() method from actionscript 2.
It defaults to opening the url in a blank page, but you can change this by modifying the 2nd parameter.

import com.frigidfish.GetURL;

// you can add it right to an event listener for a button or movieclip

yourButton.addEventListener(MouseEvent.CLICK, function(){ new GetURL("your_url.html", "_self")});

// or by itself
new GetURL("your_url.html");

I like using this because it makes the code a lot cleaner and easier to read when you have a bunch of links to deal with in Flash. Enjoy!