Import control of a movie

Source: Internet
Author: User
Tags setinterval
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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.