Tuesday, July 11, 2006

Flash Advanced Design

I sat in a Flash Advanced Design class for three days last week filling my head with all the simple wonders of actionScript 2.0. The class was held at Alphaware Training Centers right off of Bellaire and 610, so i wasn’t too far from the hospital, adolfo’s school, or the Galleria. The class was small (there were only three of us – the other two guys were co-workers at Schlumberger in Sugarland) and the room was pretty boring. The instructor, Drew Shefman, was very thorough and managed to answer some of my questions, even though many of them fell beyond the scope of the class.

And while most of the lessons were familiar to me, it was great to see how all the individual pieces worked together to complete a project.

Things got a little confusing in the XML lesson, but i’ve got the book and i took notes, so i’m looking forward to posting some mini-projects soon.

Speaking of, the one thing he did help me out with was some random tree generator code that i had copied out of the Flash Hacks book. As pulled out of the book, the code was meant to be put straight into a .fla file, but i wanted to put it into a class file which made things a little more complicated. Naturally, for him, the solution was simple. The following morning he emailed the code:

var owner = this;
segment.onEnterFrame = function() {
owner.grow(this) };

These couple of lines represent the solution to my problem. Once again, scope. The explanation escapes me again, but i’ll take a stab. The ‘owner’ variable set equal to this refers to the class instance (the tree), and the ‘this’ passed into the grow function refers to the particular movie clip within the class i want the function to work on. I swear i understood it better while i was in class. A weekend and a couple of days at work later, it’s mushy.

For those of you who are interested and have Flash 8 (adolph?) the Alpha Version of Flash 9 is available (as an extension to Flash 8 only) for download if you want to tackle ActionScript 3.0.

Update: Click here for the random tree generator!

3 comments:

Pablo said...

nice!

Adolph said...

Those are pretty trees! I never really think of xml like that--it is more like roots into the ground for me.

killy said...

the tree isn't generated with xml, but with the movieClip's lineTo,moveTo,onEnterFrame methods.