导入电影的控制-Flash-网页制作
2008-05-20 04:06
295 查看
1,禁止导入电影,写在第一桢上
_root._name = "nn";
this.onEnterFrame = function() {
if (this._name != "nn" || _root.getDepth() != -16384) {
this.unloadMovie();
}
};
2,只能导入,不能直接播放
_root.onLoad = function() {
if (this._level == _level0 || _parent == undefined) {
loadMovieNum("", 0);
}
};
3,导入完毕,控制电影属性,设导入电影剪辑mc中
_root.onEnterframe=function(){
if(mc._width!=0){
所设属性
}
}
4,使导入的图片在一定大小
onClipEvent (load) {
this._width=288;
this._height=209;
if(this._width>288 || this._height>209){
scalew=this._width/288;
scaleh=this._height/209;
if (scalew>scaleh){
this._height=288/this._width*this._height;
this._width=288;
}else{
this._width=209/this._height*this._width;
this._height=209;
}
}
5,导入的电影无限循环播放
var jilu
function xh() {
if (mc._width != 0) {
if (mc._currentframe == jilu) {
_root.mc.gotoAndPlay(mc._currentframe 1);
}
jilu = mc._currentframe;
}
if (mc._currentframe>=mc._totalframes) {
mc.gotoAndPlay(1);
}
}
on (press) {
setInterval(_root.xh, 1000/12);
}
6,电影 的快进
var nn
function kuai() {
if (mc._width != 0 && mc._currentframe<mc._totalframes) {
nn = Math.floor(mc._totalframes/200);
mc.gotoAndStop(mc._currentframe nn);
if ((mc._totalframes-mc._currentframe)<nn) {
mc.gotoAndStop(mc._totalframes);
}
}
}
on (press) {
setInterval(_root.kuai, 1000/12);
}
7,导入mp3的淡隐,淡出
file://soundin
function soundin() {
sound1 = setInterval(soundcontrol, 30, true);
}
file://soundout
var yy
function soundout() {
yy=1
sound1 = setInterval(soundcontrol, 30, false);
}
file://soundcontrol
var sounding
function soundcontrol(gg) {
if (mysound.getVolume()>0 && gg == false && yy == 1) {
mysound.setVolume((mysound.getVolume()-1));
} else if (mysound.getVolume()<=0 && gg == false && yy == 1) {
sounding = mysound.position;
mysound.stop();
clearInterval(sound1);
}
}
if (mysound.getVolume()<100 && gg == true && yy == 0) {
mysound.setVolume((mysound.getVolume() 1));
} else if (mysound.getVolume() == 100 && gg == true && yy == 0) {
clearInterval(sound1);
}
}
8,随机导入
Array.prototype.get = function() {
var h1 = this.slice(0, -1);
var i1 = random(h1.length);
var xx = h1[i1];
this.splice(i1, 1);
this.push(xx);
return xx;
};
hh = ["mc1.swf", "mc2.swf", "mc3.swf", "mc4.swf", "mc5.swf", "mc6.swf"];
mymc = hh.get();
loadMovieNum(mymc, 1);
_root._name = "nn";
this.onEnterFrame = function() {
if (this._name != "nn" || _root.getDepth() != -16384) {
this.unloadMovie();
}
};
2,只能导入,不能直接播放
_root.onLoad = function() {
if (this._level == _level0 || _parent == undefined) {
loadMovieNum("", 0);
}
};
3,导入完毕,控制电影属性,设导入电影剪辑mc中
_root.onEnterframe=function(){
if(mc._width!=0){
所设属性
}
}
4,使导入的图片在一定大小
onClipEvent (load) {
this._width=288;
this._height=209;
if(this._width>288 || this._height>209){
scalew=this._width/288;
scaleh=this._height/209;
if (scalew>scaleh){
this._height=288/this._width*this._height;
this._width=288;
}else{
this._width=209/this._height*this._width;
this._height=209;
}
}
5,导入的电影无限循环播放
var jilu
function xh() {
if (mc._width != 0) {
if (mc._currentframe == jilu) {
_root.mc.gotoAndPlay(mc._currentframe 1);
}
jilu = mc._currentframe;
}
if (mc._currentframe>=mc._totalframes) {
mc.gotoAndPlay(1);
}
}
on (press) {
setInterval(_root.xh, 1000/12);
}
6,电影 的快进
var nn
function kuai() {
if (mc._width != 0 && mc._currentframe<mc._totalframes) {
nn = Math.floor(mc._totalframes/200);
mc.gotoAndStop(mc._currentframe nn);
if ((mc._totalframes-mc._currentframe)<nn) {
mc.gotoAndStop(mc._totalframes);
}
}
}
on (press) {
setInterval(_root.kuai, 1000/12);
}
7,导入mp3的淡隐,淡出
file://soundin
function soundin() {
sound1 = setInterval(soundcontrol, 30, true);
}
file://soundout
var yy
function soundout() {
yy=1
sound1 = setInterval(soundcontrol, 30, false);
}
file://soundcontrol
var sounding
function soundcontrol(gg) {
if (mysound.getVolume()>0 && gg == false && yy == 1) {
mysound.setVolume((mysound.getVolume()-1));
} else if (mysound.getVolume()<=0 && gg == false && yy == 1) {
sounding = mysound.position;
mysound.stop();
clearInterval(sound1);
}
}
if (mysound.getVolume()<100 && gg == true && yy == 0) {
mysound.setVolume((mysound.getVolume() 1));
} else if (mysound.getVolume() == 100 && gg == true && yy == 0) {
clearInterval(sound1);
}
}
8,随机导入
Array.prototype.get = function() {
var h1 = this.slice(0, -1);
var i1 = random(h1.length);
var xx = h1[i1];
this.splice(i1, 1);
this.push(xx);
return xx;
};
hh = ["mc1.swf", "mc2.swf", "mc3.swf", "mc4.swf", "mc5.swf", "mc6.swf"];
mymc = hh.get();
loadMovieNum(mymc, 1);
相关文章推荐
- 导入电影的控制-Flash-网页制作
- 控制影片剪辑【基础】-实例教学-Flash-网页制作
- 电影剪辑属性详解-Flash-网页制作
- 控制影片剪辑【基础】-实例教学-Flash-网页制作
- 电影剪辑属性详解-Flash-网页制作
- [导入]学习网页制作: 用CSS来控制网页背景
- 【荐】来自搜狐图片频道JS+flash控制可上下翻页的焦点图代码_网页代码站(www.webdm.cn)
- 网页制作中控制表格边框的显示
- 『网页制作小技巧』定制调用 Flash 函数
- 如何让Flash不遮挡HTML div元素的技巧_HTML/Xhtml_网页制作
- 网页制作中应用CSS控制文本的主要指令
- 旋转的花朵-实例教学-Flash-网页制作
- 遮罩的妙用-Flash-网页制作
- 制作网页数据图表/曲线图【flash版本】
- 网页制作中常用的基础知识001-将Flash文件的背景设置为透明
- flash上制作一个按钮,控制动画播放、暂停
- 运动的矩形-实例教学-Flash-网页制作
- 求“FLASH制作网页动画片的实现”相关资料
- Flash制作可供C#控制的进度条
- 如何让Flash不遮挡HTML div元素的技巧_HTML/Xhtml_网页制作