home *** CD-ROM | disk | FTP | other *** search
/ ftp.novell.com / 2014.06.ftp.novell.com.tar / ftp.novell.com / forge / camtasia.msi / Cabs.w1.cab / camtasia_player_ext.swf9 / scripts / __Packages / com / techsmith / ui / BitmapReflection.as < prev    next >
Text File  |  2009-08-17  |  3KB  |  89 lines

  1. class com.techsmith.ui.BitmapReflection extends com.techsmith.ui.Bitmap
  2. {
  3.    function BitmapReflection()
  4.    {
  5.       super();
  6.       if(this.source != undefined && (this.constraintSize != undefined && this.constraintPlane != undefined))
  7.       {
  8.          this.createBitmap(this.source,this.constraintSize,this.constraintPlane);
  9.       }
  10.    }
  11.    static function create(container, name, depth, init)
  12.    {
  13.       Object.registerClass("BitmapReflection",com.techsmith.ui.BitmapReflection);
  14.       var _loc6_ = container.attachMovie("BitmapReflection",name,depth,init);
  15.       return com.techsmith.ui.BitmapReflection(_loc6_);
  16.    }
  17.    function createBitmap(bitmapSource, size, plane)
  18.    {
  19.       this.source = bitmapSource;
  20.       this.constraintSize = size;
  21.       this.constraintPlane = plane;
  22.       var _loc5_ = this.source._width;
  23.       var _loc6_ = this.source._height;
  24.       if(this.constraintPlane == com.techsmith.ui.Bitmap.HORIZONTAL_CONSTRAINT)
  25.       {
  26.          var _loc7_ = size / _loc5_;
  27.       }
  28.       else
  29.       {
  30.          _loc7_ = size / _loc6_;
  31.       }
  32.       var _loc8_ = _loc5_ * _loc7_;
  33.       var _loc9_ = _loc6_ * _loc7_;
  34.       this.width = _loc8_;
  35.       this.height = _loc9_;
  36.       var _loc10_ = new flash.geom.Rectangle(0,0,_loc8_,_loc9_);
  37.       var _loc11_ = new flash.geom.Matrix();
  38.       _loc11_.scale(_loc7_,_loc7_);
  39.       var _loc12_ = this.createEmptyMovieClip("alphaMovie",100);
  40.       this.createShape(_loc10_,_loc12_);
  41.       this.alphaBitmap = new flash.display.BitmapData(_loc8_,_loc9_,true,0);
  42.       this.alphaBitmap.fillRect(_loc10_,0);
  43.       this.alphaBitmap.draw(_loc12_,new flash.geom.Matrix());
  44.       this.tempBitmap = new flash.display.BitmapData(_loc8_,_loc9_,true,0);
  45.       this.tempBitmap.fillRect(_loc10_,0);
  46.       this.tempBitmap.draw(this.source,_loc11_);
  47.       this.bitmap = new flash.display.BitmapData(_loc8_,_loc9_,true,0);
  48.       this.bitmap.fillRect(_loc10_,0);
  49.       this.bitmap.copyPixels(this.tempBitmap,_loc10_,new flash.geom.Point(),this.alphaBitmap,new flash.geom.Point(),true);
  50.       _loc12_.removeMovieClip();
  51.       this.alphaBitmap.dispose();
  52.       this.tempBitmap.dispose();
  53.       this.reflection = this.createEmptyMovieClip("reflection",1);
  54.       this.reflection.attachBitmap(this.bitmap,1);
  55.       _loc11_ = new flash.geom.Matrix();
  56.       _loc11_.d = -1;
  57.       this.reflection.transform.matrix = _loc11_;
  58.       this.reflection._y = _loc9_;
  59.       this.reflection._alpha = this.alpha;
  60.       this.dispatchEvent({target:this,type:com.techsmith.events.Events.COMPLETE});
  61.    }
  62.    function createShape(rect, target)
  63.    {
  64.       var _loc4_ = new flash.geom.Matrix();
  65.       _loc4_.createGradientBox(rect.width,rect.height * this.gradientFalloff,Math.PI / 2,0,rect.height * (1 - this.gradientFalloff));
  66.       this.fillShape(target,rect,_loc4_);
  67.    }
  68.    function fillShape(target, rect, matrix)
  69.    {
  70.       target.beginGradientFill("linear",[16777215,16777215],[this.gradientFade,100],[0,255],matrix);
  71.       target.moveTo(rect.x,rect.y);
  72.       target.lineTo(rect.width,rect.y);
  73.       target.lineTo(rect.width,rect.height);
  74.       target.lineTo(rect.x,rect.height);
  75.       target.endFill();
  76.    }
  77.    function createRect(source)
  78.    {
  79.       return new flash.geom.Rectangle(0,0,source._width,source._height);
  80.    }
  81.    function destroy()
  82.    {
  83.       this.alphaBitmap.dispose();
  84.       this.tempBitmap.dispose();
  85.       this.reflection.removeMovieClip();
  86.       super.destroy();
  87.    }
  88. }
  89.