先看效果:
下面是代码:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var maskend:Boolean;
maskend = false;
_global.taregetbg;
function intiLoad(imgno:Number) {
maskmc2.attachMovie("mask2", "mask2", 5);
maskmc1.attachMovie("mask1", "mask1", 6);
///////////////////////////////////////////////加载外部图片的代码
//img1.loadMovie("img/photo"+imgno+".jpg"); //
//img2.loadMovie("img/photo"+imgno+".jpg"); //
///////////////////////////////////////////////
///////////////////////////////////////////////// 加载内部图片的代码
img1.attachMovie("pic"+imgno, "pic"+imgno, 1);
img2.attachMovie("pic"+imgno, "pic"+imgno, 2);
////////////////////////////////////////////////
////////////下面的代码的作用是加载背景MC//////////
maskmc2.onEnterFrame = function() {
if (this.mask2._currentframe == this.mask2._totalframes) {
maskend = true;
loadbg(imgno);
delete this.onEnterFrame;
}
};
////////////////////////////////////////////////
}
////////////加载背景图片的函数//////////////////
function loadbg(bgi:Number) {
bg.attachMovie("pic"+bgi, "pic"+bgi, -20);
}
intiLOad(1);
loadbg(6);
for (j=1; j<7; j++) {
this.smallbg["btnmc"+j].no = j;
this.smallbg["btnmc"+j]._alpha = 80;
this.smallbg["btnmc"+j].useHandCursor = false;
this.smallbg["btnmc"+j].onRelease = function() {
a = this.no;
if (nowI != a) {
intiLoad(a);
}
};
this.smallbg["btnmc"+j].onRollOver = function() {
this._alpha = 100;
};
this.smallbg["btnmc"+j].onRollOut = function() {
this._alpha = 80;
};
}
stop();
源文件下载: 图片效果系列之一.rar