Archive for October, 2006

An Awakening to Design Patterns

Sunday, October 29th, 2006
General

Earlier this month, I spent a week in Maryland working with Branden Hall at his Automata Studios.  The trip was a chance to get to know each other better, and we both had a great time.  We coded during the day, played Guitar Hero in the evenings, and discussed all sorts of geek topics in between.  Oh, and we had terrific food every day!  ;)

I often played with Branden’s toddling son, Kai, who on more than one occasion conferred on me his “Harrison Ford grin” (mom Pattie called it that, and gosh, she’s right!).  The whole experience was very welcoming and down to earth.  I’ll be contracting for Automata Studios on a regular basis.  Keep reading »

Things I’ll Forget If I Don’t Note Them Now

Thursday, October 26th, 2006
Meridian

Meridian is at a terrific age.  People speak of the “terrible twos,” and while she does occasionally throw a tantrum, I’ve decided the term is either an urban legend, sour grapes, or something I’m gratefully oblivious to.  Heck, I throw a tantrum now and then myself.  ;)

The truth is, we have a wonderful relationship, unique among any I’ve had.  Although it encompasses a number of facets, it mainly feels like friendship, but at a deeper level of trust than most.  Above all, it is preciously innocent.  Meridian makes me feel like Christopher Robin, while she alternates among the various characters at Pooh Corner.  Keep reading »

Is the MovieClip.onLoad Event Broken?

Tuesday, October 24th, 2006
ActionScript 2.0

Documents like Jen deHaan’s ActionScript 2.0 Best Practices (page four, in particular) recommend against attaching code directly to objects.  Generally speaking, I’m in enthusiastic agreement (see “Museum Pieces:  on() and onClipEvent()”).  Most events in AS2 are easy to handle, but MovieClip.onLoad is something of an oddball.  Before I understood that it needs to be treated differently from the others, I was stumped as to why it “didn’t work.”  (Hint:  It does work, but not the way most people expect.)  Keep reading »

Carbon Dating ActionScript

Friday, October 20th, 2006
ActionScript 2.0 Flash

There are thousands of ActionScript code samples online.  Thousands.  Google will conjure them from the ether within seconds, and any one of them might just suit your needs.  But there’s often a problem, one I’ve seen knock the wind out of a developer’s sails.  The problem is, any particular code sample may be outdated.  That doesn’t necessarily mean it will fail, but then again.…  Keep reading »

How to Control Video (FLV) without a Component

Tuesday, October 17th, 2006
ActionScript 2.0 Flash

This earlier post, “How to Load External Video (FLV),” is one of the most popular on this blog, judging by the number of comments.  Just the other day, someone named Enrique thanked me for the sample code, but asked if there was a way to control the FLV file once loaded, since the file is handled without the use of the Media or FLVPlayback Components.  It’s a good question, so let’s take a look at how to accomplish the goal.  Keep reading »

Handling Cue Points for Audio Files in ActionScript 2.0 and ActionScript 3.0

Monday, October 9th, 2006
ActionScript 2.0 Flash

Video has enjoyed a well-deserved spotlight lately in the Flash arena, in part because Google Video, YouTube.com, and Yahoo! Video all use the FLV file format.  Among other conveniences, the FLVPlayback Component makes it easy to incorporate cue points for synchronized endeavors, such as closed captioning.  Accolades are certainly in order, but let’s make sure not to forget good old MP3s.  :)   Audio presentations can be just as cool, and if you want cue points for those, you can either use the older Media Components — or you can add the functionality yourself (in ActionScript 2.0 or ActionScript 3.0!) as described in this Adobe Developer Center article:

http://www.adobe.com/devnet/actionscript/articles/cue_points_audio.html

Choosing Random Numbers Redux

Friday, October 6th, 2006
ActionScript 2.0 Flash

I goofed in my last post about choosing random numbers, so let’s take another look.  Big thanks to NSurveyor, by the way, for pointing it out!  In converting floats into integers last time, I used the static Math.round() method.  In the context of ensuring that a random choice is made with equal probability, there’s a subtle (but important!) distinction between rounding with Math.round() versus rounding with Math.ceil() or Math.floor().  I think a diagram will help.  Keep reading »

Choosing Random Numbers

Tuesday, October 3rd, 2006
ActionScript 2.0 Flash

NOTE:  This article has been updated here, due to errors discovered by NSurveyor.

ActionScript 1.0 and 2.0 provide two ways to pull a random number from thin air:  the random() function and the static Math.random() method.  Of these, the random() function is the older (available since Flash 4) and is the “easier to use,” according to a number of developers.  But keep in mind, it’s not the officially recommended way to go.  Keep reading »