3 Replies Latest reply on Aug 15, 2009 2:28 PM by jherr22

    How to display and move an object in an mxml project, like from file Ball.as



      I want to put up a Ball (and later, I will move it), in my mxml project.


      I created a class Ball, in file Ball.as

      I referenced it in my MXML Project, within <mx:Script>


      public var myball:Ball = new Ball();













      public function putUpTheBall():void


      myball = new Ball();







      I also have:    <mx:Button click="{putUpTheBall()}"/>

      When I click the button, I get:

      TypeError: Error #1034: Type Coercion failed: cannot convert Ball@5b63381 to mx.core.IUIComponent.


      It is the addChild() that is creating the run-time error.

      How can I display the Ball??


      (BTW, I had no trouble with doing this in an actionscript project.)

      --- john