Copy link to clipboard
Copied
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;
}
}
Finally got it.
String(xmlPlaylist.FileList).split('/').splice(6).join("/");
Copy link to clipboard
Copied
use the substr or lastIndexOf methods to cut down you path name to the filename:
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Finally got it.
String(xmlPlaylist.FileList).split('/').splice(6).join("/");
Find more inspiration, events, and resources on the new Adobe Community
Explore Now