This is a blog about Flash & AS by betaruce :-)


October 2005
« Sep   Nov »
  1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

October 29, 2005

Bit-101 forum is back!

Filed under: Flash Events — betaruce @ 12:48 am

In some way, Bit-101 forum is important in my Flash life. b4 it is down, I visited it everyday to see what the others discuss, try to solve the problems of one another, and learn loads of stuff. It isn’t a large community like were-here, so things are not as “messy” as in were-here, and we members are quite like friends somehow :) Honestly speaking, it is the only Flash forum that I have visited so often and regularly :)

Anyway it is up again now, and I hope we can have some good discussions there

• • •

October 26, 2005

Some hints on AS 3 coding

Filed under: Using Flash — betaruce @ 5:52 pm

after several days of coding, I learn some new syntax and coding techniques concerning AS 3.

1> to draw things with commands like lineTo(), beginGradientFill(), etc, we need to class Graphics:,10);

2> the method drawCircle() of class Graphics has the following parameters:

xCenter:Number - The x location of the center of the circle relative to the registration point of the parent movie clip (in pixels).
yCenter:Number - The y location of the center of the circle relative to the registration point of the parent movie clip (in pixels).
radius:Number - The radius of the circle (in pixels).

If you set the xCenter and yCenter to some values, the circle drawn will have the offset even you change the x y properities later. e.g:,50,100);

The above circle will be positioned at (150,150) from the stage top left corner (if the stage is the container of that circle).

3> In previous version of Flash, I can set a 2D array like that:

arr=new Array();
arr[i]=new Array();

this doesn’t seems to work in AS 3 (maybe that’s my problem). So I use the following method:

