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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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.