In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-12-30

Get Adobe Flash player
by h_sakurai 30 Dec 2009
    Embed
/**
 * Copyright h_sakurai ( http://wonderfl.net/user/h_sakurai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eqAO
 */



package {
    import flash.display.*
    import flash.geom.*
    import flash.events.*
    public class FlashTest extends Sprite {
		private var bitmapData:BitmapData = new BitmapData(465, 465, false, 0)
		private var shape:Shape = new Shape()
		private var array:Array = []
        public function FlashTest() {
			var bitmap:Bitmap = new Bitmap(bitmapData)
			addChild(bitmap)
			var matr:Matrix = new Matrix()
			matr.createGradientBox(511, 511, 0, -255, -255)
  			shape.graphics.beginGradientFill( GradientType.RADIAL,
				[0xffffff,0],
				[1,1],
				[0,255])
			shape.graphics.drawCircle(0,0,255)
			shape.graphics.endFill()
			for(var i:int = 0; i < 20;i++) {
				var p:Particle = new Particle()
				p.tx = Math.random()*465
				p.ty = Math.random()*465
				p.vx = Math.random()*8-4
				p.vy = Math.random()*8-4
				array.push(p)
			}
			addEventListener("enterFrame", update)
		}

		public function update(e:Event):void {
			var bitmapData:BitmapData = this.bitmapData
			var shape:Shape = this.shape
			var array:Array = this.array
			bitmapData.lock()
			bitmapData.fillRect(bitmapData.rect,0)
			for each (var p:Particle in array) {
				p.tx += p.vx
				if(p.tx < 0 || p.tx > 465) p.vx *= -1
				p.ty += p.vy
				if(p.ty < 0 || p.ty > 465) p.vy *= -1
				bitmapData.draw(shape,p,null,BlendMode.LIGHTEN)
				
			}
			bitmapData.unlock()
		}
    }
}
import flash.geom.*
class Particle extends Matrix {
	public var vx:Number
	public var vy:Number
}