2008-05-12
AS3 - URL Class
I could not find it in the net so I hacked something together quickly. A simple URL class that parses an url string.
Actionscript:
-
/* example usage */
-
var url:URL = new URL("http://secretuser:secretpass@example.com:80/foo/bar.php?var1=foo#abc");
-
trace( 'scheme:'+url.scheme+'\n'
-
+ 'host:'+url.host+'\n'
-
+ 'port:'+url.port+'\n'
-
+ 'path:'+url.path+'\n'
-
+ 'fragment:'+url.fragment+'\n'
-
+ '---\n'
-
+ 'user:'+url.userinfo.user+'\n'
-
+ 'pass:'+url.userinfo.pass+'\n'
-
+ '---\n'
-
+ 'query.raw:'+url.query.raw+'\n'
-
+ 'query.parsed.var1:'+url.query.parsed.var1+'\n'
-
+ 'query.parsed.var2:'+url.query.parsed.var2+'\n'
-
);
Get it if you have some use for it: http://dev.dschini.org/as3/URL.as (before it gets lost in my archive)
