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
Penner AS2 ProFMX: Chapter 8: PhysicsAS2 classes for ProFMX Chapter 8.

We’re moving directly from Chapter 5 to Chapter 8 of Robert Penner’s Programming Flash MX.
We’re skipping Chapter 6 because it’s all about event-based programming and uses the old ASBroadcaster, so there’s no need to go into it. If you’re interested in event-based programming after reading the chapter and don’t know much about it, look into mx.events.EventDispatcher, there’s a ton of documentation out there on it.
We’re also skipping Chapter 7 because it focuses on the Motion and Tween classes that Macromedia licensed from Penner and wrapped into one mx.transitions.Tween class, so no need to recreate that class, although we will need to use it for the class I have converted in Chapter 8. Penner himself converted the other classes from Chapter 7 to AS2: the now famous easing equations that you can download from his site.

Chapter 8 begins to delve into the world of physics. Most of the chapter focuses on using the Vector class with the core principles–velocity, acceleration, force–and the relationships between them.

This chapter contains only one class: WaveMotion, which will be included in the com.robertpenner.effects namespace.

Documentation:
com.robertpenner.effects.WaveMotion

Source:
Penner AS2 ProFMX: Chapter 8 Classes

Dependencies:
mx.transitions.Tween

Posted in Flash | Leave a comment
Penner AS2 ProFMX: Updates CompleteThe robertpenner package updates are complete.

The packages for the Penner AS2 classes have been updated and my previous posts and documentation have been updated to reflect the changes. Below you will find a list of the changes that were made.

Changes:
1) The Vector and Vector3d classes have been moved from the com.robertpenner.vector package to the com.robertpenner.geom package.
2) There is no longer a com.robertpenner.vector package.
3) The Constant class no longer exists, it has been merged with the Utility class into the new MathUtil class.
4) The MathUtil, Degree, and Polar classes have been moved from the com.robertpenner.math package to the com.robertpenner.utils package.
5) There is no longer a com.robertpenner.math package.

Posted in Flash | 1 Comment
Penner AS2 ProFMX: Package UpdatesI've decided to make some tweaks to the robertpenner package structure.

There is always a fine line between how long you should devote to the planning stages of a project and when you just need to crank through stuff and get it out. With this Penner AS2 project that I’ve undertaken, I wanted to start releasing as soon as I made the announcement. Even though I had spent plenty of time up front thinking through the book and all the different classes that would need to be converted, I didn’t give the package names that much forethought. Penner had already come up with most of the class names (although in certain circumstances I have tweaked the name where I thought appropriate), but in AS1 there was obviously no need to think through package names.

The package names I initially chose for the classes I’ve released to date made sense at first, but as I started moving my way through the book I found areas where I wasn’t thinking broadly enough. I’ve decided to go back and update these packages to follow standards set in place by Macromedia (Adobe) for the naming conventions of their packages… and to be the most up-to-date, I have decided to follow the AS3 package conventions, which vary slightly from the Flash 8 package conventions.

The vector classes will now be under the geom package and the math classes will be under the utils package and some actual class names might be tweaked slightly as well.

As soon as I get everything updated (including the previous posts), I will make a new post with all of the details. Sorry for any inconvenience, but I think in the long-run this will make more sense and allow the robertpenner namespace to remain flexible.

Posted in Flash | Leave a comment
  • Pages

  • Categories

  • Archives