as3 getURL() for as3

Posted by druva | Flash, Flex, as2, as3, utils | Tuesday 4 November 2008 2:48 am

Code Snippet :: getURL() for as3


function getURL(url:String, windowType:String):void {

 var windowTypes:Array = new Array('_blank', '_self');

 if(windowTypes.indexOf(windowType) == -1){
 windowType = '_blank';
 }

 var request:URLRequest = new URLRequest(url);

 try {
 navigateToURL(request, windowType);
 } catch (e:Error) {
 trace("Error occurred! Unable to open window");
 }

}

 getURL("http://www.example.com/");