How are these things supposed to be used? I'm apparently missing the mark. I figured I could use them to display images & shapes in my application. But it doesn't look like I can add them in my MXML or Actionscript:
<?xml version="1.0" encoding="utf-8"?>
private function onLoad():void
var square:Sprite = new Sprite();
square.graphics.drawRect(0, 0, 80, 80);
Throws an error during runtime:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Sprite@4dee191 to mx.core.IUIComponent.
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at mx.core::UIComponent/set initialized()
So I can see that a Sprite isn't of IUIComponent -- so it won't let me add it directly to the panel or to the application. How am I supposed to use these things in my Flex application? I checked out the livedocs: http://livedocs.macromedia.com/flex/...ay/Sprite.html
and I don't see why their subclass of Sprite would work, while a regular plain-jane Sprite wouldn't. It doesn't look like they've made any conversion of the Sprite to a IUIComponent...
Pretty much all I'm after is trying to programatically draw a square (or whatever other shape my miniscule brain can conjure
) and display that to the screen.