Import control of a movie
Last Update:2017-02-28
Source: Internet
Author: User
Control 1, prohibit import movie, write on the first frame
_root._name = "NN";
This.onenterframe = function () {
if (this._name!= "nn" | | _root.getdepth ()!=-16384) {
This.unloadmovie ();
}
};
2, can only import, can not play directly
_root.onload = function () {
if (This._level = = _level0 | | _parent = = undefined) {
Loadmovienum ("", 0);
}
};
3, import finished, control movie properties, set import movie Clip MC
_root.onenterframe=function () {
if (mc._width!=0) {
The properties set
}
}
4, so that the imported pictures in a certain size
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, import the movie Infinite Loop play
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, the fast forward of the movie
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, import mp3 of the light, fade out
File://soundin
function Soundin () {
Sound1 = SetInterval (Soundcontrol, true);
}
File://soundout
var yy
function SoundOut () {
Yy=1
Sound1 = SetInterval (Soundcontrol, 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 () = && GG = = True && yy = = 0) {
Clearinterval (SOUND1);
}
}
8, Random Import
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);