2 Replies Latest reply on Jul 29, 2010 1:18 PM by lpg1123

    spark.primitives.Graphic not displayed within UIComponent



      I've created a spark Application and am creating a Graphic object.  When I add the object directly to the application via addElement, everything functions properly.  However, when I add the graphic to a UIComponent, and then add the UIComponent to the stage, the graphic is not displayed.  Has anyone else experienced this, or have suggestions?








      <s:Application creationComplete="init()">




                  import mx.core.UIComponent;
                  import mx.graphics.SolidColor;
                  import spark.primitives.Graphic;
                  import spark.primitives.Path;


                  private function init():void{

                          var path : Path = new Path();
                          path.data = "M 0.0 0.0 L 100 0 L 100 100 L 0 10 L 0 0 Z";
                          path.fill = new SolidColor(0x030304);                   
                          var graphic : Graphic = new Graphic();
                          graphic.addElement( path );


                          // This code displays the graphic correctly.

                          addElement( graphic );

                          // When I add the graphic to a UIComponent, and add that to the stage, nothing is shown

      //                    var content : UIComponent = new UIComponent();
      //                    content.addChild( graphic );
      //                    addElement( content );