User Guide
44 ActionScript language elements
Parameters
expression:String - The expression to convert into a string and encode in a URL-encoded
format.
Returns
String - URL-encoded string.
Example
The following code produces the result
someuser%40somedomain%2Ecom:
var email:String = "someuser@somedomain.com";
trace(escape(email));
In this example, the at symbol (@) was replaced with %40 and the dot symbol (.) was replaced
with
%2E. This is useful if you're trying to pass information to a remote server and the data has
special characters in it (for example,
& or ?), as shown in the following code:
var redirectUrl = "http://www.somedomain.com?loggedin=true&username=Gus";
getURL("http://www.myothersite.com?returnurl="+ escape(redirectUrl));
See also
unescape function
eval function
eval(expression:Object) : Objecteval(expression:String) : Object
Accesses variables, properties, objects, or movie clips by name. If expression is a variable or a
property, the value of the variable or property is returned. If expression is an object or movie
clip, a reference to the object or movie clip is returned. If the element named in expression
cannot be found, undefined is returned.
In Flash 4,
eval() was used to simulate arrays; in Flash 5 or later, you should use the Array
class to simulate arrays.
In Flash 4, you can also use
eval() to dynamically set and retrieve the value of a variable or
instance name. However, you can also do this with the array access operator (
[]).