7 Replies Latest reply on Apr 20, 2010 2:33 PM by Flex harUI

    Scaling UI Components

    alice_data Level 1


      I wonder if anyone has tried doing this. I have several coordinates  here as here:

      <region name="triangle">
      <region name="rect">

      I am trying to use some simple way of finding out what the width and  height of the objects that I draw on the canvas. I call up the main app using this:




      This is what is in the drawThematicMap class:


          public var canvas:Canvas;
              public function setCanvas(x:Number,y:Number,width:Number,height:Number):void{
                  canvas.x = x;
                  canvas.y = y;  
              public function draw(arr:Array):void{
               regions = arr;    
               var shape:UIComponent;
                       var gr:Graphics;
                       var coords:Array;
                   for (var s:String in regions) {
                      trace("\n" + s);
                      shape = new UIComponent();  
                      gr = shape.graphics;
                      gr.lineStyle(3);//Define line style                   
                      coords = regions[s];
                   for (var i:int = 2; i < coords.length; i += 2) gr.lineTo(coords[i],coords[i + 1]);                  
                       gr.endFill(); //Put this in if there is a color


      I am trying to  use the information so I can possibly use it for rescaling the image so I  don't have to calculate all my coordinates one by one.

      Is there a simple way to do this?



      Thanks for your help.