1 FL 教程Flash 設計的好看的圖片效果動畫 周四 3月 03, 2011 7:06 pm
Admin
Admin
看效果:
代碼如下:
var old:Number = 1;
//記錄上張顯示的圖片
var oldGo:Boolean;
var oldpos:Number = 700;
var picNum:Number = 9;
//anliPath是用于加載外部圖片的路徑
//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內部圖片的代碼****************
this.pic["mc" i].attachMovie("m" i, "m" i, 100-i);
//*********************************加載外部圖片的代碼*******************
//圖片加載進度條的設置
//
//myLoader = new MovieClipLoader();
//myListener = new Object();
//myListener.onLoadProgress = function(loadTargetMC, loadedBytes, totalBytes) {
//aa = (loadedBytes/totalBytes)*100;
[您必需注冊并登錄才能查看本鏈接。] = "己加載:" int(aa) "%";
//};
//myListener.onLoadStart = function(loadTargetMC) {
[您必需注冊并登錄才能查看本鏈接。] = true;
[您必需注冊并登錄才能查看本鏈接。] i].stop();
//};
//myListener.onLoadComplete = function(loadTargetMC) {
[您必需注冊并登錄才能查看本鏈接。] i].play();
[您必需注冊并登錄才能查看本鏈接。] = false;
//if (i == 1) {
//motion(1200, 1);
//}
//};
[您必需注冊并登錄才能查看本鏈接。] i ".gif", this.pic["mc" i]);
//***************加載外部圖片的代碼結束**************
}
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();]
代碼如下:
var old:Number = 1;
//記錄上張顯示的圖片
var oldGo:Boolean;
var oldpos:Number = 700;
var picNum:Number = 9;
//anliPath是用于加載外部圖片的路徑
//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內部圖片的代碼****************
this.pic["mc" i].attachMovie("m" i, "m" i, 100-i);
//*********************************加載外部圖片的代碼*******************
//圖片加載進度條的設置
//
//myLoader = new MovieClipLoader();
//myListener = new Object();
//myListener.onLoadProgress = function(loadTargetMC, loadedBytes, totalBytes) {
//aa = (loadedBytes/totalBytes)*100;
[您必需注冊并登錄才能查看本鏈接。] = "己加載:" int(aa) "%";
//};
//myListener.onLoadStart = function(loadTargetMC) {
[您必需注冊并登錄才能查看本鏈接。] = true;
[您必需注冊并登錄才能查看本鏈接。] i].stop();
//};
//myListener.onLoadComplete = function(loadTargetMC) {
[您必需注冊并登錄才能查看本鏈接。] i].play();
[您必需注冊并登錄才能查看本鏈接。] = false;
//if (i == 1) {
//motion(1200, 1);
//}
//};
[您必需注冊并登錄才能查看本鏈接。] i ".gif", this.pic["mc" i]);
//***************加載外部圖片的代碼結束**************
}
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();]