Home >
Here's fun little AcitonScript-only project that takes advantage of some of the concepts I've discussed recently. This is a great project for learning the drawing API, experimenting with Flash & math-based drawing, learning ActionScript-only projects, or seeing object caching in action. This application itself doesn't have a lot of business value, but its a great example to teach these principles so that you can use them in your own applications.
Similar to my last post on lightweight charts, this example is an ActionScript-only project that takes advantage of only the Flash player's drawing api. There are lots of great features in the Flash player that enable the rich capabilities that define RIA, and my favorite by far is the drawing API.
Here's the application running:
This example was inspired by the old Flash MX 2004 book "Flash Math Creativity", however with my own influence on there.
First, everything in this example is randomly generated. The colors are randomly selected. The shapes are randomly set from a subset of shape classes. The movement speeds and directions are randomly calculated, and functions used to determine the shape movement are randomly selected. You can click anywhere on the application, and it will clear & generate a new shape pattern.
Second, everything in this example is fully object oriented. There is a base shape class, and every shape instance inherits from that class. This is so that code is encapsulated, easy to understand, minimizes code duplication, and maximizes code reuse.
Third, it uses object caching to minimize the number of objects being created at runtime, therefore maximizing the runtime performance.
Last, its 100% ActionScript, compiled with the Flex 3 compiler. This compiled swf file in this example is a miniscule 3 K. This is actually a fraction of the size of the screenshots of the application in action that I have below (which are anywhere from 35 to 65 K each).
You can view the full application source code here:
http://www.tricedesigns.com/portfolio/actionscriptshapes/srcview
You can download the full source code here:
http://www.tricedesigns.com/portfolio/actionscriptshapes/srcview/ActionScriptShapes.zip
Using the drawing API, some math, and some creativity, you can create some really interesting shapes and you just might be surprised with what you end up with. Here are a few snapshots I was able to capture:









Facebook Application Development
now thats cool!
Awesome!... And very inspiring.
Thanks for providing the source code - this will be great to learn a few things from!
Sweet.. now let's see it working with Degrafa.. ;) Seriously, cool stuff... reminds me of a something you'd see on http://levitated.net/.
WOW Very Nice.I like all ov These.Dingggg!!!!!!
neato...more stuff to digest :) Reminds me of high school, prolly way before all you cats out there. I used to code these sort of Quix styled animations in Pascal. Of course there was no mouse then to interact with them and my brain had a lot less fog to work in!
Those were the days...
peas
DK