Thursday, October 27, 2005

Flex 2 - AS Project Basic by Theodore Patrick

ASProject Basic is a simple AS3 ActionScript Project that covers a wide range of new features in AVM2/AS3. The example covers custom Sprite Classes, Graphics API, DOM Events for enterFrame, mouseDown, resize, and compiler settings.





First off this example is simple on purpose. It is intended to help you understand the essential basics in using AS3 and ActionScript Project for creating games, components, and applications. ASProject is a type of project in Flex 2 that provides low level access to the ASC AS3 compiler built into Flex Builder 2.

In the example there are 3 Box instances created using the Graphics API (Drawing API in AVM1) that are added to the DisplayList using addChild. Each Box has some events that control the spinning of the red box as follows:

mouseDown on Blue Box makes the RedBox spin faster/positive.
mouseDown on Green Box makes the RedBox spin slower/negative.
mouseDown on Red Box reverses the direction that it is spinning.

Also if you view the example within its own window, you will see that it is positioned dynamically based on the 'resize' event. I also added in some compiler settings into the example that allow modification of the SWF background color, frame rate, and swf default size.

This example is available with full source and documentation within Flex® by Example.

More to come.

Ted :)

0 Comments:

Post a Comment

<< Home