1
votes

Canvas.addChild() insists any DisplayObject added implements IUIComponent. But I don't want my core graphics engine dependent on Flex. Is there an obvious/common way around this, to have simple graphical objects like Sprites & Shapes in a Flex application? The individual DisplayObject children I want to add as children represent objects in a game world, like a spaceship or a missile or a horse...

Not sure if Canvas is the most appropriate container, perhaps Group or another class is optimal for a game-engine... example MXML & AS3 code showing a skeleton setup is most welcome. I'm targeting Flex4 & Flash 10, but Flex3/Flash9 solutions are still of interest.

1
Are there any specific reasons why you want to use the Flex framework as opposed to developing a pure AS3 project where all of the above would be avoided? You're asking for a skeleton setup with MXML & AS3 , but it's not really clear why you require MXML at all. - PatrickS
Lets me create UI without having to have an artist, or learn CS4. It's entirely plausible to use a pure AS3 engine in an MXML-based application. I've developed a MMORPG using this setup before and it worked out nicely. But it's personal preference, Flex is quite capable and it must be possible to do this. - Mr. Boy

1 Answers

1
votes

Instead of canvas, you can use UIComponent as it does not have the IUIComponent implementor requirement. Then addChild() your sprites to that.