Home » Programming » ActionScript » GetURL function in ActionScript 3

GetURL function in ActionScript 3

If you know you have worked with ActionScript 2, open to the requests and requests web links and web addresses are used getURL command. Of course, this function is not supported in this way in ActionScript 3. In this article we want this function to prepare the old name for ActionScript 3.

first import classes for use navigateToURL :

import flash.net.URLRequest;
import flash.net.navigateToURL;

in this step define function with name (getURL) and arguments defined like old function , first argument is URL address and next argument is Target to open link like (_blank and etc.)

function getURL(url:String, target:String = null)
{
	try
	{
		navigateToURL(new URLRequest(url), target);
	}
	catch (error:Error)
	{
		trace("[getURL] "+error);
	}
}

 

finally with use naviageToURL in this function and  use new URLResquest for URL address string data and use target data in navigateToURL use for target to open link.

be successful.

Print Friendly
Tags :
Previous post link
Next post link

About Behrouz Pooladrag

Born: May 27, 1988 Occupation: Adobe Flash, programming and web design, graphic design, multimedia, web-based software

Leave a Reply

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

*

Scroll To Top