Skip to main content
Inspiring
March 25, 2013
Answered

Video file name on listbutton label

  • March 25, 2013
  • 1 reply
  • 761 views

I'm playing FMS videos from XML. but no need visible filelist path on listbutton.label.

How can i show only video file name on listbutton.label ;

<?xml version="1.0" encoding="utf-8"?>

<XML>

  <FileList>files/store1/2013/1/2/15/video1</FileList>

  <FileList>files/store1/2013/1/2/15/video2</FileList>

  <FileList>files/store1/2013/1/2/15/video3</FileList>

</XML>

AS3

function playlistLoaded(e:Event):void

{

          xmlPlaylist = new XML(urlLoader.data);

for (var i:int=0; i<xmlPlaylist.FileList.length(); i++)

  {

     listbutton = new Button();

     listbutton.y = i * 19 + 1;

     listbutton.width = 200;

     listbutton.height = 20;

     listbutton.label = xmlPlaylist.FileList;

     }

}

This topic has been closed for replies.
Correct answer VenkatBaddi

Finally got it.

String(xmlPlaylist.FileList).split('/').splice(6).join("/");


1 reply

Inspiring
March 25, 2013

use the substr or lastIndexOf methods to cut down you path name to the filename:

Inspiring
March 25, 2013

files/store1/2013/1/2/15  this paths are not fixed.

changing daily.  But folders are fixed so what can i do...? how to caluculate "/", and remove before filename

like..

files/store1/2013/3/6/23

files/store2/2013/12/30/15

files/store3/2013/8/10/20


VenkatBaddiAuthorCorrect answer
Inspiring
March 25, 2013

Finally got it.

String(xmlPlaylist.FileList).split('/').splice(6).join("/");