2 Replies Latest reply on Feb 3, 2010 1:36 PM by Jason Szeto

    UIComponent scale anchor point

    phil1943 Level 1

      Hello, I have a UIComponent that I am scaling.

      Is there a way to modify the anchor point of this UIComponent so that it scales from that arbitary point rather than the default ?


      Thanks for any advice.

        • 1. Re: UIComponent scale anchor point
          Flex harUI Adobe Employee

          No.  You can put it in another UIComponent and scale the new UIComponent.

          • 2. Re: UIComponent scale anchor point
            Jason Szeto Level 3

            Here is an example that shows how you could do this using matrix transforms.This example also show how you would do rotation.


            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">


                        protected function button1_clickHandler(event:MouseEvent):void
                            var regX:Number = 30;
                            var regY:Number = 30;
                            var m:Matrix = new Matrix();
                            m.translate(-regX, -regY);

                            m.rotate(45 * Math.PI / 180);
                            m.translate(targ.x, targ.y);
                            m.translate(regX, regY);
                            targ.transform.matrix = m;


                <mx:Button label="Scale" click="button1_clickHandler(event)" x="5" y="5"/>
                <mx:VBox backgroundColor="red" width="100" height="100" id="targ" x="200" y="200"/>