我终于用纯AS做了个简单MP3播放器,请大家指点!
效果见我的网页中
http://qzgzs.51.net/flash/ASmp3player.html下面没有嵌入网页中,所以不能正常播放。
把下面的代码复制到第一帧即可:
fscommand("fullscreen", false);
fscommand("allowscale", false);
fscommand("showmenu", false);
//加载外部声音
my_sound = new Sound();
my_sound.loadSound("http://bbs.wybstv.com.cn/v/春暖花开.mp3", true);
my_sound.start();
//循环播放
my_sound.onSoundComplete = function() {
my_sound.start();
};
//创建音量底线
this.createEmptyMovieClip("xing_mc", 1);
with (xing_mc) {
beginFill(0x009900);
moveTo(46, 11);
lineTo(100, 11);
lineTo(100, 12);
lineTo(46, 12);
lineTo(46, 11);
endFill();
}
//创建背景方框
this.createEmptyMovieClip("fangkang_mc", 2);
with (fangkang_mc) {
lineStyle(1, 0x008800);
moveTo(0, 0);
lineTo(260, 0);
lineTo(260, 14);
lineTo(0, 14);
lineTo(0, 0);
}
//创建音量滑块并控制音量
this.createEmptyMovieClip("drag_mc", 3);
with (drag_mc) {
beginFill(0x008800);
moveTo(46, 3);
lineTo(50, 3);
lineTo(50, 12);
lineTo(46, 12);
lineTo(46, 3);
endFill();
}
left = drag_mc._x;
right = left+50;
top = drag_mc._y;
bottom = drag_mc._y;
drag_mc._x = my_sound.getVolume();
drag_mc._x = 50;
drag_mc.onPress = function() {
this.startDrag(false, left, top, right, bottom);
};
drag_mc.onRelease = drag_mc.onReleaseOutside=function () {
stopDrag();
my_sound.setVolume((this._x)*2);
};
//按钮的可见性
pause_mc._visible = 1;
play_mc._visible = 0;
//创建播放按钮
this.createEmptyMovieClip("play_mc", 4);
上一篇:
带镣铐的舞者:从两方面看AJAX与B/S
下一篇:
安装Vista如何避免联机激活与自选分区