例子如下:
单击可以全屏哦
代码如下:
package { import flash.display.MovieClip; import flash.events.Event; public class DocumentClass extends MovieClip { private const maxBalls:int=100; private var j:int; var f:int=Math.random()*360; public function DocumentClass() { init(); this.addEventListener(Event.ENTER_FRAME,onEnterFrame); } private function init() { var i:int; for (i=0; i <= maxBalls; i++) { var b1:fire=new fire; b1.znum=i; b1.width=f; addChild(b1); } } private function onEnterFrame(event:Event):void { if (j <72) { j+= 1; } else { j=1; f=Math.random()*360; var i:int; for (i=0; i <= maxBalls; i++) { this.getChildAt(i).width=f; } } } } } package { import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.text.TextField; public class fire extends MovieClip { var znum:int; private var step:int=0; var colornum:int; var pHexList = ["0xFFFFFF", "0xFFFFCC", "0xFFFF99", "0xFFFF66", "0xFFFF33", "0xFFFF00", "0xFFCCFF", "0xFFCCCC", "0xFFCC99", "0xFFCC66", "0xFFCC33", "0xFFCC00", "0xFF99FF", "0xFF99CC", "0xFF9999", "0xFF9966", "0xFF9933", "0xFF9900", "0xFF66FF", "0xFF66CC", "0xFF6699", "0xFF6666", "0xFF6633", "0xFF6600", "0xFF33FF", "0xFF33CC", "0xFF3399", "0xFF3366", "0xFF3333", "0xFF3300", "0xFF00FF", "0xFF00CC", "0xFF0099", "0xFF0066", "0xFF0033", "0xFF0000", "0xCCFFFF", "0xCCFFCC", "0xCCFF99", "0xCCFF66", "0xCCFF33", "0xCCFF00", "0xCCCCFF", "0xCCCCCC", "0xCCCC99", "0xCCCC66", "0xCCCC33", "0xCCCC00", "0xCC99FF", "0xCC99CC", "0xCC9999", "0xCC9966", "0xCC9933", "0xCC9900", "0xCC66FF", "0xCC66CC", "0xCC6699", "0xCC6666", "0xCC6633", "0xCC6600", "0xCC33FF", "0xCC33CC", "0xCC3399", "0xCC3366", "0xCC3333", "0xCC3300", "0xCC00FF", "0xCC00CC", "0xCC0099", "0xCC0066", "0xCC0033", "0xCC0000", "0x99FFFF", "0x99FFCC", "0x99FF99", "0x99FF66", "0x99FF33", "0x99FF00", "0x99CCFF", "0x99CCCC", "0x99CC99", "0x99CC66", "0x99CC33", "0x99CC00", "0x9999FF", "0x9999CC", "0x999999", "0x999966", "0x999933", "0x999900", "0x9966FF", "0x9966CC", "0x996699", "0x996666", "0x996633", "0x996600", "0x9933FF", "0x9933CC", "0x993399", "0x993366", "0x993333", "0x993300", "0x9900FF", "0x9900CC", "0x990099", "0x990066", "0x990033", "0x990000", "0x66FFFF", "0x66FFCC", "0x66FF99", "0x66FF66", "0x66FF33", "0x66FF00", "0x66CCFF", "0x66CCCC", "0x66CC99", "0x66CC66", "0x66CC33", "0x66CC00", "0x6699FF", "0x6699CC", "0x669999", "0x669966", "0x669933", "0x669900", "0x6666FF", "0x6666CC", "0x666699", "0x666666", "0x666633", "0x666600", "0x6633FF", "0x6633CC", "0x663399", "0x663366", "0x663333", "0x663300", "0x6600FF", "0x6600CC", "0x660099", "0x660066", "0x660033", "0x660000", "0x33FFFF", "0x33FFCC", "0x33FF99", "0x33FF66", "0x33FF33", "0x33FF00", "0x33CCFF", "0x33CCCC", "0x33CC99", "0x33CC66", "0x33CC33", "0x33CC00", "0x3399FF", "0x3399CC", "0x339999", "0x339966", "0x339933", "0x339900", "0x3366FF", "0x3366CC", "0x336699", "0x336666", "0x336633", "0x336600", "0x3333FF", "0x3333CC", "0x333399", "0x333366", "0x333333", "0x333300", "0x3300FF", "0x3300CC", "0x330099", "0x330066", "0x330033", "0x330000", "0x00FFFF", "0x00FFCC", "0x00FF99", "0x00FF66", "0x00FF33", "0x00FF00", "0x00CCFF", "0x00CCCC", "0x00CC99", "0x00CC66", "0x00CC33", "0x00CC00", "0x0099FF", "0x0099CC", "0x009999", "0x009966", "0x009933", "0x009900", "0x0066FF", "0x0066CC", "0x006699", "0x006666", "0x006633", "0x006600", "0x0033FF", "0x0033CC", "0x003399", "0x003366", "0x003333", "0x003300", "0x0000FF", "0x0000CC", "0x000099", "0x000066", "0x000033", "0xEE0000", "0xDD0000", "0xBB0000", "0xAA0000", "0x880000", "0x770000", "0x550000", "0x440000", "0x220000", "0x110000", "0x00EE00", "0x00DD00", "0x00BB00", "0x00AA00", "0x008800", "0x007700", "0x005500", "0x004400", "0x002200", "0x001100", "0x0000EE", "0x0000DD", "0x0000BB", "0x0000AA", "0x000088", "0x000077", "0x000055", "0x000044", "0x000022", "0x000011", "0xEEEEEE", "0xDDDDDD", "0xBBBBBB", "0xAAAAAA", "0x888888", "0x777777", "0x555555", "0x444444", "0x222222", "0x111111", "0x000000"]; public function fire() { var t:TextField = new TextField(); t.text = "010"; colornum=Math.random()*50; t.textColor = pHexList[colornum]; addChild(t); this.addEventListener(Event.ENTER_FRAME,onEnterFrame); } private function onEnterFrame(event:Event):void { if (step<36){ this.y=300+((step-Math.floor(znum/18)*15)*5)*Math.sin(znum*(Math.PI/18)*this.width); this.x=400+((step-Math.floor(znum/18)*15)*5)*Math.cos(znum*(Math.PI/18)*this.width); step+=3; }else{ step=0 ; } } } }
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}