Posted By

onemanstudio on 12/02/10


Tagged

rewrite as3 swfaddress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

onemanstudio
burnandbass


SWFAddress HASH rewrite


 / Published in: ActionScript 3
 

URL: http://onemanstudio.eu/snipplr/swfaddress-hash-rewrite.as

This is for as3 websites with html background, it simply rewrites address with #/

  1. var baseURL:String = stage.loaderInfo.url;
  2. if(baseURL.search("#") == -1)
  3. {
  4. var withoutHttp:String = baseURL.substring(7,baseURL.length);
  5. var indexOfSlash:Number = withoutHttp.indexOf("/", 0);
  6. var baseDomain:String = withoutHttp.substring(0, indexOfSlash);
  7. var fullDomain:String = "http://"+baseDomain+"/";
  8. var rest:String = baseURL.substring(fullDomain.length, baseURL.length);
  9. var rewrited:String = fullDomain + "#/" + rest;
  10. //var URL:URLRequest = new URLRequest(rewrited)
  11. //navigateToURL(URL, "_self" )
  12. }

Report this snippet  

You need to login to post a comment.