Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : URL Encode ?


David Stiller
1/18/2006 5:12:23 PM
yevri,

[quoted text, click to view]

You may have to convert more than just the question mark. Since your
URL is a complicated one, you might have to urlencode the equals sign and
more.

Here's an encoding chart.

http://i-technica.com/whitestuff/urlencodechart.html

You might want to just try the escape() function, though. Look up
escape() and unescape() ... this is precisely the kind of thing they're for.
:)


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

yevri
1/18/2006 10:01:43 PM
Hi all,

I have a link with a ? in it and it won't work. So I read the help file about
URL encoding and saw a post on this site about it as well. So I used %3F
instead of the ? in the code. But it still doesn't work. Is there something I'm
missing? Do I need to write a line of code about converting to a string or
something? I didn't quite get the help file on it. If so, can you please let me
knwo what that should be. I also tried pasting the URL into an app Urami
mentioned (http://www.dommermuth-1.com/protosite/experiments/encode/index.html)
but the resultant encoded text didn't work either.

Here is the code:


getURL("/cgi-bin/adtrack.pl?sponsor=iwireless&url=http://www.i-ontheweb.com","_b
lank");

Thanks,

Yevri

NSurveyor
1/18/2006 10:14:04 PM
The only part you want to encode is "http://www.i-ontheweb.com", the rest is
fine because you are using querystring variables. So, you should be using:


getURL("/cgi-bin/adtrack.pl?sponsor=iwireless&url=http%3A%2F%2Fwww%2Ei%2Donthewe
b%2Ecom","_blank");

BTW, Flash has a built in function for encoding... escape, e.g.:
trace(escape("http://www.i-ontheweb.com")); And using the same idea, you could
use the following for ease of reading:


getURL("/cgi-bin/adtrack.pl?sponsor=iwireless&url="+escape("http://www.i-onthewe
b.com"),"_blank");


yevri
1/19/2006 2:32:15 AM
Thanks guys.

I tried the escape function, and I thought I understood what was going on, but
when I put this script in, it now makes it to i-ontheweb.com, but gives an
error after there.

Script:

getURL("/cgi-bin/adtrack.pl?sponsor=iwireless&url="+escape("http://www.i-onthewe
b.com"),"_blank");

error:
can?t open the page ?http://http://www.i-ontheweb.com? because it can?t find
the server ?http?.

What am I missing?

NSurveyor
1/19/2006 3:42:00 AM
AddThis Social Bookmark Button