Header Image - charles newman's blog

Category Archives

24 Articles

Adobe Flash – Flash Player 10 is at 93.5% penetration

As of September 2009, Flash Player 10 is installed on 93.5% of the personal computers in mature markets. This includes the US, Canada, UK, Germany, France, Japan, Australia, and New Zealand.

All the projects I work on target Flash Player 10 or higher, and I can’t keep count of how many times developers have asked me, “how can I make this code work with Flash Player 9”. Simple answer, you can’t, so stop asking ;)

Details are here:
Worldwide Ubiquity of Adobe Flash Player by Version

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 Flex – Use working sets to manage your projects

by Charles Newman

If you have a lot of projects in Flex Builder you can use working sets to make them more manageable.

In the Flex Navigator view (this is the project tree), click on the toolbar menu and select “Select Working Set”. Click the “New…” button. Choose “Resource” and click “Next >”. Give your working set a name and then choose the projects that go in it.

This is a huge productivity boost, not only for working with projects, but also for searching across your source code. When you do a “find in files” (cmd+shift+F), you can select a working set to search in.

Google Picasa Web API – some photos will not load in IE and Safari

This baffled me for a few days.  I wrote a Flex app to try out Google’s Picasa Web API and it worked great in Firefox on a Mac.  But some of the images would not load in Safari (Mac or PC) and IE 7.  I eventually stumbled on a query string param that fixed it.

Apparently, some browsers limit the size of images to 800 pixels for the largest dimension.  If your images will not load in IE and Safari, try adding “imgmax=800” on the query string when you request an image, like this: