Hi All, I am simply trying to draw a rectangle inside of a panel using flex4. I am using spark instead of mx. It complains about addchild being replaced by addelement; however, addelement expects type ivisualcomponent. I think sprite should be of that type; however, it reports an error when trying to use the below code... I have tried a few different ways. I think I am missing something very basic about flex 4. Any enlightenment would be much appreciated! :-D
private function drawRectangle(e:MouseEvent):void{
var s:Sprite = new Sprite();
s.graphics.beginFill(0x00ff00, 0.5);
s.graphics.drawRect(e.localX,e.localY,50,50);
s.graphics.endFill();
canvas.addChild(s);
}