关于从txt中载入数组的方法

Posted on April 24, 2005 by Fdream

这是前一段时间研究 mp3 player的时候发现的:

外部文本(music.txt)中的内容:

mp3/五月的雪.mp3,mp3/七里香.mp3,mp3/五月的雪.mp3,mp3/东风破.mp3,mp3/五月的雪.mp3,mp3/烛光.mp3,mp3/今天.mp3,mp3/冲动的惩罚.mp3,mp3/海浪.mp3,mp3/大约在冬季.mp3,mp3/下沙.mp3,mp3/老鼠爱大米.mp3,mp3/练习.mp3,mp3/十年.mp3,mp3/天意.mp3,mp3/童话.mp3,mp3/想和你去吹吹风.mp3,mp3/小薇.mp3,mp3/一生有你.mp3,mp3/再见了最爱的人.mp3

AS脚本:

_root.createEmptyMovieClip(“loader”, 0);
loadVariables(“music.txt”, _root.loader);
songList = [];
_root.loader.onData = function() {
for (var fdevery in this) {
if (!(typeof (this[fdevery]) == “function”)) {
_root.songList = fdevery.split(“,”);
}
}
};
trace(_root.r.length);
for (var i=0;i<=_root.r.length-1;i++){
trace(_root.r[i]);
}
};

分享 |
Categories:
Flash/AS
Tags:
, ,
Comments:
Leave a comment
Views:
2,185 Views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>