Archive for January, 2008

24Jan

[AS 3] Bouncing Balls with Collision Detection within Bounds

9 comments so far

So, just playing around for now. Here is just some code where you can hardcode in the number of balls to animate within the stage area. You can also change the bounding area, with a few more variables, so the balls will be contained. This may serve as a little groundwork for a simple interactive [...]

Categories: Actionscript 3, Physics
23Jan

[AS 3] Actionscript Masking and Unsetting Masks with the Mask Method

No comments

Prior to Actionscript 3 I have been using the setMask and unsetMask Methods to dynamically mask objects. Since they have rid of the methods, I wanted to play around a little more with the Mask method. All that you do is assign one object to mask another. Essentially if you wanted to mask over an [...]

22Jan

[AS 3] Z-Sorting Layers with setChildIndex Method

1 comment so far

So the more I am exploring with Actionscript 3, I began to wonder how the objects were being layered on the stage. Not to mention how to essentially swap their assigned depths with objects. I have used the swapDepths() method in previous versions of Actionscript and have noted that Actionscript 3 does this differently.
The following [...]

Categories: Actionscript 3
18Jan

[AS 3] Drawing Lines to Mouse Point

No comments

I just decided to build this simple interactive movie that will simply draw lines from the center of the stage to your mouse position and then closes out the drawing to form a triangle. This is just using the simple methods of:

graphics.clear
graphics.moveTo
graphics.lineStyle
graphics.beginFill and graphics.endFill
graphics.lineTo

Full documentation here.
If you hover your mouse over the movie below it [...]

17Jan

[AS 3] Simple Motion Tween To A Point

No comments

I just wanted to make a dynamically drawn box be animated to the center of the stage. I figure I can use this as a building block animation for a future project.
First we will use the DrawRectangle class to construct our object.

package
{
import flash.display.Sprite;

public class DrawRectangle extends Sprite
{
private var xPos:Number;
private var yPos:Number;
private var rWidth:Number;
private var rHeight:Number;
private [...]