Wow – I’d never seen this one before. So I’m putting up here to remind me what to look for if I ever see it again!
Basically I had a SWF that ran fine in debug build mode in FlashDevelop but if I set it to compile as a release version this error soon appeared.
On closer inspection it turns out that in the line that was crashing (which was hard to find in itself) I was using a variable named “h” in a loop. The clue was that this var h:DisplayObject was coloured green by the compiler and therfore most likely an internal variable in a parent class. All I did was change it for something a bit more descriptive and unique and it all compiled. So lessons learnt – listen to the code highlighting hints and don’t be lazy and use short variable names!
Phew.
A bit of searching also suggested that it may be a Flex 4.1 SDK related bug as I would have assumed that the compiler would give you a warning even when compiling a debug version. If anyone can shine any more light on this one please post.