Penner AS2 ProFMX: MotionCamera ExampleDemo of the AS2 classes for ProFMX chapter 13.

Motion Camera

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();
Posted in Flash | Leave a comment
Penner AS2 ProFMX: Chapter 13: Fractal DancerAS2 classes for ProFMX Chapter 13.

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

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Snowstorm ExampleDemo of the AS2 classes for ProFMX chapter 12.

Snow

Click image to view demo


Move around above and you will see the Snowstorm example using the classes from the Chapter 12 Penner AS2 post.

To replicate this example:

  1. Create a new Flash movie and then create a MovieClip at (0, 0).
  2. In this MovieClip, add a rectangle 400px wide by 300px high with the registration point at the top left of the rectangle.
  3. This will be the boundingBox of the snow component. Give the MovieClip an instance name of “boundingBox”.
  4. Select this MovieClip on the stage and convert it to another MovieClip. Name this clip “snow” and add the class linkage of “com.robertpenner.profmx.snow.Snow”. Also, give it an instance name of “snow”.
  5. You will now convert this MovieClip to a component. Right-click on it and select “Component Definition”. In the window that pops up add the same class to the area that says “AS 2.0 Class:”.
  6. Click on the Parameters tab to see the following component options: fallSpeed, friction, maxFlakes, and zDepth. Play around with these options.
  7. On the root timeline add the following code and compile:
    this.snow.init();
    
Posted in Flash | 3 Comments
Penner AS2 ProFMX: Chapter 12: SnowstormAS2 classes for ProFMX Chapter 12.

Chapter 12 of Robert Penner’s Programming Flash MX is the second of the final four chapters of the book. This chapter includes classes to develop a 3d snowstorm particle system with user controlled wind.

This chapter contains three classes: Snowflake, Snowstorm and Snow, which will be included in the com.robertpenner.profmx.snow namespace.

Documentation:
com.robertpenner.profmx.snow.Snowflake
com.robertpenner.profmx.snow.Snowstorm
com.robertpenner.profmx.snow.Snow

Source:
Penner AS2 ProFMX: Chapter 12 Classes

Dependencies:
Penner AS2 ProFMX: Chapter 5 Classes
Penner AS2 ProFMX: Chapter 3 Classes
mx.transitions.OnEnterFrameBeacon

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Aurora Borealis ExampleDemo of the AS2 classes for ProFMX chapter 11.

Aurora Borealis

Click image to view demo


Move around above and you will see the Aurora Borealis example using the classes from the Chapter 11 Penner AS2 post.

To replicate this example:

  1. Create a new Flash movie and then create a MovieClip.
  2. In this MovieClip, add a rectangle 2.5px wide by 100px high with the registration point at the top center of the rectangle.
  3. Fill the rectangle with a gradient 50% white alpha at the top and 0% white alpha at the bottom. This will be the Aurora Borealis particle.
  4. Remove this MovieClip from the stage so that it is only in the library and then name it “auroraParticle” and add a class linkage of “com.robertpenner.profmx.auroraBorealis.AuroraParticle” to it.
  5. Now add another blank MovieClip to the library and name it “auroraBorealis” and add the class linkage of “com.robertpenner.profmx.auroraBorealis.AuroraBorealis” to it.
  6. You will now convert this MovieClip to a component. Right-click on it and select “Component Definition”. In the window that pops up add the same class to the area that says “AS 2.0 Class:”.
  7. Now drag this component to the stage and place it at the top center.
  8. Add an instance name of “auroraBorealis” to the component MovieClip and then click on the Parameters tab to see the component options. Play around with these options.
  9. On the root timeline add the following code and compile:

    this.auroraBorealis.init();
    
Posted in Flash | Leave a comment
Penner AS2 ProFMX: PhysicsParticle ExampleDemo of the AS2 classes for ProFMX chapter 11.

ElasticForce

Click image to view demo


Click around above and you will see an example using the ElasticForce, Force, and PhysicsParticle classes from the Chapter 11 Penner AS2 post

To replicate this example, add a circle MovieClip to the stage with an instance name of “ball”.
Then on the root timeline add the following code:

import com.robertpenner.physics.PhysicsParticle;
import com.robertpenner.physics.forces.ElasticForce;

