0
votes

I'm trying to display an image using ActionScript (AS3), and Flash keeps showing it stretched. How do I stop it from doing that? I've played with width, height, scaleX, and scaleY, but I can't get it to stop stretching. Here's the code:

package
{
  import flash.display.Loader;
  import flash.display.Sprite;
  import flash.net.URLRequest;

  public class ActionScriptProject extends Sprite {
    public function ActionScriptProject() {
      var imageLoader:Loader = new Loader();
      imageLoader.load(new URLRequest('chrome_logo.jpg'));
      addChild(imageLoader);
    }
  }
}
1

1 Answers

0
votes

I finally figured out how to set stage.scaleMode and stage.align:

package
{
  import flash.display.Loader;
  import flash.display.Sprite;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.net.URLRequest;

  public class ActionScriptProject extends Sprite {
    public function ActionScriptProject() {
      stage.scaleMode = StageScaleMode.NO_SCALE;
      stage.align = StageAlign.TOP_LEFT;

      var imageLoader:Loader = new Loader();
      imageLoader.load(new URLRequest('chrome_logo.jpg'));
      addChild(imageLoader);
    }
  }
}

This problem may be specific to how Flash Builder sets things up.