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