Method Verification in Actionscript 3
ReferenceError: Error #1069: Property doSomething not found on YourObject and there is no default value.
Look familiar?
Let’s say you want to verify an object has a method before calling that method - so flash won’t do something it shouldn’t and return a runtime error and CRASH.
SOLUTION:
{
if(object.hasOwnProperty(methodName)) return object[methodName] is Function;
return false;
}
Tracing out embedded fonts
One thing I’ve noticed (especially in cs4) is a hard time identifying the names of the fonts you’re embedding. For instance: the font I was using “Helvetica Neue BlackItalic” (as in the IDE) when traced turned out to be “12 pt. Helvetica* 96 Black Italic 16472″. Seriously, flash? Wow. Totally sucks. I would have never figured it out unless I did this (directly from the flash docs):
[code lang=”actionscript”]
var fontArray:Array = Font.enumerateFonts(false);
for(var i:int = 0;
