Flash制作的好看的图片效果动画_Flash教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:Flash关于游戏制作研究之在场景中移动(一)
场景是游戏中的一个重要元素,非凡对于RPG游戏来说场景的数量就更多了,所以现在我为一些想做游戏的入门新手来讲解一下,游戏中的角色是如何在场景中实现移动的

  看效果:

代码如下:

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里面做一个按钮,并在按钮上加入如下脚本:on(release){getURL(_root._url,_blank

/所属分类:Flash教程/更新时间:2008-03-05
相关Flash教程