0 Replies Latest reply on Nov 9, 2009 9:37 AM by ghalex

    Wrong getBounds() on LineScaleMode.NONE

    ghalex

      I have write a simple example that adds a canvas and draw a rectangle with stroke size 20 scale mode none. Th problem is

      that if call getBounds() first time I will get a correct result but after I call scale(); the getBounds() function will give me a wrong result

      It will take in cosideration the stroke but stroke has scalemode to none and on the screen nothing happens but in the result I will have

      a x value smaller. Can sombody tell me how can I fix this ?

       

       

                  protected var display :Canvas;
                  
                  protected function addCanvas():void
                  {            
                      display = new Canvas();
                      display.x = display.y = 50;
                      display.width = 100;
                      display.height = 100;
                      
                      display.graphics.clear();
                      display.graphics.lineStyle( 20, 0x000000, 0.5, true, LineScaleMode.NONE );
                      display.graphics.beginFill( 0xff0000, 1 );
                      display.graphics.drawRect(0, 0, 100, 100);
                      display.graphics.endFill();
                      
                      area.addChild( display );
                      traceBounce();
                  }
                  
                  protected function scale():void
                  {
                      var m :Matrix = display.transform.matrix;
                      var apply :Matrix = new Matrix();
                      apply.scale( 2, 1 );
                      apply.concat( m );
                      
                      display.transform.matrix = apply;
                      traceBounce();
                  }
                  
                  protected function traceBounce():void
                  {
                      trace( display.getBounds( this ) );
                  }