Posted By

nate63179 on 11/03/09


Tagged

file as3 utils


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

quan
abbey
adrianparr
alptugan


Flash: Get filename from full url


 / Published in: ActionScript 3
 

Retrieves a filename from a complete url

  1. private static function getFilenameFromUrl(url:String):String
  2. {
  3. var letters:Array= [];
  4. var charPosition:int= url.length;
  5. var currentCharacter:String;
  6.  
  7. while(currentCharacter != '/' && currentCharacter != '\\') {
  8. currentCharacter = url.charAt(charPosition);
  9. letters.push( currentCharacter);
  10. charPosition--;
  11. }
  12. letters = letters.reverse();
  13. letters.shift();
  14. var filename:String = letters.join('');
  15. return filename;
  16. }

Report this snippet  

You need to login to post a comment.