Getting to grips with Skins at the moment in Gumbo, and enjoying the flexibility! I thought I would experiment with adding a drawn background (using AS3 code) to a SparkSkin MXML file. I've got the MXML setting up the display of a few regular components (rectangles etc), and would like to have a Sprite added so I can draw into it using AS3.
So I've added an override for "createChildren" in a <fx:Script...> tag block, and that seems to run as required (adding a button for example works great). But I can't add a Sprite. I've tried creating a Group and adding the Sprite to the Group, but that also fails. Is there a way of doing this? I know I could use another class and create the sprite in that, but it seems like overkill to add another class for one little Sprite.
Group can only contain IVisualElements. You should be able to subclass spark.core.SpriteVisualElement instead of Sprite and then you can add that object directly into a Group.
Or you could add your Sprite to a SpriteVisualElement as demonstrated here: http://blog.flexexamples.com/2009/11/20/adding-a-sprite-to-the-display-list-in-flex-4/
That's fantastic - thanks very much for the pointers. Got it working no problems now :-)