3 Replies Latest reply on Oct 25, 2010 9:35 AM by Flex harUI

    Flash Sprite vs. Flex Canvas

    ne_polle Level 1

      Hi all

       

      I knew that the Canvas-Class extends more Classes than the Sprite Class. Couse that I have just a general question:

       

      Does it make any memory or performance difference when I add hundreds of Sprite-Objects to a Canvas or to add hundreds of Canvas-Objects to a Canvas and interact with them with the mouse??

       

      thanks ahead and best regards

        • 1. Re: Flash Sprite vs. Flex Canvas
          Flex harUI Adobe Employee

          You can't add Sprite to a Canvas.  Canvas children must implement

          IUIComponent.  The heavier the child is, the more memory and cpu it will

          consume.

          • 2. Re: Flash Sprite vs. Flex Canvas
            ne_polle Level 1

            Thanks for anwering...

             

            But it is possible to add Sprites to a Canvas:

            myCanvas.rawChildren.addChild(mySprite);

             

            I have done a simple test...I added a lot of Sprites and also a lot of Canvas to a Canvas.

            I checked the loadedBytes count and also the informations from the taskmanager.

             

            my result is that it doesn't make any difference!

             

            I was totally surprised by that result, couse that means also you can always use high ordered classes without any memory or cpu lost.

            You don't have to think about a slim programming style.

             

            I don't know if my test are really good to make that statement.

             

             

            please feel free to commend this statement.

            • 3. Re: Flash Sprite vs. Flex Canvas
              Flex harUI Adobe Employee

              Yes, you can use rawChildren, and while that does parent the Sprite, it is

              not managed with the other children.

               

              I would expect 1000 Canvas to take another half meg or so.  That might not

              show up in taskmanager.  I don't know what loadedBytes is.