AS3 ApplicationDomain misbehaves in subloaded SWF

December 20th, 2011 by Kawika Heftel

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

December 16th, 2011 by Kawika Heftel

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!

“Kings that Died” by Brannon Heftel

November 16th, 2011 by Kawika Heftel

We recently recorded this awesome, original song by Brannon Heftel at the studio! Check it out:

Ira Glass on Creativity

September 28th, 2011 by Kawika Heftel

Best quote on creativity I have heard in awhile, possibly ever.

Flash AS3 Component CellRenderer Styles

July 1st, 2011 by Kawika Heftel

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.
Read more…

iPad lockdown

June 11th, 2011 by Kawika Heftel

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.

Nelson Mandela is a stud

May 24th, 2011 by Kawika Heftel

Our deepest fear is not that we are inadequate. Our deepest fear is that we are powerful beyond measure. It is our light, not our darkness that most frightens us. We ask ourselves, Who am I to be brilliant, gorgeous, talented, fabulous? Actually, who are you not to be? You are a child of God. Your playing small does not serve the world. There is nothing enlightened about shrinking so that other people won’t feel insecure around you. We are all meant to shine, as children do. We were born to make manifest the glory of God that is within us. It’s not just in some of us; it’s in everyone. And as we let our own light shine, we unconsciously give other people permission to do the same. As we are liberated from our own fear, our presence automatically liberates others.

-Nelson Mandela

On change

May 21st, 2011 by Kawika Heftel

They say “nothing in life is more constant than change.” Life is basically one long string of adjusting to changes that happen, through our own choices or through others’. In the last almost-a-year, there have been a ton of changes in my life. I have basically re-built my life from the ground up, after the nuclear bomb of divorce shattered it. All my old patterns and habits disappeared in the aftermath, and I was left a shell of my former self. I found myself actively clearing away the rubble of lost inside jokes, habits that were never me, traits that I’d picked up to keep the peace. I found myself asking the question, over and over, “but who the hell AM I?”

I’m still working on that question, but I feel I have come a long way in ten or eleven months. I still have a long way to go, but I feel in some measure like I’m healing, and somewhat adjusting to my new life. All the old has been stripped away, and some of it has been replaced by new. Some of it is still in-progress. There is one difference – I live for ME now. One thing I never quite got down while married was how to live for another without losing yourself. How to live for the new team you’ve created. I think it’s because I never knew myself to begin with. This made me impossible to live with, because I tended to chameleonize to match my surroundings. I still have a ways to go, but I know now somewhat who I am, and I am done apologizing for it. I need to find someone who will accept me the way I am, a music and computer geek, because nothing’s gonna change that. And trying to be someone you’re not never brings peace. As Shakespeare said, “to thine own self be true.”

I’m not saying I don’t need to try and improve myself – on the contrary, I am just as focused on self-improvement as I was when I was perfectionistic and saw everything in black and white. The difference now is that I accept where I am, no matter how low that might be, and I work from there. You have to start from where you are. Shaming yourself won’t change anything; it will just keep you stuck where you don’t want to be.

I’m done apologizing for who I am. I am done hiding under a bushel, so to speak, in hopes that I will fit in with the crowd, in hopes of looking “normal”. Normal is overrated! Being myself is much more fun.

It’s not like there aren’t still tough moments in my life. One change I have not quite gotten used to yet is waking up alone, post-divorce. Once you’ve experienced waking up next to your best friend, not having to say goodnight, and knowing that person will always be there in your life, it’s surprisingly hard to go back. It has been almost a year since my marriage ended, and I still don’t enjoy waking up most mornings. Looking around and realizing “oh yeah. This is my life now.”

But there are still plenty of good things in my life. They’re just, well, different things now. I’m trying to enjoy the chapter of my life I’m in, rather than wishing for something that’s not there. Yeah, sometimes I wish I had those years back that we “wasted” on marital incompatibilities and fights, but if I hadn’t gone through that pain I wouldn’t be where I am today.

I like my life, ultimately. I like myself. I’m trying new and different things, expanding my horizons, making friends and trying to make a difference in the world, in their lives. A positive difference. I am loving learning how to use power tools, working on studio improvements, networking in the music industry, learning how to take care of myself and my surroundings, becoming my own best friend, learning to be self-reliant, learning to make better choices. Learning to surround myself with positive, uplifting people. Learning from both the similarities and differences between me and my friends, learning what I agree and disagree with. Making fun, uplifting games for kids. Getting paid to do what I love. Figuring out, finally, that I am addicted to music and don’t ever want to recover. Working on my keyboarding and vocal skills. Working on my business skills. Working on being the best me I can be, instead of worrying about being alone.

Ultimately, I am trying to live the Gospel of Jesus Christ. The theory has always been there, as long as I can remember, but now I’m putting it into practice.

It’ll be exciting what the future brings.

On the importance of physical exertion

May 18th, 2011 by Kawika Heftel

I have a sedentary job. TWO sedentary jobs, actually – I am either sitting on my butt writing computer code, or sitting on my butt recording and mixing audio. When I go home, I play video games or surf the Internet. I’m always staring at a screen of some kind.

I’ve gained a bit of weight as a result, since my metabolism is not as young as it used to be. Lately I’ve been trying to be more active – working with my hands is never something I’ve felt any good at, seeing as my family growing up was decidedly white-collar. Fix something? I’m the LAST guy you should call, or so I thought.

