title: How to draw rectangle in flex 4.5.1?
body: <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                 xmlns:s="library://ns.adobe.com/flex/spark" 
                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="640" minHeight="480"&gt;
      &lt;s:layout&gt;
          &lt;s:BasicLayout/&gt;
      &lt;/s:layout&gt;
      &lt;fx:Script&gt;
          &lt;![CDATA[
              import flash.display.Shape;
              import flash.display.Sprite;
  
              import mx.core.UIComponent;
  
              import spark.core.SpriteVisualElement;
              private var rectangle:Sprite = new Sprite();
              private var insterter:UIComponent = new UIComponent();
              private var theme:SpriteVisualElement = new SpriteVisualElement();
              private function main():void
              {
  
                  rectangle.graphics.lineStyle(1,0x0000FF,1.0);
                  rectangle.graphics.drawRect(0,0,200,50);
                  theme.addChild(rectangle);
                  this.addElement(theme);  //tried canvas.addElement
                  const WIDTH:int = 20;
                  const HEIGHT:int = 20;
  
                  /*var grid:Array = new Array();
                  for(var y:int = 0; y &lt; HEIGHT; y++) {
                      var row:Array = new Array();
                      for (var x:int = 0; x &lt; WIDTH; x++) {
                          row.push(/*random object*//*);
                      }
                  /   grid.push(row);
                              }*/
  
              }
  
          ]]&gt;
      &lt;/fx:Script&gt;
      &lt;!--&lt;spark:Canvas id="canvas" x="34" y="10" width="90%" height="90%" textAlign="center"&gt;
  
      &lt;/mx:Canvas&gt;--&gt;
  &lt;/s:Application&gt;
  </code></pre>
  
  <p>Basically this is not working. I used this question to improve - still nothing.
  <a href="https://stackoverflow.com/questions/5910609/why-doesnt-this-flex-app-draw-a-simple-rectangle">Why doesnt this Flex App draw a simple rectangle?</a></p>