教你制作学校广播室自动播音系统(无声版)
作者:莫庄主 类型:原创 来源:闪吧
先看看程序运行的界面:
效果:
下面讲讲大致的制作过程:
一、显示系统时间:
1、将图层1改名为bg,放置自己喜爱的图片作为背景。我用三个背景图层放置了不同的背景图形。(源文件中都是以bg命名,有些懒,习惯不太好啊。)
2、新建图层“当前时间”,用文本工具拖出三个文框:从左到右第一个框属性为静态文本,输入“当前时间”,第二个框为属性为动态文本(在属性面板中将它的实例名称改为systemtime,这里将动态地显示系统的当前时间),第三个框也是动态文本(实例名称改为xingqi,这里将显示当天是星期几)。
二、制作每天作息时间表格:
1、新建图层“星期标签”,在第1帧上用线段画出表格,将用静态文本在每个表格中输入星期一每节课的起止时间。在第3帧上输入星期二的作息时间,第4帧输入星期三的……第8帧输入星期天的。
2、上一步输入中,要注意最上面的“星期*”的标签,当天的星期标签应该用红色,并处于排列在最上层。
3、新建图层“星期按钮”,制作一个透明按钮附在上一步的“星期*”标签上,这样,在程序运行时可以点击该标签查看某天的具体作息时间。“星期一”透明按钮的代码如下(其它与此类似):
三、制作歌曲面板(界面2):
1、制作触发按钮。本歌曲面板初始时是隐蔽的,要通过一个按钮来弹出(在界面2中右侧的红色圆圈处)。此按钮上的代码如下:
1、新建图层“as”。
2、第1帧代码:
要注意的几项:
1、最后生成的swf文件要与所有调用的mp3歌曲放在同一目录下。
2、外部mp3文件包括:
(1)s0.mp3
s1.mp3
……
s9.mp3:共10首歌,为课间播放的校园歌曲;
(2)chuyingling.mp3
第二套小学生广播体操《雏鹰起飞》(口令版)
(3)chuyingyue.mp3
第二套小学生广播体操《雏鹰起飞》(音乐版)
(4)duigechang.mp3
中国少年先锋队队歌(演唱版)
(5)guangbocao.mp3
第二套中学生广播体操《时代在召唤》(口令版)
(6)guogechang.mp3
国歌(合唱)
(7)guogequ.mp3
国歌(演奏)
(8)huansong.mp3
欢送进行曲
(9)huanying.mp3
欢迎进行曲
(10)qichuang.mp3
起床铃声
(11)shangke.mp3
上课铃声
(12)xiake.mp3
下课铃声
(13)xiuxi.mp3
午休和晚上就寝铃声
(14)yanbaocao.mp3
眼保健操
(15)yundongqu.mp3
运动员进行曲
(16)zuguochang.mp3
歌唱祖国(合唱)
对以上mp3音乐文件,可以换掉,但mp3的文件名不能改(否则程序调用就会出错)。
好了,大致就是这些了。希望对各位网友有用。
源文件:
定时播音系统(无声版).rar
效果:
下面讲讲大致的制作过程:
一、显示系统时间:
1、将图层1改名为bg,放置自己喜爱的图片作为背景。我用三个背景图层放置了不同的背景图形。(源文件中都是以bg命名,有些懒,习惯不太好啊。)
2、新建图层“当前时间”,用文本工具拖出三个文框:从左到右第一个框属性为静态文本,输入“当前时间”,第二个框为属性为动态文本(在属性面板中将它的实例名称改为systemtime,这里将动态地显示系统的当前时间),第三个框也是动态文本(实例名称改为xingqi,这里将显示当天是星期几)。
二、制作每天作息时间表格:
1、新建图层“星期标签”,在第1帧上用线段画出表格,将用静态文本在每个表格中输入星期一每节课的起止时间。在第3帧上输入星期二的作息时间,第4帧输入星期三的……第8帧输入星期天的。
2、上一步输入中,要注意最上面的“星期*”的标签,当天的星期标签应该用红色,并处于排列在最上层。
3、新建图层“星期按钮”,制作一个透明按钮附在上一步的“星期*”标签上,这样,在程序运行时可以点击该标签查看某天的具体作息时间。“星期一”透明按钮的代码如下(其它与此类似):
on (release) {
gotoAndPlay("周一");
}
4、新建图层“星期几”,将第2帧命名为“周一”,第3帧命名为“周二”……,第8帧命名为“周日”,以备后面的程序调用。gotoAndPlay("周一");
}
三、制作歌曲面板(界面2):
1、制作触发按钮。本歌曲面板初始时是隐蔽的,要通过一个按钮来弹出(在界面2中右侧的红色圆圈处)。此按钮上的代码如下:
on (release) {
gequmianban.gotoAndPlay(2);
}
2、按Ctrl+F8(或“插入” “新建元件”),命名“歌曲面板”,属性为电影剪辑,实例名称为“gequmianban”。第1帧为空白关键帧,在第2帧中,从“公用库” →“按钮”中拖入几个按钮布局好,第3帧为空白关键帧。第2帧“国歌”按钮的代码如下(其它歌曲按钮的代码类似):gequmianban.gotoAndPlay(2);
}
on (release) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("guogequ.mp3", false);
mySound.start();
}
3、将第1步中的触发按钮水平翻转,以单击后关闭歌曲面板。此按钮的代码改为: stopAllSounds();
mySound = new Sound();
mySound.loadSound("guogequ.mp3", false);
mySound.start();
}
on (release) {
nextFrame();
}
四、编写AS:nextFrame();
}
1、新建图层“as”。
2、第1帧代码:
stop();
setInterval(looptime,1000);
function looptime(){
systime=new Date();
hour=systime.getHours();
minute=systime.getMinutes();
second=systime.getSeconds();
//如果时分秒是个位数,就为时分秒补位.
if (hour<10){
shi="0"+hour;
}else{
shi=hour;
}
if (minute<10){
fen="0"+minute;
}else{
fen=minute;
}
if (second<10){
miao="0"+second;
}else{
miao=second;
}
systemtime.text=shi+":"+fen+":"+miao;
//把数字月份换为中文显示,并且判断星期值,根据结果跳到指定的星期几的帧.
today=systime.getDay();
if (today==1) {
xingqi.text="星期一";
gotoAndStop("周一");
}
if (today==2) {
xingqi.text="星期二";
gotoAndStop("周二");
}
if (today==3) {
xingqi.text="星期三";
gotoAndStop("周三");
}
if (today==4) {
xingqi.text="星期四";
gotoAndStop("周四");
}
if (today==5) {
xingqi.text="星期五";
gotoAndStop("周五");
}
if (today==6) {
xingqi.text="星期六";
gotoAndStop("周六");
}
if (today==0) {
xingqi.text="星期日";
gotoAndStop("周日");
}
}
3、
第2帧代码:
stop();
setInterval(looptime1, 500);
function looptime1() {
systime1 = new Date();
hour1 = systime1.getHours();
minute1 = systime1.getMinutes();
second1 = systime1.getSeconds();
//开始定时打铃.
if ((hour1 == 6) && (minute1 == 30) && (second1 == 0)) {
//当时间是6:30:0时开始播放起床铃声。
stopAllSounds();
//停止所有声音。
mySound = new Sound();
//新建一个声音。
mySound.loadSound("qichuang.mp3", false);
//加载外部的mp3铃声文件。
mySound.start();
//播放铃声。
}
//以下调用外部音乐。
if ((hour1 == 6) && (minute1 == 30) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
}
}
//停止所有音乐。
if ((hour1 == 6) && (minute1 == 49) && (second1 == 0)) {
stopAllSounds();
}
//早自习上课时间。
if ((hour1 == 6) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//早自习下课时间。
if ((hour1 == 7) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//以下调用外部音乐。
if ((hour1 == 7) && (minute1 == 30) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//停止所有音乐。
if ((hour1 == 7) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
}
//晨会上课时间。
if ((hour1 == 8) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晨会下课、第一节课上课时间。
if ((hour1 == 8) && (minute1 == 10) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第一节课下课时间。
if ((hour1 == 8) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第二节课上课时间。
if ((hour1 == 9) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第二节课下课时间。
if ((hour1 == 9) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//全校升旗时间,只播放进行曲,升旗曲、国歌等由人视当时情况进行控制。
if ((hour1 == 9) && (minute1 == 50) && (second1 == 30)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("yundongqu.mp3", false);
mySound.start();
}
//第三节上课时间。
if ((hour1 == 10) && (minute1 == 10) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第三节下课时间。
if ((hour1 == 10) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第四节上课时间。
if ((hour1 == 11) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第四节下课时间。
if ((hour1 == 11) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//播放音乐。
if ((hour1 == 11) && (minute1 == 50) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//午休时间铃声。
if ((hour1 == 12) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiuxi.mp3", false);
mySound.start();
}
//午休起床时间。
if ((hour1 == 14) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("qichuang.mp3", false);
mySound.start();
}
//播放音乐.
if ((hour1 == 14) && (minute1 == 0) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//第五节进班时间。
if ((hour1 == 14) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第五节上课时间。
if ((hour1 == 14) && (minute1 == 25) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第五节下课时间。
if ((hour1 == 15) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第六节上课时间。
if ((hour1 == 15) && (minute1 == 15) && (second == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第六节下课时间。
if ((hour1 == 15) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第七节上课时间。
if ((hour1 == 16) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第七节下课时间。
if ((hour1 == 16) && (minute1 == 45) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第八节上课时间。
if ((hour1 == 16) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第八节下课时间。
if ((hour1 == 17) && (minute1 == 35) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//播放音乐。
if ((hour1 == 17) && (minute1 == 35) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//停止播放音乐.
if ((hour1 == 18) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
}
//晚自习收看《新闻联播》时间。
if ((hour1 == 19) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第一节上课时间。
if ((hour1 == 19) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第一节下课时间。
if ((hour1 == 20) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//晚自习第二节上课时间。
if ((hour1 == 20) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第二节下课时间。
if ((hour1 == 21) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//晚自习第三节上课时间。
if ((hour1 == 21) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第三节下课时间。
if ((hour1 == 22) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//就寝铃声。
if ((hour1 == 22) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiuxi.mp3", false);
mySound.start();
}
}
3、第3帧到第8帧的代码与第2帧的类似。setInterval(looptime,1000);
function looptime(){
systime=new Date();
hour=systime.getHours();
minute=systime.getMinutes();
second=systime.getSeconds();
//如果时分秒是个位数,就为时分秒补位.
if (hour<10){
shi="0"+hour;
}else{
shi=hour;
}
if (minute<10){
fen="0"+minute;
}else{
fen=minute;
}
if (second<10){
miao="0"+second;
}else{
miao=second;
}
systemtime.text=shi+":"+fen+":"+miao;
//把数字月份换为中文显示,并且判断星期值,根据结果跳到指定的星期几的帧.
today=systime.getDay();
if (today==1) {
xingqi.text="星期一";
gotoAndStop("周一");
}
if (today==2) {
xingqi.text="星期二";
gotoAndStop("周二");
}
if (today==3) {
xingqi.text="星期三";
gotoAndStop("周三");
}
if (today==4) {
xingqi.text="星期四";
gotoAndStop("周四");
}
if (today==5) {
xingqi.text="星期五";
gotoAndStop("周五");
}
if (today==6) {
xingqi.text="星期六";
gotoAndStop("周六");
}
if (today==0) {
xingqi.text="星期日";
gotoAndStop("周日");
}
}
3、
第2帧代码:
stop();
setInterval(looptime1, 500);
function looptime1() {
systime1 = new Date();
hour1 = systime1.getHours();
minute1 = systime1.getMinutes();
second1 = systime1.getSeconds();
//开始定时打铃.
if ((hour1 == 6) && (minute1 == 30) && (second1 == 0)) {
//当时间是6:30:0时开始播放起床铃声。
stopAllSounds();
//停止所有声音。
mySound = new Sound();
//新建一个声音。
mySound.loadSound("qichuang.mp3", false);
//加载外部的mp3铃声文件。
mySound.start();
//播放铃声。
}
//以下调用外部音乐。
if ((hour1 == 6) && (minute1 == 30) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
}
}
//停止所有音乐。
if ((hour1 == 6) && (minute1 == 49) && (second1 == 0)) {
stopAllSounds();
}
//早自习上课时间。
if ((hour1 == 6) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//早自习下课时间。
if ((hour1 == 7) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//以下调用外部音乐。
if ((hour1 == 7) && (minute1 == 30) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//停止所有音乐。
if ((hour1 == 7) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
}
//晨会上课时间。
if ((hour1 == 8) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晨会下课、第一节课上课时间。
if ((hour1 == 8) && (minute1 == 10) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第一节课下课时间。
if ((hour1 == 8) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第二节课上课时间。
if ((hour1 == 9) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第二节课下课时间。
if ((hour1 == 9) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//全校升旗时间,只播放进行曲,升旗曲、国歌等由人视当时情况进行控制。
if ((hour1 == 9) && (minute1 == 50) && (second1 == 30)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("yundongqu.mp3", false);
mySound.start();
}
//第三节上课时间。
if ((hour1 == 10) && (minute1 == 10) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第三节下课时间。
if ((hour1 == 10) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第四节上课时间。
if ((hour1 == 11) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第四节下课时间。
if ((hour1 == 11) && (minute1 == 50) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//播放音乐。
if ((hour1 == 11) && (minute1 == 50) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//午休时间铃声。
if ((hour1 == 12) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiuxi.mp3", false);
mySound.start();
}
//午休起床时间。
if ((hour1 == 14) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("qichuang.mp3", false);
mySound.start();
}
//播放音乐.
if ((hour1 == 14) && (minute1 == 0) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//第五节进班时间。
if ((hour1 == 14) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第五节上课时间。
if ((hour1 == 14) && (minute1 == 25) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第五节下课时间。
if ((hour1 == 15) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第六节上课时间。
if ((hour1 == 15) && (minute1 == 15) && (second == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第六节下课时间。
if ((hour1 == 15) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第七节上课时间。
if ((hour1 == 16) && (minute1 == 5) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第七节下课时间。
if ((hour1 == 16) && (minute1 == 45) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//第八节上课时间。
if ((hour1 == 16) && (minute1 == 55) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//第八节下课时间。
if ((hour1 == 17) && (minute1 == 35) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//播放音乐。
if ((hour1 == 17) && (minute1 == 35) && (second1 == 30)) {
stopAllSounds();
var ms = 1;
//控制加载的歌曲
ms = Math.round(Math.random()*10)+1;
//实现随机选曲的代码.
mySound = new Sound();
mySound.loadSound("s"+ms+".mp3", true);
mySound.start();
mySound.onSoundComplete = function() {
//onSoundComplete当一首歌曲播完后就会执行
//这样也就实现循环了。
if (ms != 10) {
ms += 1;
} else {
ms = 1;
}
mySound.loadSound("s"+ms+".mp3", true);
mySound.start(0, 1);
};
}
//停止播放音乐.
if ((hour1 == 18) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
}
//晚自习收看《新闻联播》时间。
if ((hour1 == 19) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第一节上课时间。
if ((hour1 == 19) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第一节下课时间。
if ((hour1 == 20) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//晚自习第二节上课时间。
if ((hour1 == 20) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第二节下课时间。
if ((hour1 == 21) && (minute1 == 20) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//晚自习第三节上课时间。
if ((hour1 == 21) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("shangke.mp3", false);
mySound.start();
}
//晚自习第三节下课时间。
if ((hour1 == 22) && (minute1 == 0) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiake.mp3", false);
mySound.start();
}
//就寝铃声。
if ((hour1 == 22) && (minute1 == 30) && (second1 == 0)) {
stopAllSounds();
mySound = new Sound();
mySound.loadSound("xiuxi.mp3", false);
mySound.start();
}
}
要注意的几项:
1、最后生成的swf文件要与所有调用的mp3歌曲放在同一目录下。
2、外部mp3文件包括:
(1)s0.mp3
s1.mp3
……
s9.mp3:共10首歌,为课间播放的校园歌曲;
(2)chuyingling.mp3
第二套小学生广播体操《雏鹰起飞》(口令版)
(3)chuyingyue.mp3
第二套小学生广播体操《雏鹰起飞》(音乐版)
(4)duigechang.mp3
中国少年先锋队队歌(演唱版)
(5)guangbocao.mp3
第二套中学生广播体操《时代在召唤》(口令版)
(6)guogechang.mp3
国歌(合唱)
(7)guogequ.mp3
国歌(演奏)
(8)huansong.mp3
欢送进行曲
(9)huanying.mp3
欢迎进行曲
(10)qichuang.mp3
起床铃声
(11)shangke.mp3
上课铃声
(12)xiake.mp3
下课铃声
(13)xiuxi.mp3
午休和晚上就寝铃声
(14)yanbaocao.mp3
眼保健操
(15)yundongqu.mp3
运动员进行曲
(16)zuguochang.mp3
歌唱祖国(合唱)
对以上mp3音乐文件,可以换掉,但mp3的文件名不能改(否则程序调用就会出错)。
好了,大致就是这些了。希望对各位网友有用。
源文件:
定时播音系统(无声版).rar
责任编辑:silvia 时间:2008年11月12日
- 上一篇:
- 游戏中配对效果如何实现?
- 没有相关教材
- 最近更新
