Chapter 13 of Robert Penner’s Programming Flash MX is the third of the final four chapters of the book. This chapter includes a class that records motion and two other classes to develop a recursive fractal tree that bends and sways with user interaction.
This chapter contains three classes: MotionCamera, which will be included in the com.robertpenner.effects namespace, and FractalBranch and FractalTree, which will be included in the com.robertpenner.profmx.fractalTree namespace.
Documentation:
com.robertpenner.effects.MotionCamera
com.robertpenner.profmx.fractalTree.FractalBranch
com.robertpenner.profmx.fractalTree.FractalTree
Source:
Penner AS2 ProFMX: Chapter 13 Classes
Dependencies:
mx.transitions.Tween
mx.utils.Delegate



Click image to view demo
Click around above and then let go, whatever motion you created will be repeated until you start clicking again. This is an example using the MotionCamera class from the Chapter 13 Penner AS2 post
To replicate this example, add an oval shaped MovieClip to the stage with an instance name of “oval”.
Then on the root timeline add the following code:
import com.robertpenner.effects.MotionCamera; var xmouse_cam:MotionCamera = new MotionCamera (oval, "_xscale"); var ymouse_cam:MotionCamera = new MotionCamera (oval, "_y"); xmouse_cam.setActor (this, "_xmouse"); xmouse_cam.looping = true; ymouse_cam.setActor (this, "_ymouse"); ymouse_cam.looping = true; this.onMouseDown = function () { with (xmouse_cam) { eraseFilm(); rewind(); start(); startRecord(); } with (ymouse_cam) { eraseFilm(); rewind(); start(); startRecord(); } }; this.onMouseUp = function () { with (xmouse_cam) { stopRecord(); cutFilm(); rewind(); } with (ymouse_cam) { stopRecord(); cutFilm(); rewind(); } }; stop();