Flash教程:纯AS代码制作的燃烧的火焰效果_Flash教程

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

推荐:Flash片头loading与V2组件相关问题
很早之前我曾经说过“没有loading的Flash,不是完整的flash”。我想那个句话可能偏激了。因为有时候一些不到10k的flash,确实不需要做什么loading。但我始终认

燃烧的火:纯AS代码火焰效果,Flash教程。希望大家理解把握!

效果如下。

  希望需要的朋友拿去用,顺便也希望拿走代码的朋友能顶起来,不要只拿代码不回帖,到时候有人需要了就找不到了。好东西大家要分享嘛,不要让它沉下去...
顺便也给我,写代码的人一点动力

/*--------------------------------------------------------------
支持原创 ANT制作
--------------------------------------------------------------*/
/*--------------------------背景-------------------------------*/
var mcs:MovieClip = createEmptyMovieClip("query", -1);
with (mcs) {
beginFill(0x000000,100);
lineStyle(0,0x000000,0);
moveTo(0,0);
lineTo(Stage.width,0);
lineTo(Stage.width,Stage.height);
lineTo(0,Stage.height);
lineTo(0,0);
endFill();
}
/*--------------------------制作影片剪辑实例-------------------------------*/
import flash.geom.*;
var McR:Number = 40;
var McA:Number = 60;
var CreaMovie:MovieClip = this.createEmptyMovieClip("CreaMc", 0);
with (CreaMovie) {
fillType = "radial";
colors = [0xFFFF00, 0xFFFF00];
alphas = [McA, 0];
ratios = [0, 0xFF];
matrix = new Matrix();
matrix.createGradientBox(McR,McR,0,0,0);
beginGradientFill(fillType,colors,alphas,ratios,matrix);
moveTo(0,0);
lineTo(0,McR);
lineTo(McR,McR);
lineTo(McR,0);
lineTo(0,0);
endFill();
}
CreaMovie._visible = false;
/*--------------------------火效果-------------------------------*/
var McNum:Number = 1;
var McMore:Number = 200;
var McRandom:Number = 6;
var McY:Number = 4;
var Mc_x:Number = Stage.width/2;
var Mc_y:Number = Stage.height/2 Stage.height/4;
var Mc_more:Number = 100;
var Mc_scal:Number = 50;
flame = function(){;
var scale:Number=random(Mc_scal) 1;
var flames:MovieClip=CreaMovie.duplicateMovieClip("flames" McNum,McNum,{_x:Mc_x,_y:Mc_y,_alpha:Mc_more/2,_xscale:scale,_yscale:scale});
flames.blendMode = "add";
flames.fast=Math.floor(scale/10);
flames.action=(random(2)==1)?1:-1;
flames.scal=10-flames.fast;
flames.n=flames.s=1;
flames._r = flames._g = 255;
flames._b =0;
flames.gs=(10-flames.scal 2)*3;
flames.onEnterFrame=function(){
this._x =this.fast*this.action*this.n*this.s;
this._y-=McY;
this._xscale =this.scal*this.n*this.s;
this._yscale =this.scal*this.n*this.s;
this._alpha =10*this.n*this.s;
this._g-=this.gs;
if(this._g<=0){
this._g=0;
}
new Color(this).setRGB(this._r << 16 | this._g << 8 | this._b);
if(this._xscale>=Mc_more){;
this.n=-1;
this.s=0.2;
};
if(this._alpha>=Mc_more){;
this._alpha=Mc_more;
}else if(this._alpha<=random(20)){;
this.removeMovieClip();
delete this.onEnterFrame();
};
};
if(McNum>=McMore){;
McNum=0;
};
McNum ;
};
setInterval(flame,10);

分享:Flash片头loading与MovieClipLoader
很早之前我曾经说过“没有loading的Flash,不是完整的flash”。我想那个句话可能偏激了。因为有时候一些不到10k的flash,确实不需要做什么loading。但我始终认

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