1 Reply Latest reply on Aug 18, 2006 2:09 PM by peterent

    Add embedded class to a container

      Hi guyz someone help me to find a way out for this problem.
      Im embedding an image to a class.Is there a way to add this class to the container as a child.
      If it is not so, then what is the method to attach the external image in flex at runtime..

        • 1. Re: Add embedded class to a container
          peterent Level 2
          If you have any class that's inheriting from UIComponent (like Image, VBox, Canvas, etc.), you can add it any container using the container's addChild() method:

          addChild( new MyImageClass() );

          You can grab an image at runtime by setting the source property of the Image control:

          <mx:Image id="img" />
          img.source = someImagefilename;
          <mx:Image id="img" source="{filenamehere}" />
          [Bindable] public var filenamehere:String;

          then set filenamehere with the image you want to load. Dynamic data binding will tell the Image that the source value has changed and it will load the new image.