Programming "/>

A Graphic is a MovieClip is a Sprite

07 January 2009 at 5:57 am

Spent some hours figuring out a bug that others may want to know of if they get Flex assets as SWFs generated with the Flash IDE. If you create a “Graphic symbol” in Flash and later change it to a MovieClip in the library of the IDE, it will look like a MovieClip but it is still considered a Sprite by the Flex 3 compiler. It doesn’t matter if the symbol has one or more frames, Flex will insist it’s a Sprite since it came from a Graphic symbol.

The error I got was this:

TypeError: Error #2007: Parameter child must be non-null.
	at flash.display::DisplayObjectContainer/addChild()

I this case, it was me that had changed the Graphic symbol to a MovieClip, so I was able to figure out what caused the problem. If the change was done by the designer I got the FLA from, I’d have no clue at all. So, if you run into that error message for no reasonable reason, try copying the contents of the problematic symbol into an empty MovieClip, export the SWF, clean your Flex project and then re-export.

Updated: I did a little more testing yesterday and it appears that it’s Flash CS3 that is the culprit. As soon as you add more than one keyframe, the symbol will change from graphic to MovieClip in the SWF. Extending the timeline will not trigger the update since it can still be considered a Sprite.