Flash tutorials | 9 Drawing with AS3

You can use Sounds, Recursion, API… for drawing with as3. This post collects 9 tutorials about drawing with AS3

1.Drawing Sounds with AS3

while back I made my first attempt and create a sound visualizer in AS3. It was a pretty feeble, albeit necessary step toward making something that I looked cool and ran smoothly. Over the last couple of weeks, I have been playing around with a visualizer in my spare time, and finally have something I think is worth another post.

This time around, I am actually loading in a sound and getting its audio spectrum data. This is farther than my last, graphic-test only attempt. The new Sound model in AS3 is a bit different than previous versions, but it is not very difficult to understand. The major differences are a result of the new object hierarchy of the Sound package… and when you think about it they are intuitive changes. For the sake of this example, I won’t get into the nitty gritty of all the new classes in the Sound package, but keep it to the ones I am using for my visualizer. I am using:

  • a Sound object (the sound’s raw data)
  • a SoundChannel object (a reference to the playing sound)
  • the SoundMixer object (a static class that controls all the SoundChannels in use) 8-30-2008 3-02-56 AM

Read more

2.Drawing Shapes with AS3

Drawing any shapes with AS3 is very easy. In this tutorial I will show you how to draw a basic shape and then how to apply this knowledge into a dynamic application.

8-30-2008 3-06-54 AM

Read more

3.Drawing curves with AS3

In this tutorial we will be talking some more about drawing with actionscript 3.0, you might want to check out previous tutorials on the subject here.

Drawing with Flash AS3 part 1

Drawing with AS3 draw lines part 2

Now in this tutorial we will try to draw curved lines and try to wrap things up with this basic drawings tutorials.

So first I will try to explain what happens when we will draw curves with actionscript.

Basically we do the same thing as when we define a simple line, we set two point, the start and ending point of the line, both x and y coordinates. The difference is now we also have to define the curve point telling flash to drag the line from the center and out, as shown in the image below.

The image might explain it better then I do.

img1

Read more

4.Programatically Drawing Trees With Recursion

I get asked a lot of questions about my tree experiments, such as sakura and interactive elm. I thought I would write up a simple explanation to point people in the right direction.

The easiest place to start is with recursion. Trees are beautiful examples of recursion in the natural world. Recursion is a deep and very important topic, but for our purposes can be simplified to the idea of code calling itself. In the example below, each time you click the stage, all of the “active” (outermost) branches call code to draw two more branches at their ends, the next time you click, those new branches call the same code. Move your mouse around to vary the angle of all of the branches. As an aside, this example also has an interesting “emergent” property of drawing hexagons (try moving your mouse to the bottom when all of the branches are drawn).

8-30-2008 3-11-28 AM

Read more

5.Game prototype involving shape drawing and a ball

Sometimes I play and mess with code to get some interesting game prototypes.

Although I am not satisfied about this one, I want to share it with you anyway.

You have to draw a lasso with the mouse trying to catch the ball inside the shape you will create. In this case you’ll win.

If the ball touches the line before you close the shape, you die.

Uncommented code because it’s just an early stage, but if you are interested I will try to turn it into something playable.

Read more

6.Actionscript 3 Drawing API

This tutorial teaches you some cool animations that you can do just by using the Actionscript 3.0 drawing API.

8-30-2008 3-15-25 AM

Read more

7.Actionscript 3 Spiral

This tutorial teaches you how to use the drawing API to create an animating spiral. It’s not as hard as you may think. The code can be easily modified to create new exiciting animations.

8-30-2008 5-58-24 AM

Read more

8.AS3: Drawing Color Spectrums

have a collection of handy color spectrum classes in my personal library that are useful for creating a variety of color-picker components and what not. I thought I would share a few of them with you, as well as discuss the math that is involved in drawing a color spectrum.

colorwheel2

Read more

9.Simple Drawing in AS3 revisited

This code draws with a predefined brush “brush” onto the screen when the mouse is down and moving. A colour picker allows you to modify the colour.

8-30-2008 6-07-01 AM

Read more

Share/Save/Bookmark