<< Chapter < Page Chapter >> Page >

Supplemental material

I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com .

General background information

I am going to take a very broad view of computer animation in this and the next few lessons. A program that causes visual images to change over time produces what I am referring to an animation.

Such visual changes can take on many different forms. Perhaps the most common form of animation is the movement (change in position) of an object over time. However, animation can involve a change in any visualattribute of an object over time, such as changes in position, color, size, opacity, orientation, etc.

A layman's view of the Flash Player

Major differences

There are some major differences between writing animation code in ActionScript and writing animation code in Java, C++, and C#.

Those differences generally have to do with the strong tie between the execution of ActionScript code and the Flash Player. (In some cases, references to the Flash Player in this lesson may also apply to Adobe Air.)

To understand how to write animation code in ActionScript, you must first understand a little about the Flash Player.

Why is it called a player?

There is a good reason that the Flash Player is referred to as a player . In many ways, it resembles a DVD player or a VCR player. What I mean by that isthat the Flash Player extracts a series of visual images from memory and displays those images sequentially with a (hopefully) fixed time interval between the display of one image and the display of the next image inthe sequence.

The scene is displayed once during each frame

We can't know exactly what happens at the lowest levels of the software and the display hardware. However, from the viewpoint of the ActionScript programmer,the scene described by the images stored in memory is displayed over and over even if it isn't changing.

According to the ActionScript 3.0 Bible, 2nd Edition, by Braunstein, ActionScript 3.0 uses a concept known as "dirty rectangles" to avoid physically rendering rectangular groups of pixels that haven't changed.

Frames

Each new display of the scene is referred to as a frame . As you will see later, it is possible for the ActionScript programmer to simply accept thedefault rate at which frames are displayed, or to execute code to set the frame rate to something other than the default rate.

Not the case in Java, C++, and C#

The inherently strong tie between the images stored in memory and the sequential and repetitive display of those images by the Flash Player does notexist in Java, C++, or C# (although it can be simulated ) .

There is an open-source programming environment named Processing that uses Java to create an architecture very similar to the Flash Player.The Microsoft XNA Game Studio (C#) and Game Creators Dark GDK (C++) also create a similar architecture. Note, however, that these are optional add-ons to the language, which is not the caseregarding ActionScript and the Flash Player.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask