Converting characters into a URL friendly format

posted by The Hippy in Actionscript 3, Useful code bits

There is a handy command in Actionscript that I’d previously never encountered until this week:

escape()

If you’re receiving a text input and needing to send it out to a URL, for example in a search box, you need to convert any special characters into character codes before you request the URL. For example, a space should be sent as %20.

The escape() command allows you to do this with one command rather than having to search through character by character and reference it to a character codes array.

More

Post to Twitter Post to Facebook Post to StumbleUpon Post to Digg