Flash课件制作片头的源码
//全屏且不缩放
fscommand("fullscreen", "true");
fscommand("allowscale", "true");
//右键设置
var my_cm = new ContextMenu();
my_cm.hideBuiltInItems();
zuozhe_cmi = new ContextMenuItem("沙河中学——张庆华", zuozhe);
wangzhi_cmi = new ContextMenuItem("电脑工作室", wangzhi, true);
youxiang_cmi = new ContextMenuItem("鸿雁传书", youxiang, true);
tuichu_cmi = new ContextMenuItem("退出", tuichu, true);
my_cm.customItems.push(zuozhe_cmi, wangzhi_cmi, youxiang_cmi, tuichu_cmi);
function zuozhe() {
}
function wangzhi() {
getURL("http://*******");
}
function youxiang() {
getURL("mailto:254904325@qq.com");
}
function tuichu() {
fscommand("quit", "true");
}
_root.menu = my_cm;
//时间
time_mc.mytime_txt._x = time_mc.shijiandt._x+(time_mc.shijiandt._width-time_mc.mytime_txt._width)/2;
time_mc.mytime_txt._y = time_mc.shijiandt._y+(time_mc.shijiandt._height-time_mc.mytime_txt._height)/2;
time_mc.onEnterFrame = function() {
my_date = new Date();
shi = my_date.getHours();
fen = my_date.getMinutes();
miao = my_date.getSeconds();
if (shi<10) {
shi = "0"+shi;
}
if (fen<10) {
fen = "0"+fen;
}
if (miao<10) {
miao = "0"+miao;
}
this.mytime_txt.text = shi+":"+fen+":"+miao;
};
//背景音乐
var my_sound:Sound = new Sound();
my_sound.loadSound("guzheng1.mp3", true);
my_sound.start();
my_sound.setVolume(100);
my_sound.onSoundComplete = function() {
my_sound.loadSound("guzheng1.mp3", true);
my_sound.start(0);
};
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = true;
pause_btn.enabled = true;
play_btn.onRelease = function() {
play_btn._visible = 0;
pause_btn._visible = 1;
if (pausetime) {
my_sound.start(pausetime);
} else {
my_sound.start(0);
}
};
pause_btn.onRelease = function() {
play_btn._visible = 1;
pause_btn._visible = 0;
my_sound.stop();
pausetime = my_sound.position/1000;
};
//关闭按钮
quit_btn.onRelease = function() {
fscommand("quit", "true");
};
//设置一些变量、载入的影片设置、初始化
wbyp_mc._y = 22;
var image_mcl:MovieClipLoader = new MovieClipLoader();
var n:Number = 0;
var _array:Array = new Array("xumu.swf", "langsong.swf", "diyiduan.swf", "dierduan.swf");
image_mcl.loadClip(_array[0], "wbyp_mc");
prev_btn.enabled = false;
first_btn.enabled = false;
for (var j:Number = 0; j<_array.length; j++) {
//前进按钮
next_btn.onPress = function() {
n++;
if (n>0) {
first_btn.enabled = true;
} else {
first_btn.enabled = false;
}
if (n<(_array.length-1)) {
last_btn.enabled = true;
} else {
last_btn.enabled = false;
}
prev_btn.enabled = true;
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = false;
pause_btn.enabled = false;
if (n == (_array.length-1)) {
n = _array.length-1;
this.enabled = false;
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = true;
pause_btn.enabled = true;
my_sound.loadSound("fenfeiyan.mp3", true);
my_sound.start();
} else {
this.enabled = true;
my_sound.stop();
}
image_mcl.loadClip(_array[n], "wbyp_mc");
};
//后退按钮
prev_btn.onPress = function() {
n--;
if (n>0) {
first_btn.enabled = true;
} else {
first_btn.enabled = false;
}
if (n<(_array.length-1)) {
last_btn.enabled = true;
} else {
last_btn.enabled = false;
}
next_btn.enabled = true;
if (n == 0) {
n = 0;
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = true;
pause_btn.enabled = true;
this.enabled = false;
my_sound.loadSound("guzheng1.mp3", true);
my_sound.start();
} else {
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = false;
pause_btn.enabled = false;
this.enabled = true;
my_sound.stop();
}
image_mcl.loadClip(_array[n], "wbyp_mc");
};
//跳转到最后按钮
last_btn.onPress = function() {
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = true;
pause_btn.enabled = true;
n = _array.length-1;
first_btn.enabled = true;
this.enabled = false;
next_btn.enabled = false;
prev_btn.enabled = true;
image_mcl.loadClip(_array[n], "wbyp_mc");
my_sound.loadSound("fenfeiyan.mp3", true);
my_sound.start();
};
//跳转到最前按钮
first_btn.onPress = function() {
play_btn._visible = 0;
pause_btn._visible = 1;
play_btn.enabled = true;
pause_btn.enabled = true;
n = 0;
last_btn.enabled = true;
this.enabled = false;
prev_btn.enabled = false;
next_btn.enabled = true;
image_mcl.loadClip(_array[n], "wbyp_mc");
my_sound.loadSound("guzheng1.mp3", true);
my_sound.start();
};
}
//帮助按钮和教案按钮
this.createEmptyMovieClip("bangzhujiaoan_mc", this.getNextHighestDepth());
var _mcl:MovieClipLoader = new MovieClipLoader();
help_btn.onRelease = function() {
_mcl.loadClip("bangzhu.swf", "bangzhujiaoan_mc");
};
jiaoan_btn.onRelease = function() {
_mcl.loadClip("jiaoan.swf", "bangzhujiaoan_mc");
};
//按钮文字说明
anniuwz_mc._visible = 0;
var anniu_array:Array = new Array("jiaoan_btn", "quit_btn", "help_btn", "play_btn", "pause_btn", "first_btn", "last_btn", "prev_btn", "next_btn");
var ansm_array:Array = new Array("教案", "关闭", "帮助", "播放", "暂停", "最前", "最后", "后退", "前进");
for (var p:Number = 0; p<anniu_array.length; p++) {
this[anniu_array[p]].ID = p;
this[anniu_array[p]].onRollOver = function() {
anniuwz_mc._visible = 1;
anniuwz_mc.anniuwz_txt.text = ansm_array[this.ID];
anniuwz_mc._x = this._x;
anniuwz_mc._y = this._y;
};
this[anniu_array[p]].onRollOut = function() {
anniuwz_mc._visible = 0;
};
}