var size:int=10;
var arr:Array=new Array()
for(var i:int=0;i
var temp:Array=new Array();
for(var j:int=0;j

I need to set up another array “temp” and then push it into “arr” to make it 2D. It works anyway, although I would prefer another more convenient methods.

4> You cannnot have a BitmapData show directly as by attachBitmap to a movie clip in Flash 8. Also attachBitmap is gone in AS 3. Instead you need the new Bitmap class:

var b:BitmapData=new BitmapData(100,100,false);
var bm:Bitmap=new Bitmap(b);

We need to tell the Bitmap “bm” to reference to the BitmapData “b”, and then use addChild to add it to the display list to make it show.

Hope these 4 “findings” can help :) . Feel free to correct me if there’s mistake.

• • •

AS 3 Experiment: Animated Plasma (speed improvement)

Filed under: My Flash Programs — betaruce @ 1:20 pm

Compared with my same experiment produced in Flash 8, the following (you will need Flash Player 8.5 to see it) is much faster and smoother since it is coded with AS 3.

This animated plasma effect is created with pixel manipulation. In my Flash 8 version, there are 120*120=14400 calculations/frame and of cause it hangs Flash player 8. In the above example, there are 300*300=90000 calculations/frame and the speed is awesome in player 8.5. On my 1.5Ghz computer the speed is still satistfactory for 500*500=250000 calculations/frame.

The following is the code:

package {
import flash.display.*;
import flash.geom.*;
import flash.util.*;

public var sx:int;
public var sy:int;
public var pixels:Array=new Array();
public var palette:BitmapData;
public var b:BitmapData;
public var bm:Bitmap;

public class plasma extends MovieClip {
public function plasma() {
var colors:Array=[0xff0000,0xffff00,0×00ff00,0×00ffff,0×0000ff,0xff00ff,0xff0000];
var alphas:Array=[100,100,100,100,100,100,100];
var ratios:Array=[0,43,85,128,170,212,255];
var mat:Matrix=new Matrix();
var gradient:MovieClip=new MovieClip();’linear’,colors,alphas,ratios,mat);,0,256,1);
palette=new BitmapData(256,1,false);
palette.draw(gradient,new Matrix());
b=new BitmapData(sx,sy,false);
bm=new Bitmap(b);
var den:int=16;
for(var i:int=0;i
var temp:Array=new Array();
for(var j:int=0;j
temp[j] = 128+128*Math.sin(i/(den*2));
temp[j] += 128+128*Math.sin(j/(den*4));
temp[j] += 128+(128*Math.sin(Math.sqrt((i-sx/2)*(i-sx/2)+(j-sy/2)*(j-sy/2))/den));
temp[j] += 128+128*Math.sin(Math.sqrt(i*i+j*j)/den);
temp[j] /= 4;

private function onEnterFrame(e:Event){
for (var i:int=0; i
for (var j:int=0; j
var temp:Number = getTimer()/20;
b.setPixel(i, j, palette.getPixel(int((pixels[i][j]+temp)%256), 0));

• • •

October 25, 2005

AS 3 Experiment: Bouncing balls

Filed under: My Flash Programs — betaruce @ 8:46 pm

just a simple application….several balls of random size and color are moving around and bounce off when they hit the stage border. You need Flash Player 8.5 to view it.

If you cannot view it, pls kindly leave a comment here (I’m testing another new server :) )

here’s the code:

package {
import flash.util.trace;
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.display.Stage;
import flash.geom.*;

public var sx:int;
public var sy:int;
public var numMC:int=10;

public class MC extends Sprite{

public var vx:Number=8+7*(Math.random()*2-1);
public var vy:Number=8+7*(Math.random()*2-1);

public function MC(){
graphics.beginFill(uint(255*Math.random())< <16|uint(255*Math.random())<<8|uint(255*Math.random()));

private function onEnterFrame(e:Event){
if(x<=width/2){x=width/2; vx*=-1;}
if(x>=sx-width/2) {x=sx-width/2; vx*=-1;}
if(y< =width/2) {y=width/2; vy*=-1;}
if(y>=sy-width/2) {y=sy-width/2; vy*=-1;}

public class testingAS3 extends Sprite {

public function testingAS3() {
stage.scaleMode = StageScaleMode.SHOW_ALL;
for(var i:int=0;i
var temp:Sprite=new MC();


One interesting finding is that for the following part:


the x and y parameters of drawCircle must be set to zero in order for the code to work properly as it is now, or else it seems cannot detect the correct stage border. Therefore I need to random the the ball position in the next 2 lines.

not sure why is that so, hope I will know more later.

• • •

October 24, 2005

My Book arrive finally!

Filed under: My Publications — betaruce @ 9:45 pm

My book has already been published in Taiwan several weeks ago, but then we still have to wait till the start of November to see the book in HK computer book stores…..and today I receive my 7 free copies!! :) feel so excited….I’ve been waiting it for nearly a year :)

• • •

October 19, 2005

Links to samples/tutorials for AS3

Filed under: Using Flash — betaruce @ 11:41 am

Many people are trying out AS 3 and posting stuff out already. Following are some links to sample codes and tutorials.

AS 3 Tutorial and Resources

Get start with AS 3
archives/000127.html (step by step tutorial from helpQLODhelp)

AS3 sample codes

AS3 some special new features and functions

PNG encoder with ByteArray

Sound Spectrum

Other site for collected links

• • •

October 15, 2005

Tunnel effect in Flash 8

Filed under: My Flash Programs — betaruce @ 11:19 pm

Animated tunnel effect created in Flash 8 with pixel manipulation. It is a bit CPU intensive and the effect is not so good since Flash 8 is still too slow to handle huge amount of data (looking forward to Flash 9 new and fast engine~).


Click here for the effect.

Use your mouse to navigate through the tunnel. Move around to turn in the tunnel. Click to change texture of tunnel.

• • •

Animated Plasma effect in Flash 8

Filed under: My Flash Programs — betaruce @ 7:17 pm

Plasma animation created with pixel manipulation. A bit CPU intensive

Click here for plasma effect

You can use your mouse and keyboard to change the plasma color and pattern :) .

• • •

Fire effect in Flash 8

Filed under: My Flash Programs — betaruce @ 3:12 pm

Fire effect created with a Convolution filter and a red-to-yellow gradient palette.

To view other Flash 8 experiments and download sources, please go to my Flash 8 page.

• • •

Flash 9 wish list

Filed under: Flash Events — betaruce @ 12:38 pm

actually the wish list was up for several weeks already~ yet in case you don’t know, you can check it out here:

Just post a comment there and tell MM what features you want for Flash 9 (codename: Blaze) :)

• • •
Next Page »

Powered by: WordPress • Template by: Priss

cheap phentermine phentermine site phentermine effects online phentermine phentermine prescription buy phentermine online phentermine alternatives phentermine deit pill cheap generic phentermine order phentermine online Clenbuterol Phentermine online pharmacy phentermine buy phentermine weight loss pill Cialis Comparison Viagra Cheap Viagra Online Prescription generic viagra sale viagra online viagra viagra pill discount sale viagra Generico Impotencia Viagra viagra sildenafil citrate Xanax Online xanax order xanax valium versus xanax levitra order levitra levitra Online buy levitra cialis viagra levitra