/ Published in: ActionScript 3
Retrieves a filename from a complete url
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private static function getFilenameFromUrl(url:String):String { var letters:Array= []; var charPosition:int= url.length; var currentCharacter:String; while(currentCharacter != '/' && currentCharacter != '\\') { currentCharacter = url.charAt(charPosition); letters.push( currentCharacter); charPosition--; } letters = letters.reverse(); letters.shift(); var filename:String = letters.join(''); return filename; }