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;
Try/Catch Example
So I’ve been thinking of a non-hacky way to use try/catch - and I finally found one (I think).
try
{
var classRef:Class = getDefinitionByName($name) as Class;
}
catch(e:*)
{
trace(e)
}
Generally, getDefinitionByName just fails if a variable isn’t defined and you get this lame runtime error:
ReferenceError: Error #1065: Variable is not defined.
I’m not a huge fan of that. I wanted to use getDefinitionByName
