教程前沿:这个适合制作喜欢制作大图的,如果喜欢可以面加一下音频的制作;
颜色自己在代码里面修改,颜色值和尺寸都在代码里面,自己慢慢看
这个我就不告诉了,自己慢慢研究啊,小妖期待你来网站发你的精彩
制作一个简单的插入到音画单图中的外部MP3格式音乐播放器制作,首先看下效果
本站发布教程代码为透明FLASH代码点击进入取得
1 步骤一打开FLASH软件,设置背景尺寸为300宽,高20,确定
2 进入场景,在场景一的第一帧处点击,右键打开动作面板,输入以下语句即 可:
代码如下:
注:以下代码去掉红色部分,输入你需要的MP3地址和文字就OK!
fscommand("fullscreen", false);
fscommand("allowscale", false);
fscommand("showmenu", false);
//加载外部声音
my_sound = new Sound();
my_sound.loadSound("
http://www.duliya.com/UploadFiles/User/229/201209/2012091514121821136.mp3", true);
my_sound.start();
//循环播放
my_sound.onSoundComplete = function() {
my_sound.start();
};
//创建音量底线
this.createEmptyMovieClip("xing_mc", 1);
with (xing_mc) {
beginFill(0xff0000);
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, 0xcc0000);
moveTo(0, 0);
lineTo(300, 0);
lineTo(300, 16);
lineTo(0, 14);
lineTo(0, 0);
}
//创建音量滑块并控制音量
this.createEmptyMovieClip("drag_mc", 3);
with (drag_mc) {
beginFill(0xFF00FF);
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);
with (play_mc) {
beginFill(0x33FF00);
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(0x00FF00);
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(0xFF0000);
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.5, 100, 20);
shijian_txt.textColor = 0xFF0000;
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;
}
var playedseconds:Number = my_sound.position/1000;
var minutesed:Number = Math.floor(playedseconds/60);
var secondsed = Math.floor(playedseconds)%60;
if (secondsed<10) {
secondsed = "0"+secondsed;
}
shijian_txt.text = minutesed+":"+secondsed+" 一 "+minutes+":"+seconds+"(怪自己.慢摇 MP3 )";
};
简单快捷,喜欢的朋友可以拿着使用,
注:如果觉得光代码做出来的这个播放器背景不好看的话.那么你在(图层一)加入一张背景图.宽-高设置为
300-17.
在建立(图层二)在(动作面版)里面输入下面的代码!分外妖娆网站期待你的精彩展示,