Flash production of good-looking picture effect animation

Source: Internet
Author: User
Picture effects

See Effect:

The code is as follows:

var old:number = 1;
Record the picture displayed on the previous sheet
var Oldgo:boolean;
var oldpos:number = 700;
var picnum:number = 9;
Anlipath is the path used to load an external picture
var anlipath:string = "works/1-";
For (I=1 i<=picnum; i++) {
Btn_mc.attachmovie ("btn", "btn" +i, i);
btn_mc["btn" +i]._y = 28* (i-1);
btn_mc["btn" +i]._x = 10;
btn_mc["BTN" +i].no = i;
btn_mc["BTN" +i].page.text = i;
btn_mc["BTN" +i].btn.usehandcursor = false;
btn_mc["btn" +i].btn.onrelease = function () {
Oldpos = oldpos* (-1);
Motion (oldpos, old);
Motion (0, this._parent.no);
Old = this._parent.no;
};
This.pic.createEmptyMovieClip ("MC" +i, Picnum-i);
This.pic["mc" +i].no = i-1;
if (i = = 1) {
This.pic["mc" +i]._x = 0;
} else {
This.pic["MC" +i]._x =-500;
}
Attachmovie the internal picture code ****************
This.pic["MC" +i].attachmovie ("M" +i, "M" +i, 100-i);
Code to load an external picture *******************
Settings for picture load progress bar
//
Myloader = new Moviecliploader ();
MyListener = new Object ();
mylistener.onloadprogress = function (LOADTARGETMC, loadedbytes, totalbytes) {
AA = (loadedbytes/totalbytes) *100;
Txt.text = "Already Loaded:" +int (aa) + "%";
//};
Mylistener.onloadstart = function (LOADTARGETMC) {
Txt._visible = true;
This.pic["MC" +i].stop ();
//};
Mylistener.onloadcomplete = function (LOADTARGETMC) {
This.pic["MC" +i].play ();
Txt._visible = false;
if (i = = 1) {
Motion (1200, 1);
//}
//};
Myloader.addlistener (MyListener);
Myloader.loadclip (anlipath+i+ ". gif", this.pic["MC" +i]);
Code completion for loading external pictures **************
}
Function Motion (Targetx:number, No:number) {
Pic["MC" +no].onenterframe = function () {
This._x + = (targetx-this._x) *0.3;
if (Math.Abs (targetx-this._x) <=0.3) {
this._x = Targetx;
Delete This.onenterframe;
}
};
}
Stop ();

Source file Download: Picture effect series of four RAR



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.