AS3 tips: “/” but not “\”
In AS3, if you want to type a link to a website or load in something, make sure you use “/” but not “\”. For example:
http://……
C:/program files/….
This is because if you use Windows, the links shown in the file browers will use “\”, and if you simply copy that into your AS, you will fail to load in that thing and then you will keep searching for bugs without a clue.
What about “file:///C:/…”?
Comment by Anonymous — May 13, 2007 @ 6:04 pmyou could use a little Regular Expression to check:
// notice in local links on Windows you have to escape the backslash
var link:String = “C:\\myDir\\config.xml”;
var regexp:RegExp = /\\/gi;
link = link.replace(regexp, ‘/’);
// returns c:/myDir/config.xml
Comment by Brandon Ellis — May 13, 2007 @ 7:53 pm