July 29, 2004

musicplasma: relational music database

drew trujillo just passed over a sweet flash visualizer for musical relationships. you enter a band into the database and it displays what it thinks are similar bands. clicking a band shows albums with links to amazon. man, amazon should just buy this thing:

>> visit http://www.musicplasma.com/

Posted by moock at 06:03 PM

July 28, 2004

new actionscript/math blog, singularity

while at flash forward in new york a few weeks ago i met a smart and interesting c++/assembly developer named jim armstrong who's been into hardcore fuzzy logic and math programming for years. he has recently moved into flash programming and already has some very interesting perspectives to share at his new blog, singularity.

>> visit jim armstrong's blog: singularity

looks like one to watch if you're into math.

Posted by moock at 12:30 PM

July 26, 2004

uhlmann launches AnimationPackage

it's a great day for scripted animators and rich internet app developers alike: alex uhlmann has officially released his superb "AnimationPackage" library. with AnimationPackage (AP), you can create programmatic drawings and animation sequences with amazingly little effort.

written entirely in actionscript 2.0, AP provides classes to draw basic primitive shapes (rectange, circle, polygon) and some complex ones (gear, star, rounded rectangle, dashed line, spiral, etc). lines, arcs, and spirals can be animated into place procedurally (so it looks like a pen is drawing them on screen).

as great as the AP drawing toolset is, the fun really starts when you create programmatic, object-oriented animations. you can bounce something across the screen, shake something, blur something, or add a motion tween all with a couple lines of code. you can even move something along a bezier curve or animate a color transformation.

here's all the code you need to move a MovieClip in an arc:

var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc);

or if you're into compactness, its:
new MoveOnQuadCurve(mc).run(100,100,300,300,500,100,4000,Circ.easeInOut);

here's the code you need to shake something back and forth:

new Shake(mc).run(.1,2000);

oh yeah, that's sweet! and if you want to spin the object around after it arrives at the end of the curve or stops shaking, no problem: you can chain animations together using the flexible event handling system (based on grant skinner's "GDispatcher" extension to the v2 EventDispatcher system).

the api has been well thought out, and contains sensible classes like Parallel, which lets you run several animations together at the same time. flexibility and extensibility are evident throughout...for example, the tweening engine itself can be changed, allowing frame-based or time-based animations.

AP even sports thorough documentation and lots of example files so you can see how things work before you try to produce a given effect.

if you've already been messing around with the mx.effects.Tween class or have ever used one of robert penner's easing equations, you *must* look at AP. free some time, sit down for an afternoon, and enjoy the fun. start with this super concise tutorial:

>> read AnimationPackage tutorial

then take a look at the docs and download AP here:
>> visit AnimationPackage home

great respect and thanks to alex for this gift to the flash community...

Posted by moock at 08:39 PM

July 23, 2004

in praise of type checking

if you haven't seen the light of actionscript 2.0's datatype checking yet, here's one little demo to help win you over. there are two errors in the following code. can you spot them?

  private function setText (theText:String):Void {
    var tf:TextField = assetClip.createTextField("t", 
                              assetDepth, 0, 0, width, 0);
    tf.multiline = true;
    tf.wordWrap  = true;
    tf.autoSize  = left;
    tf.html      = true;
    tf.htmlText  = theText;  

if you're a *real* keener, you might have spotted one error: the autoSize property should be a string, as in "left", not left. but you have no way to find the other error: the above setText() method refers to the property "assetClip", but that property doesn't exist because i changed its name from "assetClip" to "asset_mc". i made the change for consistency with other property names in my class, but i forgot to update the setText() method to use the new name. so the above attempt to create a text field fails.

without actionscript 2.0's type checking i might have spent 20 minutes or more trying to fix the above code. with some tests, i would have had to narrow down the assetClip naming problem, then i would have had to figure out why my text field wasn't resizing properly. without knowing the TextField api by heart, i'd probably have spent quite a while figuring out that the value, left, should really be the string, "left".

*with* type checking, the compiler tells me about both of the above errors for free, in less than 1 second. it even tells me where the error is and what went wrong:

**Error** Item.as: Line 50: There is no method with the name 'assetClip'.
var tf:TextField = assetClip.createTextField("t", assetDepth, 0, 0, width, 0);

**Error** Item.as: Line 53: There is no property with the name 'left'.
tf.autoSize = left;

bam. i just saved somewhere in the range of 5-20 minutes tracking down errors. now i can move on with my code and be more productive. all hail actionscript 2.0 type checking.

incidentally, if i had made a typo in the string value "left" above--something like "lfet"--no error would have occurred. the type checker can only report problems with datatypes not with the contents of a string. for that reason, the possible values of TextField.autoSize should really be defined as static properties, such as TextField.AUTOSIZE_LEFT. that way if you specify TextField.AUTOSIZE_LFET the compiler can tell you about your mistake. i'm hoping that in the future the flash player api will move more towards properties and fewer "magic" strings and "magic" numbers (a "magic" value is a hardcoded primitive value that has some important meaning for a class but, despite that importance, isn't exposed formally through a property or method.)

