title: How do I add a Sprite to the stage in runtime?
body: <p>I'm trying to get the hang of using AS3 to add objects to the stage.  I understand that with the new Adobe Animate, using Sprites can be more efficient than always using MCs, so I'm trying to figure out how that's done and I keep finding mostly old tutorials involving only MCs and not Sprites, per se.  So, ANY helpful information using Sprites is appreciated.</p>
  
  <p>Now, my <em>specific</em> problem is this:</p>
  
  <pre><code>package 
  { 
      import flash.display.Sprite
  
      public class Ship extends Sprite
      { 
          public function addShip():void
          {
              trace("addShip function run");
          } 
      } 
  }
  </code></pre>
  
  <p>which is all in a file called Ship.as which I have linked to my file Ship.fla in the Actionscript Settings menu under the File menu.
  Then, in my Ship.fla file, the first frame of the main timeline has:</p>
  
  <pre><code>ShipMc:Ship = new Ship();
  addEventListener(MouseEvent.CLICK, addShip);
  </code></pre>
  
  <p>which gives these errors:</p>
  
  <pre><code>1067: Implicit coercion of a value of type Ship to an unrelated type Class.
  1188: Illegal assignment to class Ship.
  1120: Access of undefined property addShip.
  </code></pre>