Leaves

Feb 26, 12:23 PM


The idea behind this demonstration was to discover the random and realistic movements that Flash is capable of with Action Script 3.

Using some of the set AS3 methods I was able to successfully render 3 leaves falling completely randomly each time the page is refreshed.

I created a simple random number generator that combined with the fl.transitions library meant I was able to get the leaves to fall at random times, with varying “sways” in the X and Y directions.

Another point of note is that not only is the movement random and realistic (to a point :-S) the CPU isn’t put under a vast amount of pressure, owing to there being only a small amount of code, and AS3 being very frugal with it’s processor use.

Improvements

  • Occasional snags in the movement mean that the leaf will stop falling. This seems to happen in the CS3 interface a lot more than it happens in browsers. I really don’t know why this happens, so wouldn’t know where to start with the debugging :-S
  • A reset button, obviously
  • A “number of leaves selector”
  • I would love to incorporate scripted sequences with set movement alongside random generated events to create a unique experience for each user (even if they didn’t know it!) For example, an autumnal scene where there are lots and lots of events occurring, but some events are completely unique. This would take quite a bit more time, and university looms large at the moment!

Hope you like it, and email me at simon“at“robertsportfolio.com for the source code

Simon Roberts

,

---

Commenting is closed for this article.

---