AS3 ApplicationDomain misbehaves in subloaded SWF

Tuesday, December 20th, 2011

This post is not meant to be a comprehensive tutorial on Flash’s ApplicationDomain class and how it is used, for that I recommend Senocular’s excellent guide on the subject.  Rather, I just wanted to make a quick note of what I have observed when using ApplicationDomain.currentDomain in a subloaded SWF – that it doesn’t seem to work properly.

When I have a SWF that is loaded into another SWF, and it uses ApplicationDomain.currentDomain.getDefinition to grab a class from its own library, it fails with the following error: ReferenceError: Error #1065: Variable [VARIABLE_NAME] is not defined.  I assume that ApplicationDomain.currentDomain is mistakenly returning the parent SWF’s ApplicationDomain, instead of the child SWF, though I don’t really know why.

So here’s the quick fix, for those of you looking to cut to the chase: instead of using ApplicationDomain.currentDomain in your child SWF, use loaderInfo.applicationDomain instead.  This will explicitly grab the child SWF’s ApplicationDomain, not the parent’s, and your code will work as expected.  Note: I have not tested whether loaderInfo works as expected if your SWF is not subloaded, i.e. if it is the root SWF on the stage.

So to recap – when instantiating dynamic classes in a subloaded SWF, don’t use this:


Rather, use this:


And save yourself the hassle I went through the last day or two!

AS3 for each … in vs for … in

Friday, December 16th, 2011

If you’re like me, remembering which version of the AS3 for … in loop does what is practically impossible.

So here is a reminder:

for each … in

Very simply, the for each … in loop iterates through the values of all properties associated with an object.


