Tuesday, November 11, 2008

New Home

I've moved this blog to here.

Thursday, July 24, 2008

MAX!

Registration Now Open! Register now for MAX North America. Learn more at http://www.max.adobe.com/

Tuesday, July 22, 2008

One bug leads to another

I thought I'd write a quick summary of some bug hunting goodness over the weekend. For some time I have used a custom file loading class that allows me to pass it an array of targets, and URL's and it happily loads them one after another and calls a listener when complete. Its always worked great - until this time.
Within the class I pop an element off the top of the passed in loader array, using the shift() method. The shift() method deletes the element - so when the array is empty everything has been loaded. The problem appeared when I later wanted to reference an item in the original loader array, within my movie, and found it was empty. The problem can be seen in this code clip from the class:

private var loaderArray:Array;

public function init(loadArray:Array):Void
{
    this.loaderArray = loadArray;
}

Some of you will recognize the issue immediately - and I would have to had I ever needed to use the original array before. The problem is that arrays are not passed by value. When you set loaderArray = loadArray you are not placing a copy of loadArray into loaderArray. What you are doing is simply setting loaderArray to a memory address, so that it references (points to) the same array. Most of the time this is desirable as it saves on memory, and as long as you're aware of how it works there is no problem. But sometimes you forget... or in this case it just never mattered before.
So, after finally realizing why my original array was getting erased I corrected it by copying the array instead:

private var loaderArray:Array;

public function init(loadArray:Array):Void
{
    for(var i = 0; i < loadArray.length; i++){
        loaderArray.push(loadArray[i]);
    }
}

At least I thought I had corrected it. Anyone see the problem now? The compiler doesn't see anything wrong either. However, loaderArray doesn't get anything pushed to it - because it was never initialized. It's a null object. The compiler doesn't see anything wrong because loaderArray is typed as array, so push is fine. Fixing is as simple as:

private var loaderArray:Array;

public function init(loadArray:Array):Void
{
    loaderArray = new Array();

    for(var i = 0; i < loadArray.length; i++){
        loaderArray.push(loadArray[i]);
    }
}

This is only an issue in the AS2 compiler, if you try this in AS3 you'll get a compiler error like so: Error #1009: Cannot access a property or method of a null object reference. telling you exactly what the problem is. You can't use the push method on an object that hasn't been initialized.

squish

Saturday, July 19, 2008

Sorry bout that...

Sometimes you take a break. I was in the midst of finishing a large project and while it's still not completely finished, it's close enough to take a break. So, expect some Flash content soon. I'm going to try and feature answers / tutorials to the most common questions I see in the Adobe Flash forums.

But since this blog isn't all about Flash - check this out: Off Road Fire Press Release a long time friend, Jeff Idleman of the Iona Group, wrote up a nice press release for ORF. It was tweaked a bit by family and friends and then submitted...

Thursday, April 3, 2008

Flash IQ Fun

Here's a little brain teaser, that I thought was pretty fun and a bit challenging.

http://www.robmathiowetz.com/

Hot Sauce Update

I have been sampling the Dave's Gourmet Crazy Caribbean, that I talked about in my last post, and it's really been growing on me. Lately I've been getting a nice lime hit upfront, and less of the carrot that I was tasting. It's actually a really good sauce, and definitely one of the thickest I've ever come across. So, I've come to the conclusion that Off Road Fire isn't necessarily better - it's just different, and it depends what you're looking for at the time.
It's odd how your taste perception changes throughout even a single day. Since I've been making hot sauce I sample it about 20 times a day. I'm not kidding. Sometimes it's not that good. Other times I think it's just perfect. It can be too hot. It can be like 'Where's the Heat?' All from the same bottle. I suppose it depends on what you've eaten last, when you ate it, etc. Maybe someday I will try and document what foods make it taste best... and then serve those at samplings. Hmmmm.

Wednesday, March 12, 2008

Off Road Fire

As many of you know, I make my own hot sauce - Off Road Fire Co.. I also buy various other hot sauces - both because I love hot sauce, and also because I like to compare store bought versions to my own. Currently, I have about 15 different kinds of sauce in the fridge. Today I bought a bottle of Dave's Gourmet Crazy Caribbean Hot Sauce. It's not bad... but Off Road Fire is better - at least I think so. Not in heat, mind you - but in flavor. ORF is not quite as hot, but it's very close actually - Dave makes some other sauces that are _way_ hotter. This is not too hot. But it's number one ingredient is carrots and those shine through a bit too much for my taste. They are used to temper and thicken the sauce. Note: see above... this sauce really grows on you.