7 Replies Latest reply on Oct 22, 2008 9:00 AM by Newsgroup_User

    Why can't I add a sprite?

    Handycam Level 1
      I am trying this:
      private function makeItem():void {
      var bar:Sprite = new Sprite();
      this.addChild(bar);
      }

      When I call this function from a list click event, it crashes with:

      TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Sprite@1bad1439 to mx.core.IUIComponent.
      at mx.core::Container/ http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\3.0.x\frameworks\projects \framework\src\mx\core\Container.as:3251

      So how do I add a sprite to the stage?