Flash notes by Edzis

ActionScript programmer / Flash developer Edgars Simsons on professional stuff

Archive for the ‘Flash Player 10’ Category

Version 2 of Tree generator in 25 lines of ActionScript

with 4 comments

Sample image of Tree generator 2

25 line Tree generator version 2. Click to view

January 2009 finalists of the 25-Line ActionScript Contest have been announced and sadly my entry is not among them. Therefore, to fulfill my desire of sharing I present you Tree generator 2. And for my fellow coders here is the source. Just a small tip – click on the stage to start a new tree.

This time it is more math than flash – the tree is drawn by generating 3D vectors (with critical parameters of rotationY, rotationZ, length)  for branches and changing them accordingly to their age and their parent branch position.

Written by edzis

January 23rd, 2009 at 11:35 am

Tree generator in 25 lines of ActionScript

with 6 comments

Sample tree by Tree Generator

View Tree Generator

I am writing a bit late, but just wanted to share that I as well had submited my entry for the The 25-Line ActionScript Contest – Tree Generator. For those not yet informed the competition is a revamp of the 2000 Flash MX 6 ActionScript 1 version, made alive by Keith Peters. on time with the release of Flash CS4. It is planned as a regular contest with cool prizes, starting with Adobe CS4 Suite.

Flash has changed a lot during the years and some folks are complaining that AS has become harder, too verbose, and that it takes more code to do the same things compared to AS1. I see this competition as a part of Keith Peters’ initiative to put the Flash Back in Flash.

As I am always amazed by the fields where technology touches the real world, I wanted to build something connected to nature. I know that other have already made really nice trees, but I saw some space for optimisation – sorry, Grant, but trees don’t grow that way. So, I made a growth animation, from a small culm to a full-grown tree only in 25 lines. I did not made it into the top 12, but I still want to share. Take a look at the code and swf and see the November/December Finalists.

Written by edzis

December 11th, 2008 at 1:06 pm

Posted in ActionScript 3, Flash Player 10

Tagged with ,

Blur on rotationY = 0? Use transform.matrix

with 14 comments

matrix3D vs matrix in image quality

matrix3D vs matrix in image quality

If you have run across bad quality visuals after doing DisplayObject transformations in 3D (rotationX, rotationY, rotationY or z-axis modifications) you might want to use transform.matrix to get back the quality.

I wanted to make a simple 3D animation in Adobe AIR 1.5 / FlashPlayer10 content in AIR – the DisplayObject should rotate around the Y axis from 90 to 0. The animation worked fine, but as soon I was changing the rotationY the content got blurry, even if i just set the rotationY to 0. I tried different solutions and was about to shout out for help when I remembered reading somewhere that as soon as the third dimension is applied to a Display object its transform.matrix is replaced with transform.matrix3D. And indeed after the animation is done I set DisplayObject.transform.matrix and the blur is gone! Flash removes all the 3D transformations. You might see that the image on right is much crisper, especially on the small horizontal lines.

However, if anybody knows why the content is blurred the first place despite no actual 3D transformation and/or other solutions how to remove it, I would love to hear that!

Written by edzis

November 4th, 2008 at 2:55 pm

Posted in Adobe Air, Flash Player 10

Tagged with , ,