• WAP手机版 RSS订阅 加入收藏  设为首页
FL实例教程 

Flash制作切换图片效果动画

时间:2016-10-8 14:36:46  作者:佚名  来源:Flash素材助学网  浏览:0  评论:0

效果

 

代码如下:

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;

//txt.text = "己加载:"+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]);

//***************加载外部图片的代码结束**************

}

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();

 


标签:制作 切换 图片 效果 动画 
 [温馨提示] 请用鼠标右键点击,选择《目标另存为》下载”!果下载有出错,请留言。
 出处:Flash娱乐素材网    网址: http://www.flashyl.com
 欢迎您通过本站会员中心向对称栏目投稿,转载请自觉注明:出处、网址和作者。
相关评论

在线咨询点击这里给我发消息QQ留言