joshbuhler.com

Tag: ActionScript

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?

(continue reading…)

Leave a Comment :, , , , more...

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.

waterfall.png

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.

5 Comments :, , , , , , , , more...

Kill Those Timeouts

by Josh on Jul.01, 2008, under Flex

beachball.png
If you’re working on a project that’s prone to timing out on you, and throwing those “A script has executed for longer than the default timeout period of 15 seconds” errors, here’s a quick tip for you until fix the bugs causing the timeout.

Just set the scriptTimeLimit attribute of your <mx:Application> tag to a smaller value, like 3 seconds. That way you won’t need to wait around for a while waiting for your app to crash so you can get back to debugging the problem. It’ll crash in about 3 seconds instead of 15, or even a full minute later.

Obviously, the ideal solution is to fix the bug causing the timeout, but while you’re debugging, this should help to ease the pain a little bit.

LiveDocs: http://livedocs.adobe.com/flex/3/langref/mx/core/Application.html#scriptTimeLimit

Leave a Comment :, , , , more...

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.

2 Comments :, , , , , more...

Footnote.com is Hiring a Sr. Flash Developer

by Josh on Feb.15, 2008, under Random

Footnote is currently looking for a Sr. Flash Developer. This person will be responsible for the architecture, maintenance, and implementation of new features for Flash-related content on Footnote.com, including our Document Viewer.

Qualifications

  • Must have experience using Flex 2 and ActionScript 3.0
  • Work closely with the design team, and implement Flex skins based on design comps
  • Strong understanding of OOP techniques
  • Experience using XML in ActionScript
  • JavaScript and PHP skills strongly recommended
  • Understanding of and experience in Agile programming methods recommended
  • Technical writing skills and the ability to document code appreciated

Salary Range:
Unspecified

Application Instructions:
Please email a copy of your resume and a cover letter to Scott Jackman - sjackman[AT]footnote.com

Leave a Comment :, , , more...

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.

(continue reading…)

Leave a Comment :, , , , , , more...

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.

2 Comments :, , , , , more...

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.

1 Comment : more...

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.

2 Comments : more...

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:

  1. trace ("myVar: " + myVar); // outputs value of myVar
  2.  
  3. if (somethingGood) {
  4.         trace ("something good just happened!");
  5. } else {
  6.         trace ("Houston, we have a problem!");
  7. }

Well, now in AS 3.0, trace() has been modified to allow multiple parameters! What's so cool about that? Well...

Instead of this:

  1. trace ("user name: " + lastName + ", " + firstName);

you can do this:

  1. trace ("user name:", lastName, firstName);

Or, simply output a list of variables all at once instead of using multiple trace() calls:

  1. trace (address1, city, state, zip);

Not exactly earth shattering, but it's definitely a welcome addition to ActionScript.

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...