var obj:Object = {
  name:"Will Smith"

for each (var prop in myObject){

The above snippet will print the following:

Will Smith

for … in

Conversely, the for … in loop iterates through the name of each property associated with an object.


var obj:Object = {
  name:"Will Smith"

for (var prop in myObject){

The above snippet will print the following:


Hope this helps clear up some confusion!

Flash AS3 Component CellRenderer Styles

Friday, July 1st, 2011

Adobe’s documentation for their components sucks. I spent hours the other day figuring out how to style the cells in a ComboBox. I figured I’d post the solution I found here, to save myself and others future grief.

iPad lockdown

Saturday, June 11th, 2011

This is my first post from an iPad. No, not mine, but my uncle’s. I’m visiting family in Texas and my grandparents and several aunts and uncles and cousins flew up from Hawaii so it’s kind of a bit of a family reunion. I am actually faster on my iPhone’s smaller touch keyboard. Typing with multiple fingers on a keyboard with no tactile response will take some getting used to.

What a crazy world we live in, always-connected and always-on. I have been going through internet withdrawal this week cuz my mom doesn’t have a home internet connection. I’m writing this post from a mobile touchscreen computer, on a mobile wifi hotspot, from the car, while en route to the beach.

And yet some things about this device are so locked down it feels like a step backward. The iPad doesn’t have a file system I can use, doesn’t let me upload or download files, and I can’t save pictures to it to upload unless I connect it to a different computer. As a result, I can’t add any pictures to this post. I’m connected, but still feeling the withdrawal.

April Fools Fun

Thursday, April 7th, 2011

Well, I had some fun this April Fool’s.  I pulled off a successful prank for the first time in I-don’t-know-how-long, and possibly forever.  I’ve never been much good at pranks, as I have troubles being convincing, and troubles not giving it away.

Not this time (he he he). (more…)

The descent of the RIAA into madness

Friday, January 7th, 2011

Oh man.  The Tunecore blog just posted an article that blew my socks off.  I’ve had distrust of the RIAA growing in my heart for the last few years now, as I’ve watched them do the unthinkable, like spend $64 million suing their own customers.  This article so eloquently described how the RIAA has sunk from an agency that started off protecting and promoting artists to one who now blames  them for the demise of the traditional music industry.  If you have anything to do with the music industry, you have got to read it.


apple, eat your heart out

Friday, October 15th, 2010

Ok, this is freaking amazing.  In the video below, the band Atomic tom is playing one of their hit songs…. on the train… with nothing but 4 iPhones!  And it sounds seriously aMAZing!  You gotta check it out! I love it when musicians get creative – I want to buy their album based on this video alone!

If you want to see the original live recording of the song, you can see it here.

Flash Player 10 maximum bitmap size

Monday, September 27th, 2010

ActionScript 3Did you know that Flash Player 10 cannot handle bitmaps larger than roughly 8,000 pixels on a side?

Technically, the hard limit is 16,777,215 total image pixels, with a limit on each dimension of 8,192 pixels.  This information I obtained only after much Googling and is only available in an obscure Adobe tech note. (more…)

3D MovieClips with Flex and ActionScript 3

Tuesday, September 7th, 2010

ActionScript 3For whatever reason, tonight my brain will not shut up, even after hours of watching Hulu.  So it’s time to share some of what I learned today.  Attention, non-geeks – this will be quite a technology-heavy post.  But there will be pretty pictures.

Flash has had the ability to do 3D for quite some time now, natively, without using any of the fancy libraries out there like PaperVision3D.  All you have to do is set the z property on a MovieClip.  Seriously, that’s all it takes.  And you know how you can rotate a MovieClip by setting the rotation parameter?  Now there are rotationX, rotationY, and rotationZ parameters.  Changing any of these through code will result in the MovieClip being displayed in three dimensions.  Groovy! (more…)

how to get GPS directions via text message

Tuesday, August 10th, 2010

Google mapsHere is the coolest tech thing I’ve learned recently: you don’t need a GPS unit, an iPhone, or even data plan on your cell phone to get GPS directions without a computer! Google has an amazing text-message interface that can return everything from web results to business phone numbers to directions to your phone via SMS.

Here is what you do: (more…)

why does OSX Finder Copy suck?

Thursday, August 5th, 2010

Okay, this post is a total rant.  I am fed up and frustrated trying to back up data on my PowerMac G5.  The fundamental question has been raised in the post’s title, namely:

Why does the copy functionality of the Finder suck so badly?!?! (more…)

The Evolution of PC Audio

Thursday, May 20th, 2010

Check out the following video for a tour through the history of game audio on the PC. Music courtesy of “Secret of Monkey Island.”

weak password woes

Sunday, January 31st, 2010

Passwords are still too weak for the most part.Well, here we are in the 21st century – the second decade of the 21st century, even, and Internet security, specifically the problem of weak passwords, still plagues our society.  A new study, based on analysis of 32 million passwords, shows that the most popular password is – can you guess? – “123456″.  One in five users leaves a key under the virtual doormat with obvious passwords like “qwerty”, “password”, “iloveyou”, or “princess”!  (original story here).

Why is it that we can’t pick secure passwords?  It seems it’s just human nature.  A password that is secure is, by definition, hard to remember for a human.  Here are five tips that will help your passwords remain secure. (more…)

what does bing stand for?

Friday, January 15th, 2010


‘Nuff said. (link to original image)

why chrome is my new favorite browser

Sunday, January 10th, 2010

Recently I started using Google Chrome. I downloaded it, tested a few things, and before you know it I was using it every time I wanted to go online, leaving my old standby FireFox unused and un-clicked.  I will attempt to organize the reasons for my switch into a bulleted list below:

  • It’s fast. You open the program, it displays.  The quicker I can get to my webpages, the quicker I can get to work.
  • It maximizes screen real estate.  I hate having my usable browser area cluttered by a bunch of toolbars I don’t want that came bundled with other stuff I did want. (Internet Explorer, I’m talking to you).  Chrome even goes so far as to use the top window bar (which is normally not used for anything except the program’s name and window controls) to put my tabs in when maximized.  I love that!  Every little bit of usable screen real estate helps when developing websites on my small laptop screen and I appreciate having those 20 or so vertical pixels back.
  • It comes with great developer tools.  FireFox has an add-on called Web Developer that I truly love for debugging websites, especially CSS.  But the built-in developer tools that come with Chrome blow it out of the water!  You can change CSS properties on any element and watch how the rendering changes, without re-uploading the CSS file.  And you don’t have to download an add-on to do it.  While I was writing this post, I used the real-time CSS modification abilities of Chrome’s developer tools to fix a problem with my WordPress theme that was chopping off the title of my posts if they got too long.
  • Did I mention it’s fast?
  • It’s simple.  It shows me what I need, and hides what I don’t.  It doesn’t bury clearing the cache in some tab in some dialog box, under the heading Temporary Internet Files (again, IE, I’m talking to you).
  • It has all the keyboard shortcuts I loved in FireFox and had gotten used to as a Web Developer.  Things like CTRL+SHIFT+DELETE to clear cache and cookies (essential for web development), CTRL+T for a new tab, CTRL+SHIFT+T to re-open the most recently closed tab (handy when you just closed something and realized you weren’t done with it yet).
  • Did I mention it’s fast?

Anyway, that’s all I can think of for now.  The list is in no particular order, and is not terribly thorough, but there you have it – my unofficial list of why Google Chrome beats the pants off of any other browser out there.  I still keep the other browsers installed on my machine to make sure the CSS I’m crafting works across browsers and doesn’t break my nice site layouts, but as far as day-to-day heavy lifting goes, Chrome is my new best friend.

kodak easy share nightmare

Tuesday, January 5th, 2010

Attention, Kodak EasyShare Wireless Digital Picture Frame users! Kodak has made it extremely easy to share what’s on your picture frame with everyone on the internet! Each picture frame has a unique RSS feed that includes its MAC address, and the frames have wi-fi capability built-in, so anyone on the Internet that has your feed URL can see ALL the pictures on your picture frame. There is even a chance that someone could modify the RSS URL of your picture frame and load pictures of their choosing on it – even before it gets out of the box. Read the original post here. Kodak, you need to think the security implications of a wifi-enabled digital picture frame before releasing it to the public!

spell with flickr

Monday, November 16th, 2009
chocolate letter H letter E letter F letter T E white paint on blue with rust coming through L
F letter A M. i letter L Y

Cool, huh? Click on this link to spell your message with random pictures from flickr!

ransom note generator

Monday, November 16th, 2009

I was noodling around on the ‘Net and found a ransom note generator. Enter your text, and it creates a ransom note! How cool! You can go to the link to the original site, or enter the text to create a ransom note from here:

on yellow paper?   on plain paper?

welcome to my life

Monday, August 24th, 2009

This XKCD comic made me laugh out loud, in the middle of the workday, in the middle of the office. I relate to this so much it’s scary:

XKCD Tech Support

Here’s a link to the comic on the original page.

ipod touch musings

Monday, June 15th, 2009

This is my first blog post from my iPod touch. I find that typing on the small keyboard takes longer than a normal keyboard, and the lack of tactile response makes it easier to have all sorts of weird typos. The auto-complete function works fairly well for common words and common typos, but you still have to verify that the iPod software didn’t screw you over while trying to be helpful and user-friendly. Still, the thought of posting to my blog from a handheld device is decidedly cool, and makes my inner techno-geek drool. I got bored in church today and wrote a letter to my Latvian buddy Artjom – in Cyrillic characters, from the iPod. That, I have got to admit, is cool. It even had limited auto-correct in russian! In the iPod/iPhone 3.0 software I would like to see a much better Russian dictionary for auto-complete.

While on the topic of the iPod, I wonder why the included safari browser doesn’t allow you to download files from the web. I mean, I have an iPod that can surf the web, and I can’t download music to it from a server I own, nor can I download pictures to it unless I email them to myself. That is quite annoying!! I haven’t checked to see if I can email myself mp3s and download them to the iPod – I’ll have to try that and get back to you.

All in all, though, the iPod touch is an incredible piece of hardware and software. I mean, it beats the computer I first learned to program on at the tender age of 11 in every aspect, from memory to processor to storage. Plus it connects to wi-fi, plays mp3s and video, has a touchscreen, and a better display than what I used to use in my games back then (I started programming games I’m mode X – 320 by 240 graphics, 256 colors). And did I mention it fits in the palm of my hand? We do indeed live in a marvelous world.