Archive for June, 2006

Understanding Classpaths

Friday, June 30th, 2006
ActionScript 2.0 Flash

All objects in recent versions of ActionScript are defined by something called classes.  Think of classes as blueprints that determine the unique combination of characteristics, actions, and reactions that comprises a particular object of a certain type.  By “object,” we’re talking about the familiar things a Flash developer deals with every day:  movie clips (the MovieClip class), text fields (the TextField class), buttons, sounds, math functions, UI Components, you name it.  They are all defined by classes.

Out of the box, Flash provides hundreds of built-in ActionScript classes.  The great part is, you can even write your own!  But there’s a catch:  the Flash compiler, which converts ActionScript into Flash Player bytecode, must be told where new classes are located, or it won’t be able to find them.  That’s what my latest Community MX article is about, and this one happens to be free content.  You can read it here:

Museum Pieces:  on() and onClipEvent()

Wednesday, June 28th, 2006
ActionScript 2.0 Flash

ActionScript has evolved by leaps and bounds in the last few years.  The commercial release of Flex 2.0, and the public release of Flash Professional 9 ActionScript 3.0 Preview, in particular, nudge ActionScript 3.0 that much closer to the world in which we Flashers live.  The less-than-adventurous (nothing wrong with that!) won’t see AS3 until the commercial release of Flash 9 — still a long way off, as of this writing.  But when that does happen, our world will change.  That really isn’t an exaggeration.  There will be those who code in AS1/AS2 — there will still be plenty of room for that — and those who code in the jaw-droppingly more complex AS3.  The Flash 9 Player, already upon us, now features two virtual machines:  one that displays Flash 8 and prior content, and one that displays Flex and Flash 9 content.  That’s a first.

And yet, there’s still an awful lot of on() and onClipEvent() going on out there.  Is that so terrible?  Well, those event handling mechanisms were introduced in Flash 5.  In spite of their age, they haven’t been formally deprecated, so they’re perfectly “legal,” strictly speaking.  I can even muster a pragmatic smile for anyone who strongly feels that “if it ain’t broke, don’t fix it.”  But honestly, dot syntax event handling offers more control than that directly applied to the object.  Not only that, but the newer approach lets you organize your code into one place.  Let’s take a look.  Keep reading »

Anti-spam Has Been Turned On

Sunday, June 25th, 2006

Just a quick note.  I just turned on the Akismet anti-spam plug-in for WordPress, the software that manages this blog.  My intent, of course, is to reduce the time I spend filtering out the stuff by hand.  I very much appreciate feedback and comments from real people, so keep at it!  I’m always happy to converse with fellow developers who have meaningful replies or questions about Flash and the other topics discussed here.

Akismet is supposed to be pretty good, so I hope it doesn’t delete any genuine comments.  If it deletes yours unfairly, please write to me personally (my last name at this domain), and we’ll keep the dialogue going.

How to Trigger ActionScript with Text Field Hyperlinks (AS2)

Friday, June 23rd, 2006
ActionScript 2.0 Flash

Flash makes it very easy to turn ordinary text fields into hyperlinks. Sure, it can be done programmatically with dynamic text fields and ActionScript, but it can also be done with plain vanilla static text fields:  just select a text field (or words in it) and enter the desired URL into the Property inspector.  It’s the field at bottom center of that panel — not labeled, but you’ll see “URL link” in a tooltip when you hover over it.

What isn’t immediately obvious is that you can also trigger functions with that URL link field.  Why would you?  Well, maybe you want something to spin around on the Stage before your hyperlink opens a URL, or heck, maybe you don’t want to visit a URL at all, but instead, send the timeline to another location.  Here’s how to do it.  Keep reading »

Launch Windows Explorer to a Folder You Choose

Tuesday, June 20th, 2006
Quick Tips

I re-discovered this tip the other day when I was setting up my new laptop.  By default, shortcuts to Windows Explorer launch the app and point it to the My Documents folder.  In fact, double clicking explorer.exe does the same thing.  I suppose that’s fine for default behavior — I actually do like to keep a shortcut poised to open My Documents — but I also like to launch into my c: drive.  Is there a quick way to do that?  You betcha.  Keep reading »

Sending Email from Flash (mailto:)

Monday, June 19th, 2006
ActionScript 2.0 Flash

Sooner or later, you’re going to want to send email from your SWF.  There are at least two basic ways to accomplish this goal:  the mailto: protocol and a server-side form mailer.  Between the two, the server-side approach is the safer bet.  The reason is because mailto: requires that the user has email software installed — and that this software be configured as the user’s default email handler.  For most home and office users, this might be Outlook, Outlook Express, Thunderbird, Eudora, etc., the list goes on.  Using mailto: in Flash is essentially no different from using mailto: in the href attribute of an anchor tag (a element) in HTML.  It’s certainly an acceptable enough approach, but keep in mind, many people access the Internet through their local library, which means they may not even have email software installed, much less configured for personal use.  So, now that the disclaimer has been stated, let’s see how to use mailto: in cahoots with getURL() to send email from Flash.  Keep reading »

Catching Up

Sunday, June 11th, 2006

On a scale of one to ten, I’m on cloud nine.  Things are unbelievably great.  :D   Frankly, I’m a bit stunned since my first day of working full time from home, which started last Wednesday.  The first four hours, in fact, were a bit rocky.  Not to be trite, but I had this Big Change staring me in the face — “the first day of the rest of my career” — and I found myself in the unusual circumstance of not knowing where to begin.  I had spent two days carting home all my stuff from DSI — computer equipment, coffee mugs, knick-knacks, game boards, reference books, notes, email addresses, phone numbers; it goes on and on and on — and hoped to have everything settled by Wednesday.  Everything organized, everything put away; a clean, orderly desk.  Not so.  I ended up working four hours that evening to make up for my slow start.  So far, all the plates are still spinning.  Keep reading »