View Mode: Normal | Article List

Flash Russia Bricks (as3)

[ 2009-04-23 14:16:21 | Author: liuhuan ]
Russia Bricks is a classic game everybody has played before. I tried to make one in as3.

Here i used a classic way to describe the bricks in array:
var arr_brickTypes:Array = new Array()


Flash calendar (as3)

[ 2009-04-07 19:00:36 | Author: liuhuan ]
It's easy to use calendar in older flash version, since there is a Calendar component which is powerful and convinient.

For Flash CS3 and later versions, flash does not provide calendar component anymore. I don't know why. However, i made one myself.

The essential functions used in flash calendar are:

1. judge whether the year is olympic ...


online FavIcon creator

[ 2009-04-02 21:55:35 | Author: liuhuan ]

A good tool to create favicon online.

TCN 2009

[ 2009-03-28 22:13:40 | Author: liuhuan ]

Open local txt file in flash (as3)

[ 2009-03-22 22:33:44 | Author: liuhuan ]
It might be impossible to open local file directly until Flash player 10's release. The "load" method of FileReference class provides us a way to open local file in bytearray.

There are several ways to open txt file, depending on the encoding type. If you are opening a file with utf-8 encoding, you could use:


Average color

[ 2009-03-21 14:58:45 | Author: liuhuan ]
A way to caculate average color for a image. I wasted a lot of time trying to open local image file into flash. This new function is only supported by flash player 10, using Bytearray which is convinient and powerful.

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import fl.controls.Button;


Bresenham algorithm

[ 2009-03-20 22:29:33 | Author: liuhuan ]
Bresenham algorithm is widly used in drawing straight lines. More importantly, it provides a way for us to find the shortest way from one point to another when developing flash games.

If you want to draw a tiny thin line in flash, have a try with this algorithm.

var size:Number = 20;
var curPoint:int = 1;
var firstPoint:Point= new Point();