Category Archives: Blog

AS3 Pitfalls – Cross-Domain BitmapData

We’ve been linked to by a fellow agency called Airtight Interactive on the subject of altering cross-domain bitmap data in Flash. They mention the server-side proxy work-around that i’ve used, calling it “prohibitive” for large-scale apps. That was the concern i raised when a casual games publisher approached me to ditribute Jigsaw! across its extremely high-traffic game portals.

Untold Entertainment’s advantage is that we do not bear the bandwidth costs that the jigsaw game’s Custom image feature may bring down like so much Biblical wrath. There are ways to mitigate the cost, which i’ll discuss after posting the solution.

(Click to read about Adobe’s rationale for preventing cross-domain image manipulation in Flash.)


Images loaded into a Flash swf from another domain (ie, won’t respond to BitmapData methods like draw().


Flash needs to see that the image comes from your own domain. To pull this off, you set up a server-side script and pass the image url to it. The script loads the image to your domain, and returns that image to Flash. Since the image comes from your domain now, you can mess around with it all you like.

The script i use is written in PHP. Here it is, at its most basic:

There are some clear problems with this approach:

1. Since your server has to load the image, you carry the bandwidth cost for trafficking that image. i consider this the cost of doing business. If you want to offer a cool feature like custom player-created jigsaw puzzles, you have to pony up the cash.

And then, logically:

2. Some malicious user could set up a script to repeatedly pass enormous images through your server every second of every day, putting you in the poorhouse, or forcing your provider to shut your site down. This is best handled by adding limits to the script. Prevent users from loading images above a certain filesize, and limit the number of script calls per user.

More Cool Software from D’Accord

i just received a friendly note from D’Accord Music Software:

Dear Folks of Untold,

We´ve seen the post about iChords and Sheet Happens! Thanks for the nice words about our software.

We just released a gadget called iChords Gadget, you might find it useful.

iChords Gadget

Find chord fingerings quickly with iChords Gadget – Ed.

If you’re instereted in learning more about music software, we have an open source project, Free Clef (, a multiplatform notation editor.


Freeclef – Free music notation software. Take that, Cakewalk. – Ed.


Américo Amorim

Getting this email was like being beaten fair and square in a wrestling match, and after shaking hands, my opponent comes back and gives me a few kicks to the ribs. Oh well … all’s fair in love and software development.

Sheet Happened!

Sheet Happened!

i’m not above profiling the mistakes i make as i bring my new business to its feet. It’s possible some of you are budding entrepreneurs planning to follow the same path. So here’s my hot entrepreneurial tip of the day: DO YOUR RESEARCH.

Two months ago, i hunkered down to learn Actionscript 3, and i needed a project to practice on. i chose Sheet Happens!, a hobbyist sheet music app that allows you to transpose the chords in a Notepad-like environment. A good long while into production, i thought “Hey … i wonder if there’s anything like this on the market?”

As it turns out, there is one teensy tiny product out there called iChords. It doesn’t do exactly the same thing as Sheet Happens!. You can actually feed it an MP3, and iChords will dynamically “listen” to the song and display the chords as the song plays.


iChords: 8000% better than Sheet Happens!

If Sheet Happens! is a car, iChords is a spaceship that transforms into a robot that eats cars for a mid-day snack.

To add insult to injury, iChords ships with D’Accord Chords Notepad, which looks exactly like Windows Notepad, with two extra menu additions: Transpose Up, and Transpose Down. That’s right – not only does iChords have a far better feature set than Sheet Happens!, it actually replicates the entire Sheet Happens! feature set as a footnote.

Sheet Happens! was also an excuse to launch an Adobe Integrated Runtime (AIR) app, which integrates Flash with the user’s desktop. This brings up a second, equally excellent tip for small business owners: start with what you know. Untold Entertainment Inc.’s bread and butter is making Flash games, deployed to the browser. i haven’t heard a lot of demand for AIR apps, but i thought we could be on the bleeding edge. The trouble with that is after two months, Untold Entertainment’s games library stays the same size, and we have this music software anomaly that probably won’t interest our core clients.

All told, developing Sheet Happens! wasn’t a complete waste of time. i have a much better handle on AS3 now, and will be periodically posting SNAFUs and programming tricks to help anyone else transitioning from AS2 to AS3.

i recently had to step back into old Actionscript 2 code, and it was like sliding my foot into a well-worn, mildewy sports sock where the sweat dried and mummified the sock into the shape of my foot. i was amazed at how quickly and easily i could program in AS2. i almost closed my eyes as i typed, and the code just flowed out of me. Contrast that with AS3, where i have to pay careful consideration to each line, and every time i compile i get a truckload of errors.

i worry that delving into my old code will undo all of the AS3 training i’ve done. i need to limit my exposure, like an 8-year old sneaking tiny glimpses at the sun, wondering how long it’ll be before he goes blind.

iChords can be purchased for an amazingly low price at finer download sites everywhere. Sheet Happens! can not.

AS3 Pitfalls – TextField.setSelection not working


TextField.setSelection doesn’t select any text!


Set the stage.focus property to your TextField object.

// Selects all the text in myTextField:
myTextField.selectable = true;
myTextField.stage.focus = myTextField;
myTextField.setSelection(0, myTextField.text.length);

Other search terms:
setSelection not working
setSelection not responding
setSelection broken
setSelection bug
setSelection buggy

Wildfire 2 launches on

My good friend and talented colleague Mark Duiker has just launched his latest game, Wildfire 2:


Help! My adorable cottonpuff tail is on FIYYYURRR!!!


It’s like Lunar Lander with cute furry forest creatures (and some kind of alligator). Don’t worry – if you haven’t played the first Wildfire game, there aren’t any plot points you’ll need to know.