首页 > 代码库 > 课间操定时播音源代码

课间操定时播音源代码

var array:Array = new Array(9, 11, 0, 9, 13, 36);
var array1:Array = new Array(9, 11, 0, 9, 16, 0);
var time:Date = new Date();
taday = time.getDay();
if (taday == 1) {
 for (i=1; i<=6; i++) {
  if (Number(array1[i-1])<10) {
   _root["T"+i] = "0"+array1[i-1];
  } else {
   _root["T"+i] = array1[i-1];
  }
 }
 A = "运动员进行曲:";
 B = "共和国国歌:";
} else {
 for (i=1; i<=6; i++) {
  if (Number(array[i-1])<10) {
   _root["T"+i] = "0"+array[i-1];
  } else {
   _root["T"+i] = array[i-1];
  }
 }
 A = "运动员进行曲:";
 B = "旭日东升:";
}
if (time.getHours() == T4 && time.getMinutes()>T5 && time.getSeconds()>T6) {
 T = "已超时!不能播放文件!";
} else {
 T = "有文件等待播放,请勿关闭!谢谢!";
}
var Paopao:MovieClip = _root.createEmptyMovieClip("paopao", _root.getNextHighestDepth());
Paopao.onEnterFrame = function() {
 if (random(2) == 0) {
  shuipao = Paopao.attachMovie("qipao", "qipao", Paopao.getNextHighestDepth());
  shuipao._x = random(350);
  shuipao._y = 80;
  shuipao._alpha = random(80);
  shudu = random(2)+1;
  shuipao._xscale = shuipao._yscale=random(80);
  shuipao.onEnterFrame = function() {
   this._y -= shudu;
   if (this._y<=0) {
    this.removeMovieClip();
   }
   updateAfterEvent();
  };
 }
};
function shijian() {
 var time:Date = new Date();
 taday = time.getDay();
 if (time.getHours()<10) {
  shi = "0"+time.getHours();
 } else {
  shi = time.getHours();
 }
 if (time.getMinutes()<10) {
  fen = "0"+time.getMinutes();
 } else {
  fen = time.getMinutes();
 }
 if (time.getSeconds()<10) {
  miao = "0"+time.getSeconds();
 } else {
  miao = time.getSeconds();
 }
 Ts = shi+":"+fen+":"+miao;
 if (taday == 1) {
  if (T1 == time.getHours() && T2 == time.getMinutes() && T3 == time.getSeconds()) {
   var sound:Sound = new Sound();
   sound.attachSound("运动员进行曲");
   sound.start();
   T = "正在播放:"+"运动员进行曲.mp3";
   sound.onSoundComplete = function() {
    T = "还有文件等待播放,请勿关闭!谢谢!";
   };
  }
  if (T4 == time.getHours() && T5 == time.getMinutes() && T6 == time.getSeconds()) {
   var sound1:Sound = new Sound();
   sound1.attachSound("国歌");
   sound1.start();
   T = "正在播放:"+"国歌.mp3";
   sound1.onSoundComplete = function() {
    T = "文件播放结束,可以关闭!";
   };
  }
 } else {
  if (T1 == time.getHours() && T2 == time.getMinutes() && T3 == time.getSeconds()) {
   var sound:Sound = new Sound();
   sound.attachSound("运动员进行曲");
   sound.start();
   T = "正在播放:"+"运动员进行曲.mp3";
   sound.onSoundComplete = function() {
    T = "还有文件等待播放,请勿关闭!谢谢!";
   };
  }
  if (T4 == time.getHours() && T5 == time.getMinutes() && T6 == time.getSeconds()) {
   var sound1:Sound = new Sound();
   sound1.attachSound("旭日东升");
   sound1.start();
   T = "正在播放:"+"旭日东升.mp3";
   sound1.onSoundComplete = function() {
    T = "文件播放结束,可以关闭!";
   };
  }
 }
}
setInterval(shijian, 1000);

本文出自 “朗音小屋” 博客,请务必保留此出处http://9353742.blog.51cto.com/9343742/1571839

课间操定时播音源代码