title: does actionscript addChild require a display object first
body: <p><strong>Solution:</strong></p>
  
  <p>if you have the same problem, <strong>addElement()</strong> instead of addChild() is what did it</p>
  
  <hr>
  
  <p>I'm trying to move away from mxml to actionsctipt. I have a <code>&lt;s:Rect&gt;</code> that I've created and set its properties, but having trouble adding it. </p>
  
  <pre><code>var aRect:Rect = new Rect();
  //set properties like aRect.x, aRect.y, aRect.width, aRect.height
  
  //tried adding it various ways
  addChild(aRect);
  Application.addChild(aRect);
  Application.application.addChild(aRect);
  stage.addChild(aRect);
  </code></pre>
  
  <p>But I keep getting the error
  <strong>1067: Implicit coercion of a value of type spark.primitives:Rect to an unrelated type flash.display:DisplayObject</strong></p>
  
  <p>Originally in the mxml, it was right inside <code>&lt;s:Application&gt;</code> not nested inside anything</p>
  
  <pre><code>&lt;s:Application&gt;
  
      &lt;s:Rect id="aRect" x="10" y="10" width="15%" height="15%"&gt;
           //then fill code here, removed for readability
      &lt;/s:Rect&gt;
  
  &lt;/s:Application&gt;
  </code></pre>
  
  <p>What's the deal, I thought actionscript would be nicer than mxml.</p>