Chapter 35 Example 9

by actionscriptbible
♥0 | Line 26 | Modified 2010-02-09 06:32:31 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gdvq
 */

package {
  import flash.display.LineScaleMode;
  import flash.display.Shape;
  import flash.display.Sprite;

  public class ch35ex9 extends Sprite {
    public function ch35ex9() {
      //normal scale mode (by default), strokes scale
      var normalscale:Shape = new Shape();
      addChild(normalscale);
      normalscale.graphics.lineStyle(1);
      normalscale.graphics.drawRect(10, 10, 50, 50);
      normalscale.scaleY = 4;
      
      //no-scale mode, strokes don't scale
      var noscale:Shape = new Shape();
      addChild(noscale);
      noscale.x = 100;
      noscale.graphics.lineStyle(1, 0, 1, false, LineScaleMode.NONE);
      noscale.graphics.drawRect(10, 10, 50, 50);
      noscale.scaleY = 4;

      //normal scale mode, hairline stroke, strokes stay at 1 px wide
      var hairline:Shape = new Shape();
      addChild(hairline);
      hairline.x = 200;
      hairline.graphics.lineStyle(0);
      hairline.graphics.drawRect(10, 10, 50, 50);
      hairline.scaleY = 4;
    }
  }
}