Articles Tagged "ActionScript"

Multiple PageFlip Books in a File

Since a few people have asked me to help them add multiple PageFlip effects to a single Flash file I thought I'd write this tutorial just for them.

As usual, I recommend downloading the latest version of the Free Flash PageFlip File to be sure we're on the same page (so to speak). ...
Read More

Hexadecimal Color Fading Array

A while ago I wrote a Hexadecimal Color Fading Tutorial explaining how to select a single color at any point on a gradient between two specified colors. In that tutorial there was a function which efficiently broke each of the 2 specified colors into their Red, Green and Blue components and then calculated a single new color at a specified point between them.

Here's what the code looks like: ...
Read More

How to Swing a Pendulum Arc

In my previous article explaining How to Draw an Arc with ActionScript a few readers asked how to simulate the swing of a pendulum or the swaying motion of a falling leaf. Hopefully this tutorial will add a little insight into that process. The technique I'll be using won't mimic the effects of gravity but will be more similar to the metered swing of a clock's pendulum or a large carnival ride.

Observations
: Before we start writing any code, let's make a few general observations. If you were to swing a pendulum from right to left, you could note the following:

  1. Once the pendulum is dropped or released, it begins to pick up speed as it approaches the bottom of its arc. This gradual acceleration is similar to "Easing In".
  2. Once the pendulum passes the bottom of its arc, it begins to swing upward and consequently slows down which is similar to "Easing Out".
  3. Once the pendulum reaches the top of its arc on the left, it begins to swing backwards from left to right. The swing from left to right is a mirror image of the previous swing from right to left.

Conventions: With those observations in mind we can start ...
Read More

Flash Rotation Bug (with Fix)

I recently ran into a nasty "little" bug in Flash that happened to eat up a "big" chunk of my time. I'm surprised I haven't heard more about this particular bug since the conditions which cause it would seem fairly common.

Let's say you're using an onEnterFrame event to count frames as they pass with code like this:

//
//
var count = 0;
onEnterFrame = function(){
	count++;
}
//
//

Now let's suppose we want to rotate an arrow 1 degree every time a frame passes. We could write code like the following: ...
Read More

Flash CurveTo Visualization Code

If you've ever wondered how Adobe Flash draws a curve when issued a "curveTo" command this article will help you visualize the process.

As you probably know, Flash requires three points to draw an exponential curve.

  1. A Starting Point. Wherever the Flash drawing pen is currently located. If you have not previously moved the pen with "lineTo", "curveTo", or "moveTo" the pen defaults to the origin (0, 0).
  2. A Control Point. A point which the the Flash drawing pen will head toward before changing direction and heading toward the end point. The pen generally does not go through the control point unless your "curve" is nearly straight.
  3. An End Point. Where the Flash drawing pen will come to rest when the curve is complete.

But how exactly does the control point "control" the shape of the curve? How does Flash precisely map the vague concept of heading towards a point and then land precisely at another point? Take a look at the SWF file below ...
Read More

Publish PageFlip for Newer SWF Versions

If you try publishing the Flash PageFlip transition effect to SWF Player version 7.0 or higher the effect will break down due to masking errors. These errors are a result of faulty camel-case capitalization on my part. All SWF Players after version 7 are case-sensitive therefore improper references such as "lineto" will need to be changed to the proper "lineTo". Here are 3 ways to go about fixing the problem ...
Read More

Other People’s Classes

I was searching for a quick way to preload multiple files but wasn't having much luck until I found a great page listing various preloading classes that simplify most common content loading tasks. Out of all the preloading classes listed on the site, I chose GreenSock's Preload Asset Manager class because ...
Read More

© Sean O'Shell 2007-2008