back to the erroneous method. let's suppose i now fix the errors, and the method looks like this:

  private function setText (theText:String):Void {
    var tf:TextField = asset_mc.createTextField("t", 
                              assetDepth, 0, 0, width, 0);
    tf.multiline = true;
    tf.wordWrap  = true;
    tf.autoSize  = "left";
    tf.html      = true;
    tf.htmlText  = theText;  

can you spot the third error? The MovieClip.createTextField() method doesn't return the TextField instance it creates (no matter how much we wish it did!). so the value of tf is undefined when the above method runs. how long would it have taken you to figure that out with simple testing? no matter how fast you are, the answer is "longer than the 1 second it took the compiler". again, because i've specified the datatype of tf as "TextField", the compiler can warn me that createTextField() isn't returning what i expect or want it to. here's how the compiler warns me:

**Error** Item.as: Line 50: Type mismatch in assignment statement: found Void where TextField is required.
var tf:TextField = asset_mc.createTextField("t", assetDepth, 0, 0, width, 0);

man i owe the compiler a beer. here's the corrected, working version of the method:

private function setText (theText:String):Void {
  asset_mc.createTextField("t", assetDepth, 0, 0, width, 0);
  var tf:TextField = asset_mc.t;
  tf.multiline = true;
  tf.wordWrap  = true;
  tf.autoSize  = "left";
  tf.html      = true;
  tf.htmlText  = theText;  

sweet. once you get used to this kind of helping hand, you'll wonder how you ever lived without it.

(if you want more of this kind of discussion, i blab on like this for 500 pages in essential actionscript 2.0...)

Posted by moock at 01:31 PM

July 20, 2004

merriam-webster goes multiuser

the well known free online dictionary site www.m-w.com now has a multiuser feature: it shows you the words that other people are searching for in the dictionary. very interesting study in linguistics and a great exposure of previously hidden ambient user activity on the site.

>> view the multiuser dictionary
>> read some of my thoughts on ambient user activity
>> read some of my thoughts on shared user experiences

Posted by moock at 01:41 PM

July 19, 2004

swift3d v4 released

electric rain has just released the 4th version of its 3d flash tool, swift3d. the little 3d vector tool that could has really grown up over the years, sporting more and more sophistication with each release. i don't know much about 3d but i know what i like...

>> view swift3d info
>> view swift3d feature demos

Posted by moock at 02:39 PM

visidoc for mac released

macintosh users should be pleased to hear that a new javadoc-style actionscript 2.0 documentation generator has hit the market for mac osx.

looks like a decent tool (although i haven't tried it)

>> visit visidoc site

Posted by moock at 01:28 PM

July 11, 2004

smashing ideas seeks flash programmer

andreas heim from smashing ideas just told me that he's looking for a good flash programmer fulltime to create games, apps, and websites. the job is located in seattle...sounds like a super deal; the smashing ideas team is incredible...they've made some of the best games and toons i've seen in flash over the past 5+ years. well worth checking into if you're looking for work and have the skillz.

>> view job posting

Posted by moock at 02:51 PM