A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: strip .swf extension from display

  1. #1
    con[fuzed] designer
    Join Date
    Jan 2003
    Location
    UK
    Posts
    314

    strip .swf extension from display

    I've made a simple mp3 player that draws external swf's from an array, there is a dynamic text area (title)that displays the name of the file that is playing.

    code:

    on (release) {
    if (count == undefined) count = 0;
    {
    _level1.unloadMovie(); // stop loading old stream
    loadMovieNum(urls[count],1); // load new song into level1
    title.text = urls[count];
    playing.text = "now playing:";
    }
    }



    Is it possible to strip the .swf extension so that it just displays the filename?

    Thanks.

  2. #2
    Member
    Join Date
    Jul 2001
    Posts
    91
    yes:
    string.substring(0, string.length-4)

  3. #3
    con[fuzed] designer
    Join Date
    Jan 2003
    Location
    UK
    Posts
    314
    thanks but how do i implement that into my code?

  4. #4
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    code:

    title.text = urls[count].substring(0, urls[count].length-4);


  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    my_string = "hello.swf";
    //my_string = urls[count];
    mynew_string = my_string.substring(0, my_string.length-4);
    trace(mynew_string);
    //title.text = mynew_string;

  6. #6
    con[fuzed] designer
    Join Date
    Jan 2003
    Location
    UK
    Posts
    314
    thanks a lot, works a treat, anyone know why the actionscript tags arent working??

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Nope! They just stopped working. Use [ code][ /code] tags instead!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center