topical media & game development

talk show tell print

professional-flex-code-16-LoaderShapeExample.ax

professional-flex-code-16-LoaderShapeExample.ax [swf] flex


  package
  {
  import flash.display.Sprite;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.display.Shape;
  import flash.display.Loader;
  import flash.net.URLRequest;
  
  public class @ax-professional-flex-code-16-LoaderShapeExample extends Sprite
  {
    public function @ax-professional-flex-code-16-LoaderShapeExample() {
      if( stage != null ) {
        stage.scaleMode = StageScaleMode.NO_SCALE;
        stage.align = StageAlign.TOP_LEFT;
      }
  
      var maskRect:Shape = new Shape();
      maskRect.graphics.beginFill( 0xFFFFFF );
      maskRect.graphics.drawRect( 10, 10, 71, 71 );
      maskRect.graphics.endFill();
      addChild( maskRect );
  
      var logoLoader:Loader = new Loader();
      logoLoader.mask = maskRect;
      var url:String = "http://media.wiley.com/assets/253/59/wrox_logo.gif";
      var urlReq:URLRequest = new URLRequest( url );
      logoLoader.load( urlReq );
      addChild( logoLoader );
    }
  }
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.