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
/
ImageSlice.as
< prev
next >
Wrap
Text File
|
2009-08-17
|
2KB
|
77 lines
class com.techsmith.ui.ImageSlice extends com.techsmith.ui.Component
{
var bitmap = null;
var tempBmp = null;
var bitmapClip = null;
var maskClip = null;
var pixels = 50;
var width = null;
var height = null;
function ImageSlice()
{
super();
}
static function create(container, name, depth, init)
{
Object.registerClass("ImageSlice",com.techsmith.ui.ImageSlice);
var _loc6_ = container.attachMovie("ImageSlice",name,depth,init);
return com.techsmith.ui.ImageSlice(_loc6_);
}
function createBitmap(src, rect)
{
if(src instanceof MovieClip)
{
var _loc5_ = MovieClip(src)._width;
var _loc6_ = MovieClip(src)._height;
var _loc4_ = 1;
}
else if(src instanceof flash.display.BitmapData)
{
_loc5_ = flash.display.BitmapData(src).width;
_loc6_ = flash.display.BitmapData(src).height;
_loc4_ = 2;
}
else if(src instanceof com.techsmith.ui.Bitmap)
{
_loc5_ = com.techsmith.ui.Bitmap(src).width;
_loc6_ = com.techsmith.ui.Bitmap(src).height;
_loc4_ = 3;
}
if(rect == null)
{
rect = new flash.geom.Rectangle(0,(_loc6_ - this.pixels) / 2,_loc5_,this.pixels);
}
this.bitmap = new flash.display.BitmapData(rect.width,rect.height,true,0);
this.width = rect.width;
this.height = rect.height;
if(_loc4_ == 2)
{
this.bitmap.copyPixels(flash.display.BitmapData(src),rect,new flash.geom.Point(0,0));
}
else
{
this.tempBmp = new flash.display.BitmapData(_loc5_,_loc6_,true,0);
this.tempBmp.draw(src);
this.bitmap.copyPixels(this.tempBmp,rect,new flash.geom.Point(0,0));
this.tempBmp.dispose();
}
this.bitmapClip = this.createEmptyMovieClip("bitmapClip",1);
this.bitmapClip.attachBitmap(this.bitmap,1);
}
function mask(maskID)
{
this.maskClip = this.attachMovie(maskID,"maskClip",2);
this.bitmapClip.setMask(this.maskClip);
}
function setPixels(p)
{
this.pixels = p;
}
function destroy()
{
this.bitmapClip.removeMovieClip();
this.bitmap.dispose();
super.destroy();
}
}