Header Image - charles newman's blog

Adobe Flex – getDefinitionByName failing with Error #1065

by Charles Newman

I was trying to instantiate a class using the class name as a string, like this:

var pluginInfoRef:Class = getDefinitionByName(“com.foo.bar.MyClassName”) as Class;

But kept getting this error:

ReferenceError: Error #1065: Variable MyClassName is not defined.

Which really has nothing to do with the problem since “MyClassName” is not a variable.  I think the problem here is the SWF compiler in Flex Builder is optimizing out any imports that don’t get instantiated, so at run-time, the class really doesn’t exist in the SWF. The work around I came up with is to add this line:

private static const forceReference:MyClassName = null;

This causes the SWF compiler to pull the class into the SWF and getDefinitionByName started to work.  Now, I’d like to have that 20 minutes back.

Adobe Flex – Project build order setting in preferences

by Charles Newman

Do you ever get baffling build errors after importing projects? Sometimes the compile errors are related to project settings, such as library dependencies, missing SWC files etc.  But after fixing those problems you still see errors after doing a “Clean…”?

Take a look at your build order preferences, you’ll find the dialog shown below under the Flex Builder preferences (Cmd+”,” on a Mac), not the project preferences.  Apparently, Flex Builder adds items here in the order you import them, so mix them up here based on dependency and when you tell Flex Builder to “Clean..” it should build everything correctly.


Adobe Media Encoder CS4 for Mac – Can’t set the CBR bitrate

by Charles Newman

So you sit down to encode some content at varying bitrates so you can dynamically stream your content. You start with a low bitrate. Then you duplicate that one so you can do another at a higher bitrate with the same settings. But before you hit “Start Queue” you decide to double check that last one and make sure you set the bitrate to what you thought you set it to. But no, it’s set to the first one. You do it a few more times and… …what the f*#%! The bitrate change will not stick! This is an incredibly annoying bug.

The only way I’ve found to make it “stick” is to select VBR, set your desired bitrate, then choose CBR. It sticks when you do that. How this got past the QE’s at Adobe I have no idea.

Mac OS X – Firefox preferences and windows open off screen

If you use two monitors and then remove one, for example from your laptop, you may notice that Firefox thinks the other monitor is still there and opens it’s preferences and windows off screen. To fix this without re-connecting the monitor:

1) Quit Firefox
2) Hold down the option key while you start Firefox
3) Select “Reset toolbars and controls” and click “Make Changes and Restart”.


Mac OS X – show the full path in the Finder window

by Charles Newman

One of the things missing from OS X is the ability to ctrl+click a file and copy it’s full path to the clipboard. It amazes me that this feature is missing from such a robust OS. This tip should make your life easier. You can see the full path in the title bar when you select a file in the Finder.

1) Open a Terminal window and type this command:
defaults write com.apple.finder _FXShowPosixPathInTitle TRUE
Of course replacing TRUE with FALSE will turn this feature off.

2) Restart the Finder:
Cmd+Option click the Finder in the Dock and select "Relaunch"

Note this works from User accounts as well as Admin accounts. No need to “sudo” from within the User account.