ActionScript
Speaking at 360|Flex
by Josh on Feb.03, 2009, under ActionScript, Flex, News

I just found out this morning that I’ll be speaking at 360|Flex Indy in May! I’ll be speaking on using Events, and how to do more with them beyond the basic addEventListener() call that we all know and love.
Luckily, I just checked out the schedule, and I get to present on the first day, right after the keynote, so I can get my session out of the way, and enjoy the rest of the conference, stress free.
You can check out the schedule for the conference and see who else will be there, and what there presenting here: http://360conferences.com/360flex/downloads/schedule.pdf
If you’re thinking about going, you’ll want to register ASAP, as the tickets are cheaper on a first come, first serve basis. So register at http://360flex.eventbrite.com now to get the best possible price.
Now, in case you’re curious, here’s the session description I submitted:
Working with Events in Flex and ActionScript 3.0 is something that we all do on a regular basis - but do we really know how to take advantage of everything that the Event flow in AS3 has to offer? What are the different phases of an event’s life? What exactly is an Event’s priority? This session will cover the life of an Event - how to create one, listen to it though various stages of it’s life, and if needs be, kill it without mercy. We’ll also cover creating your own custom events, and how to clean up after yourself when you’re done using an Event.
See you in May!
Pop Quiz on Static in AS3
by Josh on Jan.28, 2009, under ActionScript, Development, Flash, Flex
Pop quiz: In AS3, are static methods & variables inherited by subclasses?
Flash Waterfall Bitmap Effect
by Josh on Jul.03, 2008, under ActionScript, Flash
I saw this effect a long time ago, and wanted to use it in a project, but after about ten minutes of searching for the original, I gave up and just decided to make my own.
Click on the image above to view it in action.
This is just a basic bitmap effect that uses BitmapData to draw an image, with the pixels spilling down from the top in a waterfall-type effect. The fun thing about this is that since the source of the effect needs to implement IBitmapDrawable, you can supply just about anything as the source. In the example below, select “This Panel” to watch the options panel be redrawn. The end effect is that each individual piece of the panel is “beamed down” on it’s own. The “Flow” image is another favorite of mine.
The ’speed’ option is simply the number of milliseconds used in the Timer to execute the effect.
Source is also provided, just right-click on the example to get it.
Anti-aliased Device Fonts in Astro
by Josh on May.20, 2008, under ActionScript, Flash
By now you’ve seen and heard plenty about Flash Player 10. One feature that I’m in love with right now is the new text rendering provided by Saffron 3.1. Among other things, this provides better anti-aliasing for fonts, including device fonts.
Why does this matter? Because now you can use device fonts in your TextFields, and do things like adjust their opacity, or rotate them without needing to embed the font. How sexy is that? Obviously, if you’re using a custom font, you’ll need to embed that, but for device fonts, it’s no longer a requirement just to adjust the alpha value of a TextField.
Check this out (You’ll need Flash Player 10 installed).
Download the source: AstroTest.as.
This is a really simple demo, but it’s enough to get the point across.
Comparing Objects Using ByteArrays
by Josh on Feb.11, 2008, under ActionScript
There have been plenty of times in projects where I’ve wanted to compare two objects to see if they are equal. I don’t really care if they are the same object, all I care about is if they are identical - meaning that they could be two unique objects, but that the values of their properties are equal to each other.
Flex Builder Cheat Sheet
by Josh on Oct.08, 2007, under AIR, ActionScript, Flex
Sure, there are several places out there where you’ll find this information, but nothing really in an easy-to-print form you could hang on your cube wall.
This list is far from comprehensive, but it’s a list of the ones I use most often, and find the most useful. There’s a reason I made the first one on the list “View all Shortcuts”.
As I’m a Mac user, the shortcuts are for the Mac version of Flex Builder, but I would assume that you Windows folks can just use Ctrl instead of the Command key.
Here’s a nice PDF, ready for printing: FlexBuilderShortcuts_MAC.pdf
If there’s something you really feel strongly about me having left off of the list, let me know in the comments, and I’ll add it to the list.
FlexExamples.com is Stalking Me
by Josh on Sep.13, 2007, under ActionScript, Flex
If you’re a Flex dev, and haven’t checked out FlexExamples, you need to.
Run by Peter deHaan, each day he posts several simple code examples ranging from skinning components to manipulating Strings. The great thing is that each example is fairly short, and to the point. No long-winded explanations, just a short explanation, followed by sample code.
How is Peter stalking me? For the last two weeks, it seems like every time I run into an issue with my code where I’m stumped, and am having problems finding a solution online, within about 15 minutes my RSS reader pops up with a new post from Peter, that contains the solution to my problem.
Seriously Peter, where are you hiding? My cube isn’t that big.
SoundMixer.computeSpectrum woes
by Josh on Sep.11, 2007, under ActionScript
For a new AIR project I’ve been working on I wanted to include a chromatic tuner as a feature. That would be awesome, right?
While working on this feature, I’ve been doing some research into how exactly you even go about determining pitch using code, and have been playing with the SoundMixer.computeSpectrum() method lately. Unfortunately, that’s not looking like it’s going to be a possibility, as apparently the sound info from a microphone or line input isn’t available to the SoundMixer.
From the liveDocs
Because sound data from a microphone or from RTMP streams do not pass through the global SoundMixer object, the
SoundMixer.computeSpectrum()method will not return data from those sources.
Bummer.
Hopefully this can be changed in future versions of the Flash Player.
Using trace() in ActionScript 3.0
by Josh on Aug.27, 2007, under ActionScript, Flash, Flex
The global trace() function is probably the simplest, and most useful methods of debugging that ActionScript developers have. Usually, it's used to output the value of a variable or to broadcast out a little note that some event occurred. Most people use it something like this:
-
trace ("myVar: " + myVar); // outputs value of myVar
-
-
if (somethingGood) {
-
trace ("something good just happened!");
-
} else {
-
trace ("Houston, we have a problem!");
-
}
Well, now in AS 3.0, trace() has been modified to allow multiple parameters! What's so cool about that? Well...
Instead of this:
-
trace ("user name: " + lastName + ", " + firstName);
you can do this:
-
trace ("user name:", lastName, firstName);
Or, simply output a list of variables all at once instead of using multiple trace() calls:
-
trace (address1, city, state, zip);
Not exactly earth shattering, but it's definitely a welcome addition to ActionScript.
Flex Builder 2 Cheat Sheet
by Josh on Jul.18, 2007, under ActionScript, Flex
Sure, it's from last year, but I just found it the other day, and I love it. David Zuckerman has compiled a short list of shortcut keys in Flex Builder 2 that you should check out if you work with Flex Builder.
It's by no means a comprehensive list, but there's some good stuff in there. The "Quick Outliner" has already saved me a bunch of time, and the "Organize Imports" feature is great as well.
Link: http://davidzuckerman.com/adobe/2006/10/27/flex-builder-editor-cheat-sheet/
