3 Replies Latest reply on Jun 6, 2011 4:56 PM by GordonSmith

    DisplayObject vs Sprite

    simplesid Level 1


      What is the exact difference between Sprite(Not Flexsprite) and DisplayObject?

      FYI, i have read the ASDocs but i could not find a more layman'ish description and preferably with some examples.

      Thanks in advance..


        • 1. Re: DisplayObject vs Sprite
          blazejewicz Level 4

          Hi Sid,


          that DisplayObject is basic, core object in modern display implementation in Flash runtime. All other "objects" that can be interacted, added, created, removed, etc in runtime are descendants of DisplayObject. DisplayObject is abstract - in that term that one cannot directly create it in code. That is also not possible to "see" it on screen as there is no tools in api to draw/fill that object. For all such requirements one would use one of descendants of DisplayObject - and there are plenty of them including Bitmap, Shape, Video etc - Sprite is only one of such descending objects.

          see e.g. "Core display classes":





          • 2. Re: DisplayObject vs Sprite
            pauland Level 4

            If you go to  the docs description of the Sprite class, you can see the inheritance hierarchy and see exactly what changes between Sprite and DisplayObject.

            • 3. Re: DisplayObject vs Sprite
              GordonSmith Level 4

              My 2 cents...


              EventDispatcher knows how to dispatch events and let listeners register for them.

              DisplayObject extends EventDispatcher to be an abstract visual thing with a location.

              InteractiveObject extends DisplayObject to add mouse and keyboard interaction.

              DisplayObjectContainer extends InteractiveObject to add children and therefore allow a whole tree of visual descendants.

              Sprite extends DisplayObjectContainer to add drawing into its Graphics.


              Gordon Smith

              Adobe Flex SDK Team