Actionscript 获取id3标记操作脚本
我需要获得用户计算机上轨道的id3标签Actionscript 获取id3标记操作脚本,actionscript,air,Actionscript,Air,我需要获得用户计算机上轨道的id3标签 var song_sound:Sound; function ID3Tag(path:String) { song_sound = new Sound(); var _soundURL:URLRequest = new URLRequest(path); song_sound.load(_soundURL); song_sound.addEventListener(Event.ID3, readID3); } functio
var song_sound:Sound;
function ID3Tag(path:String)
{
song_sound = new Sound();
var _soundURL:URLRequest = new URLRequest(path);
song_sound.load(_soundURL);
song_sound.addEventListener(Event.ID3, readID3);
}
function readID3(event:Event):void
{
trace(song_sound.id3.artist+" "+song_sound.id3.album);
}
function directorySelected(directory:File):void
{
//var count:int = 0;
if (directory.isDirectory)
{
var files:Array = directory.getDirectoryListing();
for (var i:int = 0; i < files.length; i++)
{
if (files[i].isDirectory)
{
directorySelected( files[i] );
}
else
{
ID3Tag(files[i].nativePath);// DOES NOT WORK
}
}
}
}
然后它就起作用了。
问题出在哪里?您是否调试了应用程序,以确保传递给
ID3TAG
函数的文件路径字符串正确?我猜你的代码在下面一行失败,song\u sound.load(\u soundURL)代码>?你好,斯莱·拉斯卡尔。有了这个,我已经明白了。但现在的问题在于另一个方面。如果有一个包含音乐的文件夹,我需要递归地遍历它并获取有关音乐曲目的信息(ID3标记)。我的程序可以运行,但为什么不显示所有歌曲的信息呢?每次我运行脚本时,它都会在同一个位置停止。我有17 GB的音乐,也许这和音量有关?下面是该程序的源代码:如果每次都停止播放同一首歌曲,我建议将该歌曲从文件夹中删除,然后查看它是否能与其他音乐文件正确播放。如果不是的话,也许那一个文件有什么问题?不,它也是。我忘了说文件名可以包含西里尔文。由于事件处理程序是异步执行的,因此我无法确定跟踪输出中停止的程序不在一行中的文件。
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at P_1_fla::MainTimeline/ID3Tag()[P_1_fla.MainTimeline::frame1:29]
at P_1_fla::MainTimeline/directorySelected()[P_1_fla.MainTimeline::frame1:54]
at P_1_fla::MainTimeline/directorySelected()[P_1_fla.MainTimeline::frame1:50]
at Function/<anonymous>()[P_1_fla.MainTimeline::frame1:22]
ID3Tag("D:\\Music\\2013 Killswitch Engage - Disarm The Descent (Special Edition)\\01 The Hell In me.mp3");