Author Archives: Zevan

BitmapData Brush

CLICK HERE TO COPY
Actionscript:

var canvas:BitmapData=new BitmapData(400,400,true,0xFFCCCCCC);

addChild(new Bitmap(canvas));

 

var redOval:Shape = new Shape();

with(redOval.graphics) lineStyle(0,0), beginFill(0xFF0000), drawEllipse(0,0,10,50);

 

addEventListener(Event.ENTER_FRAME, onLoop);

function onLoop(evt:Event):void {

 

    redOval.x = mouseX;

    redOval.y = mouseY;

    redOval.rotation += 10

    // transform.matrix contains all transformation information for

    // the redOval including scaleX, scaleY, x, y, rotation etc...

    canvas.draw(redOval, redOval.transform.matrix);

}

A very easy way [...]

Posted in BitmapData | Tagged , | Leave a comment

Senocular’s Two Sided 3D Clip

CLICK HERE FOR TODAY'S SNIPPET
In a recent kirupa thread, senocular posted an very useful snippet to aid in the creation of a two sided 3D MovieClip. The thread also contains an in depth description of polygon winding.
Description of Polygon Winding
I created a navigation demo using this technique.

Here is the source for the above demo
UPDATE
Justin Windle [...]

Posted in 3D, MovieClip | Tagged , , , | 4 Comments

Gradient Glow

CLICK HERE TO COPY
Actionscript:

var colors:Array = [0xFF0000, 0x666699, 0x223322, 0xCCCCDD, 0xFFEEFF];

var alphas:Array = [0, 1, 1, 1, 1];

var ratios:Array = [0, 50, 100, 200, 255]

var filter:GradientGlowFilter = new GradientGlowFilter(0, 0, colors, alphas, ratios, 30, 30, 1, 2, "full", true);

 

var circles:Shape = new Shape();

 

 for (var i:int = 0; i<30; i++){

  with(circles.graphics) beginFill(0xFF0000), drawCircle(Math.random()*500, Math.random()*400,10+Math.random()*40);

 }

 addChild(circles);

 

 circles.filters = [filter];

I [...]

Posted in Graphics | Tagged , | Leave a comment

Bring Display Object to Top

CLICK HERE TO COPY
Actionscript:

mc.addEventListener(MouseEvent.ROLL_OVER, onRollOver);

function onRollOver(evt:MouseEvent):void {

  addChild(MovieClip(evt.currentTarget));

}

This one is very simple, but it's important to note that using addChild() on something that is already on the display list simply brings it to the top. Back in AS2 we used to do:
CLICK HERE TO COPY
Actionscript:

mc.swapDepths(1000);

Posted in DisplayObject, display list | Tagged , | 3 Comments