|
Flash教程:纯AS制作简单的MP3播放器(2) play_mc._visible = 0; //创建播放按钮 this.createEmptyMovieClip("play_mc", 4); with (play_mc) { beginFill(0x008800); moveTo(5, 3); lineTo(14, 7.5); lineTo(5, 12); lineTo(5, 3); endFill(); } play_mc.onRelease = function() { my_sound.start(time); this._visible = 0; pause_mc._visible = 1; }; //创建停止按钮 this.createEmptyMovieClip("stop_mc", 5); with (stop_mc) { beginFill(0x008800); moveTo(25, 3); lineTo(34, 3); lineTo(34, 12); lineTo(25, 12); lineTo(25, 3); endFill(); } stop_mc.onRelease = function() { my_sound.stop(); pause_mc._visible = 0; play_mc._visible = 1; time=0 }; //创建暂停按钮 this.createEmptyMovieClip("pause_mc", 6); with (pause_mc) { beginFill(0x008800); moveTo(5, 3); lineTo(14, 3); lineTo(14, 12); lineTo(5, 12); lineTo(5, 3); endFill(); beginFill(0xFFFFFF); moveTo(8, 3); lineTo(11, 3); lineTo(11, 12); lineTo(8, 12); lineTo(8, 3); endFill(); } pause_mc.onRelease = function() { this._visible = 0; play_mc._visible = 1; my_sound.stop(); time = my_sound.position/1000; }; //创建进度显示文本 this.createTextField("shijian_txt", 7, 112, -2, 100, 20); shijian_txt.textColor = 0x009900; shijian_txt.autoSize = true; onEnterFrame = function () { var totalseconds:Number = my_sound.duration/1000; var minutes:Number = Math.floor(totalseconds/60); var seconds = Math.floor(totalseconds)%60; if (seconds<10) { seconds = "0"+seconds; }
|