inicio
home / inicio

Archive for code example / ejemplos de codigo

Inverse Kinetimatics for as3

I’ve trying to create an animated puppet with a skeleton that i can “pose” in flash. After some research i found out that to accomplish my goal i had to use something called Inverse Kinematics.

I don’t really understand the math behind it that well, but i used this tutorial made for as2 to create my own IKMember class, pretty much just copying it but translated to as3. This is my first attempt at the simplest of skeleton puppets : a Snake

Here’s the source code (IKSnake.zip)

PWButton as3 class

I often use MovieClips as interface buttons. I’ve put together a class to save myself some time on this task.

The PWButton class takes a MovieClip and turns it into a fully functional button with some time-saving features:

  • you can use the ‘data’ property to store and retrieve information, such as a parameter for later use on a function
  • enable() and disable() methods, easily turn the PWButton on and off much like the SimpleButton.enabled property.
  • you can set the roll over, down, and disabled states using frames within the target movieclip.

example swf:

PWButton.zip

Bitmapdata erasing in as3 (with custom brush shape)

For a drawing program made in flash, i came across the need to erase a bitmapData object using a custom brush tip. Finally i came across this example which was exactly what i needed, except it was written for actionscript 2.

I updated the script to actionscript 3, and added some extra comments that made me understand how this worked. I hope it saves you some time if you need to do something similar. (Please forgive the roughness of the code, its just a test for learning porpouses)

type="application/x-shockwave-flash">

Download erasetest.fla (552 kb)

« Previous entries