3 Replies Latest reply on Dec 27, 2009 11:54 AM by DennisTh

    How to "anchor" an UICompoment object REFdn6025643069




      I do the follow:

            var d:PanelGradient=new PanelGradient(0,0,stg.width/2,stg.height/2,30,30,stg.width/2*1.5,stg.width/2*1.5);



            addChild(d); // to main Stage


      In the above code, setting the “right” and “bottom” styles, I expect in case of resizing the browser, the PanelGrandient object to be anchored in the right bottom corner…. Something that it doesn't happen.


      What I do wrong?


      p.s. The PanelGradient extends the UIComponent and in real is a container of a Shape with a matrix.



        • 1. Re: How to "anchor" an UICompoment object REFdn6025643069
          Flex harUI Adobe Employee

          If PanelGradient sets its x/y/width/height in the constructor, I'm not sure the left/bottom constraints will win.


          Also, make sure PanelGradient will update the Shape when resized.


          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: How to "anchor" an UICompoment object REFdn6025643069
            DennisTh Level 1

            Hi, thank you for your reply.


            I do not initialize the x, y, width or height of the UIComponent, but I do this initialization on the Child of this container.


            In precise here is the code... maybe helps you...


            package myGraphics


              import flash.display.GradientType;

              import flash.display.Shape;

              import flash.display.Sprite;

              import flash.geom.Matrix;


              import mx.core.UIComponent;


              public class PanelGradient extends UIComponent //Sprite

              //classic use: PanelGradient(0,0,stg.width,stg.height,30,30,stg.width*1.5,stg.width*1.5)


                public function PanelGradient(x:int,y:int,width:int,height:int,illuminancex:int,illuminancey:int,illumina ncewidth:int,illuminanceheight:int)



                  var myShape:Shape = new Shape();

                  var gradientBoxMatrix:Matrix = new Matrix();


                    illuminancewidth,                      //width

                    illuminanceheight,                     //height

                    0,                                     //rotation

                    illuminancex-(illuminancewidth/2)+x,     //x of illumine

                    illuminancey-(illuminanceheight/2)+y  ); //y of illumine

                  myShape.graphics.beginGradientFill(GradientType.RADIAL, [10395294, 3487029], [1, 1], [0, 255], gradientBoxMatrix);

                  myShape.graphics.drawRect(x, y, width, height); //x, y, width, height








            • 3. Re: How to "anchor" an UICompoment object REFdn6025643069
              DennisTh Level 1

              Hello... is anybody home?!?