var p:PhysicsParticle = new PhysicsParticle(ball, ball._x, ball._y);
p.setFriction(.1);
var eForce:ElasticForce = new ElasticForce(130, 70, .2);
p.addForce("elastic", eForce);

this.onMouseDown = function() {
	eForce.setAnchor(this._xmouse, this._ymouse);
}

stop();
Posted in Flash | Leave a comment
Penner AS2 ProFMX: Chapter 11: Aurora BorealisAS2 classes for ProFMX Chapter 11.

Chapter 11 of Robert Penner’s Programming Flash MX is the first of the final four chapters of the book and they are devoted to case studies. With each of these four chapters I will post about the converted classes and then follow it up with a post showcasing the case study. Chapter 11 builds upon the physics concepts from Chapter 8 and includes classes that help to encapsulate many of the physical forces that act upon objects and then builds upon those classes creating an effect that closely resembles the Aurora Borealis.

This chapter contains five classes: PhysicsParticle and Force, which will be included in the com.robertpenner.physics namespace, ElasticForce, which will be included in the com.robertpenner.physics.forces namespace, and AuroraParticle and AuroraBorealis, which will be included in the com.robertpenner.profmx.auroraBorealis namespace.

Documentation:
com.robertpenner.physics.PhysicsParticle
com.robertpenner.physics.Force
com.robertpenner.physics.forces.ElasticForce
com.robertpenner.profmx.auroraBorealis.AuroraParticle
com.robertpenner.profmx.auroraBorealis.AuroraBorealis

Source:
Penner AS2 ProFMX: Chapter 11 Classes

Dependencies:
Penner AS2 ProFMX: Chapter 4 Classes
Penner AS2 ProFMX: Chapter 3 Classes
mx.transitions.OnEnterFrameBeacon

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Minor Class UpdatesMade a few updates to some of the previous Penner classes.

I made some minor updates to a few of the previous Penner AS2 classes:

Changes:
1) MathUtil added two new methods from the final chapters: randRangeFloat and randRangeInt.
2) Graphic3d added getter setter methods for the scale property.
3) WaveMotion fixed minor bug.
4) DrawingClip fixed minor bug.

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Chapter 10: Drawing with ActionScriptAS2 classes for ProFMX Chapter 10.

Chapter 10 of Robert Penner’s Programming Flash MX provides an extensive collection of custom methods that extends upon Flash’s Drawing API, allowing for more complex shapes, including triangles, rectangles, polygons, and cubic beziers. Wrapping up this chapter completes the bulk of the book, with only the Case Studies left to convert.

This chapter contains one class: DrawingClip, which will be included in the com.robertpenner.display namespace.

Documentation:
com.robertpenner.display.DrawingClip

Source:
Penner AS2 ProFMX: Chapter 10 Classes

Update:
Please note: I also made a few minor updates to the color classes so if you already downloaded those, please download them again.

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Chapter 9: Coloring with ActionScriptAS2 classes for ProFMX Chapter 9.

Chapter 9 of Robert Penner’s Programming Flash MX provides an extensive collection of custom methods that allow for more intuitive color manipulation.

I have gone through and converted all of Penner’s work to support not only the Color object, but also the ColorTransform object. So if you are using Flash 8, you have the choice of either workflows.
I have also tried to make the classes as flexible as possible to allow you to work with the Color and ColorTransform classes the way you like. For example, Color and ColorTransform each have a util class that allows you to pass in your respective object and decorate it with the new methods. They also each have an extended class that provides the new methods. And finally, they each have a class that allows you to decorate a particular MovieClip or all MovieClips with the new methods.

This chapter contains six classes, three based upon the Color object and another three based upon the ColorTransform object: ColorUtil and ColorTransformUtil, which will be included in the com.robertpenner.utils namespace, XColor and XColorTransform, which will be included in the com.robertpenner.graphics namespace, and ColorClip and ColorTransformClip, which will be included in the com.robertpenner.display namespace.

Documentation:
com.robertpenner.utils.ColorUtil
com.robertpenner.utils.ColorTransformUtil
com.robertpenner.graphics.XColor
com.robertpenner.graphics.XColorTransform
com.robertpenner.display.ColorClip
com.robertpenner.display.ColorTransformClip

Source:
Penner AS2 ProFMX: Chapter 9 Classes

Dependencies:
Color
flash.geom.ColorTransform

Posted in Flash | 4 Comments
  • Pages

  • Categories

  • Archives