2 Replies Latest reply on Jun 17, 2008 8:37 AM by BuckLemke

    Adding an image to a Sprite

    BuckLemke
      I am trying to add an image to an existing sprite. The sprite currently just is a filled area using it's graphics property. Attached is a simplified example of what I am trying to do. I guess I am confused on why some UIComponents allow children to be added, and others don't.
        • 1. Re: Adding an image to a Sprite
          Garyl Woolworth Level 1
          You are able to add the image to the VBox because it extends Box which extends Container. Neither Sprite or UIComponent extend Container which is what gives the ability for something to be able to have children added or removed. You can read about what I'm talking about here.

          quote:

          The Container class contains the logic for scrolling, clipping, and dynamic instantiation. It contains methods for adding and removing children. It also contains the getChildAt() method, and the logic for drawing the background and borders of containers.
          • 2. Re: Adding an image to a Sprite
            BuckLemke Level 1
            Ok, that makes sense. And the Container class, will allow "appending" of objects to it, automagically resizing as needed. However, what is the proper way to add an image on top of something? Overlaying it instead of putting it below (or to the left)?