All of this has led to a somewhat startling realization – any day where I get to use power tools is a good day.

Lately I’ve been doing a bunch of remodeling at my recording studio, and it has been SO empowering to do as much of the work myself as possible. I now own a drill, a level, a few saws, and I make as much use of them as possible.

It’s SUCH a good feeling to look at something physical – a new wall, some shelves, a paint job, or whatever – and say “I did that!” It takes away from my frustration, my depression, my cabin fever – and it gives me vigor, energy, self-esteem, and life!

And that is never a bad thing.


April 17th, 2011 by Kawika Heftel


April Fools Fun

April 7th, 2011 by Kawika Heftel

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). Read more…

Permission to sleep

March 30th, 2011 by Kawika Heftel

Ok, this is weird – two blog posts in two days. I promise you won’t hear from me so much in the future ;) .

The title of this post comes from a thought I had, lying here in bed. I’ve always been a night owl, always periodically found myself awake far too late, when all the sensible people are asleep. Part of me likes this time when there isn’t anyone to distract me. Part of me thinks it’s awfully lonely. But here’s my point – I need to learn to give myself permission to sleep. After a long day’s work, my brain is tired, but still literally buzzing with activity. The frenzy of mental exertion that is my workday, working as a flash programmer, doesn’t easily stop just because I turn off the computer and get in bed. Instead, I often find myself unable to sleep as my mind relentlessly turns. Sometimes, I must admit, I’m reluctant to listen to my body and come down off the mental high once the end of the day hits. My body is complaining, begging me to sleep, while my mind chants “more, more, more!” The older I get, the less benefit I get from burning the candle at both ends. In other words, this is not a sustainable behavior. And since I am busier than ever, I need to get my sleeping habits in order so I can keep a schedule, and maintain an adult work week.

Read more…

Milestone: snowboarding

March 29th, 2011 by Kawika Heftel

I went snowboarding on Saturday, for the first time in probably three years. It took a lot of initiative and determination to set the goal, and then follow through and not let setbacks get in the way. It took planning, sticking to my guns, and dealing with rescheduling. I had many other things that competed for my time that day and in the days leading up to it.

Read more…

What do people live for?

March 22nd, 2011 by Kawika Heftel

Watch this video, and then answer the question in the comments: what do you live for?  Yes, it’s a commercial, but it’s a darn good one.

Danny Boy

March 1st, 2011 by Kawika Heftel

This is the best rendition of “Danny Boy” that I have seen in a long, long while.  Enjoy!

How would you like your graphic design?

February 24th, 2011 by Kawika Heftel

Found this amazingly funny, but all-too-true graphic on my buddy Tracey Lee’s Facebook profile.  It applies to pretty much any creative industry.

Click for an enlarged graphic.

Snapshot of my best self

February 1st, 2011 by Kawika Heftel

On this fine day, I find myself rather introspective. I thought I would do an exercise in thought. What follows is a snapshot of my best self, the person I am in embryo but hope to become full-time. The rules are that you must start each statement with “I am” or something equivalent, and the statements must be positive – they are goals, after all. It can be an evolving snapshot – you can come back and change it later, adding, modifying or subtracting as your life needs and goals change.

I encourage you to try it out yourself, and link to your own snapshot in the comments – I’d love to hear what you come up with. Ok, without further ado, here it is:

I am……. Read more…


January 29th, 2011 by Kawika Heftel

Am I being the best I can be? Am I growing like I want to or need to? These are a couple of the questions on my mind tonight. I want to be the best person I can be, really work on growing, and this year is the perfect time to do it. I am excited for the new possibilities in my life, for the opportunity for real, if painful, growth. I want to live up to my true potential, as a son of God, as a flawed but trying human being.

I want this to be the year I dig into the thoughts and patterns that hold me back, and change things that may be dysfunctional in my life. I want to grow musically, spiritually, mentally, physically. I want to grow my business and see it succeed, and learn what I need to to run it. I want to overcome bad habits, unhealthy or dysfunctional thought patterns, and learn to overcome toxic shame and guilt. I want to be a good friend, a strength in other people’s lives. A good listener. “To have a friend, be one,” as the ceramic plaque that hung on my mom’s wall said. I want to be someone that others can turn to because I don’t give them unwanted advice. Because I give them strength. I want to be someone people can count on.

You only get one life. You might as well live it to the fullest. A great quote I saw today said that life is not only to be endured, but enjoyed. Too often we (read: I) forget that. Too often I get caught up in the problems and challenges of life, losing sight of the big picture in the process. Not being able to see the forest for the trees. As nickelback so eloquently said, “This is your life. Are you who you wanna be?”

What we’ve learned in 2064 years

January 13th, 2011 by Kawika Heftel

An interesting quote…….

“The budget should be balanced, the Treasury should be refilled,public debt should be reduced, the arrogance of officialdom should betempered and controlled, and the assistance to foreign lands shouldbe curtailed lest Rome become bankrupt. People must again learn towork,  instead of living on public assistance.”

-Cicero, 55 B.C.

What have we really learned in the last 2064 years?

The descent of the RIAA into madness

January 7th, 2011 by Kawika Heftel

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.

Read more…