addedi,_dwkernelbase.dll故障;edi-y=24*j;

 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
密闭式植物工厂中药用铁皮石斛组培生产的适宜光照环境
下载积分:1698
内容提示:密闭式植物工厂中药用铁皮石斛组培生产的适宜光照环境
文档格式:PDF|
浏览次数:0|
上传日期: 21:27:36|
文档星级:
该用户还上传了这些文档
密闭式植物工厂中药用铁皮石斛组培生产的适宜光照环境
官方公共微信 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
up-regulated manganese superoxide dismutase expression increases apoptosis resis.
下载积分:2000
内容提示:up-regulated manganese superoxide dismutase expression increases apoptosis resistance in human esophageal squamous cell carcinom
文档格式:PDF|
浏览次数:0|
上传日期: 04:32:10|
文档星级:
该用户还上传了这些文档
up-regulated manganese superoxide dismutase expres
官方公共微信 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
ColE1型质粒DNA复制调控、制备与肠道吸收研究
下载积分:8000
内容提示:ColE1型质粒DNA复制调控、制备与肠道吸收研究
文档格式:PDF|
浏览次数:4|
上传日期: 00:59:41|
文档星级:
该用户还上传了这些文档
ColE1型质粒DNA复制调控、制备与肠道吸收研究
官方公共微信AS3制作的头像上传(裁切)工具 - 小枫_AS3.0 - 博客园
效果演示:
主文件:Main.as
import flash.display.S
import flash.display.StageA
import flash.display.StageScaleM
import flash.events.MouseE
import flash.net.FileF
import flash.net.FileR
import flash.events.E
import flash.display.B
import flash.utils.setI
import flash.utils.clearI
import flash.utils.setT
import flash.display.BlendM
import flash.geom.R
import flash.utils.getQualifiedClassN
import flash.display.BitmapD
import flash.geom.M
import flash.utils.ByteA
import flash.net.URLR
import flash.net.URLRequestM
import flash.net.URLLoaderDataF
import flash.net.URLL
import flash.net.URLV
import flash.events.IOErrorE
import flash.text.TextF
import com.net.NativeContentL
import com.ui.interfaces.I
import com.ui.TextStuta.CurrentI
import com.tools.ImageS
import com.tools.CutI
import com.EditB
import com.images.PNGE
import com.images.Base64;
import com.greensock.TweenL
import com.greensock.easing.*;
public class Main extends Sprite
private var init:I
private var fileType:FileF
private var file:FileR
private var nativeLoader:NativeContentL
public static var bitmap:B
private var IntervalID:
private var Image:S
private var bounds:EditB
private var obj:S
private var ImageOriginalWidth:Number = 0;
private var ImageOriginalHeight:Number = 0;
private var cutStatu:int = 1;
private var alphaMask:S
private var ImageSizes:A
private var objectSize:Array = new Array();
private var ImageArray:Array = new Array();
private var url:String = "UploadHandler.ashx";
public function Main():void
this.stage.align = StageAlign.TOP_LEFT;
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.init = new Interface();
this.addChild(this.init);
this.fileType = new FileFilter("图片文件(*.*.*.png)","*.*.*.png");
this.ImageSizes = new Array([50,50],[100,100],[140,140]);
CheckCamera();
private function CheckCamera():void
this.Image = new Sprite();
this.init.uploadphotos.addEventListener(MouseEvent.CLICK,uploadphotos_click);
private function uploadphotos_click(evt:MouseEvent):void
this.init.uploadphotos.removeEventListener(MouseEvent.CLICK,uploadphotos_click);
this.file = new FileReference();
this.file.PLETE,CompleteHalder);
this.file.addEventListener(Event.CANCEL,CancelHalder);
this.file.addEventListener(Event.SELECT,SelectHalder);
this.file.browse([this.fileType]);
CurrentInfo.textInfo.text = "温馨提示:只能选择jpge、jpg、png格式图片,暂不支持其他格式";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function SelectHalder(evt:Event):void
this.file.removeEventListener(Event.CANCEL,CancelHalder);
this.file.removeEventListener(Event.SELECT,SelectHalder);
CurrentInfo.textInfo.text = "正在加载图片,请稍后...";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
this.file.load();
private function CancelHalder(evt:Event):void
this.init.uploadphotos.addEventListener(MouseEvent.CLICK,uploadphotos_click);
this.file.removeEventListener(Event.CANCEL,CancelHalder);
this.file.removeEventListener(Event.SELECT,SelectHalder);
CurrentInfo.textInfo.text = "已取消选择";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function CompleteHalder(evt:Event):void
this.file.PLETE,CompleteHalder);
CurrentInfo.textInfo.text = "加载完成,请稍等...";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
this.nativeLoader = new NativeContentLoader();
this.nativeLoader.load(this.file.data);
this.IntervalID = setInterval(checkImageIsNull,1000);
private function checkImageIsNull():void
if (bitmap != null)
clearInterval(this.IntervalID);
InitEditBounds();
private function InitEditBounds():void
this.init.removeBigBtn();
this.init.UIInit();
this.init.grayPlaid.addChild(this.Image);
this.ImageOriginalWidth = bitmap.
this.ImageOriginalHeight = bitmap.
this.Image.addChild(bitmap);
bitmap.smoothing =
bitmap.x = (-bitmap.width)/2;
bitmap.y = (-bitmap.height)/2;
this.Image.x = 198;
this.Image.y = 158;
alphaMask = new Sprite();
alphaMask.graphics.beginFill(0x.5);
alphaMask.graphics.drawRect(2.3,43,396,230);
alphaMask.graphics.endFill();
this.addChild(alphaMask);
this.obj = new Sprite();
this.obj.graphics.beginFill(0xFFFFFF);
this.obj.graphics.drawRect(0,0,140,140);
this.obj.graphics.endFill();
this.obj.x = 130.3;
this.obj.y = 88;
alphaMask.blendMode = BlendMode.LAYER;
alphaMask.addChild(this.obj);
this.obj.blendMode = BlendMode.ERASE;
this.bounds = new EditBounds();
this.bounds.target = this.
this.addChild(this.bounds);
this.bounds.maxWidth = 230;
this.bounds.maxHeight = 230;
this.bounds.minWidth = 50;
this.bounds.minHeight = 50;
if(this.Image.width & 60 || this.Image.height & 60)
setBoundsSize();
CalculateBounds();
AddEventListener();
CurrentInfo.textInfo.text = "提示:点击&确定&按钮进行裁剪、点击&恢复&按钮恢复初始化状态";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
setTimeout(function ():void
CurrentInfo.textInfo.text = "请选择图片合适位置进行裁剪头像(140*140)";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function AddEventListener():void
this.init.leftSpinVessel.buttonMode =
this.init.leftSpinVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.leftSpinVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.leftSpinVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.rightSpinVessel.buttonMode =
this.init.rightSpinVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.rightSpinVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.rightSpinVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.zoomVessel.buttonMode =
this.init.zoomVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.zoomVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.zoomVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.narrowVessel.buttonMode =
this.init.narrowVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.narrowVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.narrowVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.clearsVessel.buttonMode =
this.init.clearsVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.clearsVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.clearsVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.okVessel.buttonMode =
this.init.okVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.okVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.okVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
this.init.backsVessel.buttonMode =
this.init.backsVessel.addEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.backsVessel.addEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.backsVessel.addEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
private function FunctionHalder(evt:MouseEvent):void
if (evt.type == "mouseOver")
TweenLite.to(evt.currentTarget.getChildAt(0),0.5,{alpha:1,ease:Back.easeOut});
else if (evt.type == "mouseOut")
TweenLite.to(evt.currentTarget.getChildAt(0),1.5,{alpha:0,ease:Back.easeOut});
else if (evt.type == "click")
switch (getQualifiedClassName(evt.target))
case "leftSpin" :
this.leftRotationFunc();
setBoundsSize();
CalculateBounds();
case "rightSpin" :
this.rightRotationFunc();
setBoundsSize();
CalculateBounds();
case "zoom" :
this.zoomInFunc();
CalculateBounds();
case "narrow" :
this.zoomOutFunc();
CalculateBounds();
if (this.cutStatu == 1)
this.obj.width = this.obj.height = 50;
this.obj.x = 175.3;
this.obj.y = 133;
this.bounds.target = this.
case "clears" :
if (this.cutStatu == 1)
if (this.init.PreviewImage1.numChildren != 0)
this.init.PreviewImage1.removeChildAt(0);
if (this.init.PreviewImage2.numChildren != 0)
this.init.PreviewImage2.removeChildAt(0);
if (this.init.PreviewImage3.numChildren != 0)
this.init.PreviewImage3.removeChildAt(0);
this.Image.rotation = 0;
ImageSize.setImageSize(this.Image,396,230,this.Image.width,this.Image.height);
this.Image.x = 198;
this.Image.y = 158;
this.obj.width = this.obj.height = 140;
this.obj.x = 130.3;
this.obj.y = 88;
this.bounds.target = this.
CalculateBounds();
this.cutStatu = 1;
CurrentInfo.textInfo.text = "请选择图片合适位置进行裁剪";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
case "ok" :
if (this.cutStatu &= 2)
var cutbitmapdata:BitmapData = CutImage.cutOutSuper(this.Image,this.obj);
if (this.cutStatu == 1)
this.objectSize[0] = ([this.obj.width,this.obj.height]);
this.objectSize[1] = ([this.obj.width,this.obj.height]);
this.objectSize[2] = ([this.obj.width,this.obj.height]);
var bitmap:Bitmap = new Bitmap(cutbitmapdata);
bitmap.smoothing =
bitmap.width = bitmap.height = 100;
this.init.PreviewImage2.addChild(bitmap);
bitmap.x = bitmap.y = 1;
var bitmap2:Bitmap = new Bitmap(cutbitmapdata);
bitmap2.smoothing =
bitmap2.width = bitmap2.height = 50;
this.init.PreviewImage1.addChild(bitmap2);
bitmap2.x = bitmap2.y = 1;
this.ImageArray.push(bitmap2);
this.ImageArray.push(bitmap);
var bitmap3:Bitmap = new Bitmap(cutbitmapdata);
bitmap3.smoothing =
bitmap3.width = bitmap3.height = 140;
this.init.PreviewImage3.addChild(bitmap3);
bitmap3.x = bitmap3.y = 1;
this.ImageArray.push(bitmap3);
this.init.CreatePreviewImage();
this.init.grayPlaid.removeChild(this.Image);
this.removeChild(this.bounds);
this.bounds =
this.removeChild(this.alphaMask);
this.init.deleteGrayPlaid();
this.init.addGrayDisplay();
CurrentInfo.textInfo.text = "形象照裁剪成功!系统为您生成三种尺寸(140*140、100*100、50*50)";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
setTimeout(function ():void
CurrentInfo.textInfo.text = "提示:点击确定按钮进行保存,不满意点击返回按钮重新编辑";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
else if (this.cutStatu == 2)
this.init.addOtherGrayDisplay();
saveImage();
this.cutStatu++;
case "backs" :
if (this.cutStatu == 1)
deleteUIButton();
this.init.grayPlaid.removeChild(this.Image);
this.Image =
this.init.deleteGrayPlaid();
while (this.numChildren & 1)
this.removeChildAt(1);
this.init.addChildSeleteImage();
this.CheckCamera();
else if (this.cutStatu == 2)
this.deleteArrayAllElement(this.ImageArray);
this.init.deletePreviewImage();
this.init.addGrayPlaid();
this.init.grayPlaid.addChild(this.Image);
this.addChild(this.alphaMask);
this.Image.rotation = 0;
ImageSize.setImageSize(this.Image,396,230,this.Image.width,this.Image.height);
this.Image.x = 198;
this.Image.y = 158;
this.obj.width = this.obj.height = 140;
this.obj.x = 130.3;
this.obj.y = 88;
this.bounds = new EditBounds();
this.bounds.target = this.
this.addChild(this.bounds);
this.bounds.maxWidth = 230;
this.bounds.maxHeight = 230;
this.bounds.minWidth = 50;
this.bounds.minHeight = 50;
CalculateBounds();
this.init.removeGrayDisplay();
this.cutStatu = 1;
CurrentInfo.textInfo.text = "请选择图片合适位置进行裁剪(140*140)";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function deleteUIButton():void
while (this.init.count.numChildren &0)
if (getQualifiedClassName(this.init.count.getChildAt(0)) == "flash.display::Sprite")
if (this.init.count.getChildAt(0).hasEventListener(MouseEvent.CLICK))
this.init.count.getChildAt(0).removeEventListener(MouseEvent.CLICK,FunctionHalder);
this.init.count.getChildAt(0).removeEventListener(MouseEvent.MOUSE_OVER,FunctionHalder);
this.init.count.getChildAt(0).removeEventListener(MouseEvent.MOUSE_OUT,FunctionHalder);
var Nulls:* = this.init.count.getChildAt(0);
this.init.count.removeChildAt(0);
private function CalculateBounds():void
var numx:Number = this.Image.x - this.Image.width / 2;
var numy:Number = this.Image.y - this.Image.height / 2;
var numw:Number = this.Image.width +
var numh:Number = this.Image.height +
if (numx &= 2.3)
numx = 2.3;
numw = 398.3;
if (numy &= 43)
numy = 43;
numh = 273;
this.bounds.selectBounds = new Rectangle(numx,numy,numw,numh);
private function zoomInFunc(num:Number = 1.1)
if (this.Image.width & this.ImageOriginalWidth && this.Image.height & this.ImageOriginalHeight)
var scaleNum:Number = this.Image.scaleY *
this.Image.scaleY = this.Image.scaleY *
this.Image.scaleX = scaleN
private function zoomOutFunc(num:Number = 0.9)
if (this.Image.width & 54 && this.Image.height & 54)
var num1:Number = this.Image.scaleY *
this.Image.scaleY *=
this.Image.scaleX = num1;
if(this.Image.width & this.Image.height)
this.bounds.maxWidth = this.bounds.maxHeight = this.Image.
this.bounds.maxWidth = this.bounds.maxHeight = this.Image.
private function leftRotationFunc(num = 90)
this.Image.rotation -=
private function rightRotationFunc(num = 90)
this.Image.rotation +=
private function setBoundsSize():void
if(this.Image.width != this.Image.height)
this.obj.width = this.obj.height = 50;
this.obj.x = 175.3;
this.obj.y = 133;
this.bounds.target = this.
//删除数组中所有元素方法
private function deleteArrayAllElement(array:Array):void
while(array.length != 0)
array.splice(0,array.length);
/*if(array.length == 0)
trace("删除完成");
private function saveImage():void
if (this.ImageArray != null)
var mydata:URLVariables = new URLVariables();
for(var i:int = 0;i&this.ImageArray.i++)
var numw:Number = this.ImageSizes[i][0] / this.objectSize[i][0];
var numh:Number = this.ImageSizes[i][1] / this.objectSize[i][1];
var bitmapdata:BitmapData = new BitmapData(this.ImageSizes[i][0],this.ImageSizes[i][1],true,0x00);
bitmapdata.draw(this.ImageArray[i],new Matrix(numw,0,0,numh));
var _data:ByteArray = PNGEncoder.encode(bitmapdata);
var pngString:String = Base64.encodeByteArray(_data);
if(i == 0)
mydata.small = pngS
else if(i == 1)
mydata.medium = pngS
else if(i == 2)
mydata.big = pngS
bitmapdata.dispose();
bitmapdata =
var _request:URLRequest = new URLRequest(this.url);
//_request.contentType = "application/octet-stream";
_request.data =
_request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(_request);
loader.addEventListener(IOErrorEvent.IO_ERROR,UpLoadFailedHalder);
loader.PLETE,UpLoadCompleteHalder);
catch (error:ArgumentError)
CurrentInfo.textInfo.text = "Error:参数错误!请联系管理员!";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
catch (error:SecurityError)
CurrentInfo.textInfo.text = "Error:安全性错误!请联系管理员!";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function UpLoadFailedHalder(evt:IOErrorEvent):void
evt.target.removeEventListener(IOErrorEvent.IO_ERROR,UpLoadFailedHalder);
CurrentInfo.textInfo.text = "图片上传失败,请检查网络!";
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
private function UpLoadCompleteHalder(evt:Event):void
evt.target.PLETE,UpLoadCompleteHalder);
evt.target.close();
CurrentInfo.textInfo.text = (evt.target as URLLoader).
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
  其他类:
package com.net
import flash.display.B
import flash.display.L
import flash.display.S
import flash.events.E
import flash.events.IOErrorE
import flash.net.URLL
import flash.net.URLLoaderDataF
import flash.system.LoaderC
import flash.system.SecurityD
import flash.system.ApplicationD
import flash.utils.ByteA
* 装载加载进来的图片
* @author xiaofeng
public class NativeContentLoader extends Sprite
private var loaderContext:LoaderC
private var loader:L
private var URLloader:URLL
public function NativeContentLoader()
this.loaderContext = new LoaderContext(true);
this.loader = new Loader();
this.URLloader = new URLLoader();
this.loaderContext.securityDomain = SecurityDomain.currentD
this.loaderContext.applicationDomain = ApplicationDomain.currentD
this.loader.contentLoaderInfo.PLETE, Loader_Complete);
this.loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, Loader_IOERROR);
this.URLloader.PLETE, URLloader_Compelte);
this.URLloader.dataFormat = URLLoaderDataFormat.BINARY;
private function Loader_Complete(evt:Event):void
Main.bitmap = evt.target.
catch (e:SecurityError)
this.dispatchEvent(new Event("SecurityError"));
private function Loader_IOERROR(evt:IOErrorEvent):void
//忽略错误
evt.target.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, Loader_IOERROR);
private function URLloader_Compelte(evt:Event):void
var byteArray:ByteA
byteArray = new ByteArray();
byteArray.writeBytes(evt.target.data);
byteArray.position = 0;
this.loader.loadBytes(byteArray);
catch (e:SecurityError)
this.dispatchEvent(new Event("SecurityError"));
evt.target.PLETE, URLloader_Compelte);
public function load(byteArray:ByteArray):void
this.unload();
this.loader.loadBytes(byteArray);
private function unload():void
this.loader.unload();
package com.tools
import flash.display.BitmapD
import flash.display.DisplayO
import flash.geom.M
import flash.geom.R
import flash.display.S
* 裁剪图片类
* @author 转载(稍作修改)
public class CutImage
public function CutImage()
裁剪指定矩形区域并返回一个包含结果的 BitmapData 对象。
@param target 需要裁剪的显示对象。
@param width 位图图像的宽度,以像素为单位。
@param height 位图图像的高度,以像素为单位。
@param distanceX 切割矩形左上角的点到显示对象矩形左上角的点的水平距离。注意:左上角的点不一定就是注册点(0, 0)外,变形过的显示对象就是一个例外。
@param distanceY 切割矩形左上角的点到显示对象矩形左上角的点的垂直距离。注意:左上角的点不一定就是注册点(0, 0)外,变形过的显示对象就是一个例外。
@param transparent 指定裁剪后的位图图像是否支持每个像素具有不同的透明度。默认值为 true(透明)。若要创建完全透明的位图,请将 transparent 参数的值设置为 true,将 fillColor 参数的值设置为 0x(或设置为 0)。将 transparent 属性设置为 false 可以略微提升呈现性能。
@param fillColor 用于填充裁剪后的位图图像区域背景的 32 位 ARGB 颜色值。默认值为 0x(纯透明黑色)。
@returns 返回裁剪后的 BitmapData 对象。
public static function cutOutRect( target:DisplayObject, distanceX:Number, distanceY:Number, width:Number, height:Number, transparent:Boolean = true, fillColor:uint = 0x ):BitmapData
var m:Matrix = target.transform.
m.tx -= target.getBounds( target.parent ).x + distanceX;
m.ty -= target.getBounds( target.parent ).y + distanceY;
var bmpData:BitmapData = new BitmapData( width, height, transparent, fillColor );
bmpData.draw( target, m);
return bmpD
超级裁剪工具!可裁剪任意形状!给定一个裁剪目标和一个模板,就可根据模板裁剪出形状相配的 BitmapData 数据。
@param target 需要裁剪的显示对象。
@param template 裁剪模板,可以是任意形状。
@returns 返回裁剪后的 BitmapData 对象。
public static function cutOutSuper( target:DisplayObject, template:DisplayObject):BitmapData
var rectTarget:Rectangle = target.transform.pixelB
var rectTemplate:Rectangle = template.transform.pixelB
var targetBitmapData:BitmapData = CutImage.cutOutRect( target, 0, 0, rectTarget.width, rectTarget.height, true, 0x );
var templateBitmapData:BitmapData = CutImage.cutOutRect( target, 0, 0, rectTemplate.width, rectTemplate.height, true, 0x );
for( var pixelY:int = 0; pixelY & rectTemplate. pixelY++ )
for( var pixelX:int = 0; pixelX & rectTemplate. pixelX++ )
if( templateBitmapData.getPixel( pixelX, pixelY ) != 0 )
var color:uint = targetBitmapData.getPixel32( pixelX + rectTemplate.x - rectTarget.x, pixelY + rectTemplate.y - rectTarget.y );
templateBitmapData.setPixel32( pixelX, pixelY, color );
return templateBitmapD
package com.tools
import flash.display.S
import flash.display.S
*绘制格式图形类
*@Author:xiaofeng
public class Draws
public function Draws():void
*绘制黑白格方法,X、Y:返回的Sprite对象的x轴和y轴坐标,Width、Height:返回的Sprite的总宽度以及高度,PixelSize:绘制格子的大小,以像素为单位
public static function DrawLattice(X:Number = 0,Y:Number = 0,Width:int = 100,Height:int = 100,PixelSize:int = 5):Sprite
//管理小格子对象
var LatticeCount:Sprite = new Sprite();
//计算外层需要循环的次数
var num:int = Height / PixelS
//计算内层需要循环的次数
var num2:int = Width / PixelS
//保存颜色值,初始为白色
var colors:uint = 0xFFFFFF;
for (var i:int = 0; i& i++)
for (var j:int = 0; j&num2; j++)
var SmallLattice:Shape = new Shape();
//判断颜色是黑还是白
colors = 0xC0C0C0;
colors = 0xFFFFFF;
if( j % 2)
colors = 0xFFFFFF;
colors = 0xC0C0C0;
SmallLattice.graphics.beginFill(colors);
SmallLattice.graphics.drawRect(X,Y,PixelSize,PixelSize);
SmallLattice.graphics.endFill();
LatticeCount.addChild(SmallLattice);
SmallLattice.x = j * PixelS
SmallLattice.y = i * PixelS
return LatticeC
* 绘制矩形线框方法
public static function DrawRects(w:Number, h:Number):Sprite
var rect:Sprite = new Sprite();
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.lineStyle(1, 0x000000);
rect.graphics.drawRect(0, 0, w, h);
rect.graphics.endFill();
package com.tools
import flash.display.S
* 设置图片大小类
* @author xiaofeng
public class ImageSize
public function ImageSize()
* 参数说明
* @param Image:需要设置大小的显示对象
* @param FrameWidth:框架宽度
* @param FrameHeight:框架高度
* @param ImageWidth:图片加载进来时宽度
* @param ImageHeight:图片加载进来时高度
public static function setImageSize(Image:*,FrameWidth:Number,FrameHeight:Number,ImageWidth:Number, ImageHeight:Number):void
if ((ImageWidth / ImageHeight) & (FrameWidth / FrameHeight))
Image.width = FrameW
Image.height = FrameWidth / (ImageWidth / ImageHeight);
else if ((ImageWidth / ImageHeight) & (FrameWidth / FrameHeight))
Image.height = FrameH
Image.width = FrameHeight * (ImageWidth / ImageHeight);
else if ((ImageWidth / ImageHeight) == (FrameWidth / FrameHeight))
Image.width = FrameW
Image.height = FrameH
package com.tools
import flash.display.B
import flash.display.BitmapD
import flash.display.DisplayO
import flash.display.S
import flash.display.S
import flash.geom.M
import flash.display.G
import flash.geom.P
import flash.display.GradientT
* 反射倒影生成类...
public class Reflection extends Sprite
private var _reflection:B
private var _bit:BitmapD
private var _mtx:M
private var _rBox:S
private var _Alpha:BitmapD
public function Reflection($Target:DisplayObject,$Height:Number=200,$Alpha:Number=1,AddHeight:Number =0):void
_reflection = new Bitmap(getReflection($Target,$Height));//
_reflection.smoothing =//平滑
_reflection.alpha = $A
addChild(_reflection);
this.x = $Target.x;
this.y = $Target.y + $Target.height + AddH
private function getReflection(target:DisplayObject, Height:Number = -1):BitmapData
if (Height & 0)
Height = target.
_bit = new BitmapData(target.width,Height,true,0);
_bit.draw(target, new Matrix(1, 0, 0, -1, 0, target.height));
_mtx = new Matrix();
_mtx.createGradientBox(target.width, Height, 0.5 * Math.PI);
_rBox = new Shape();
_rBox.graphics.beginGradientFill(GradientType.LINEAR, [0, 0], [0.5, 0], [0, 255], _mtx);
_rBox.graphics.drawRect(0, 0, target.width, Height);
_rBox.graphics.endFill();
_Alpha = new BitmapData(target.width,Height,true,0);
_Alpha.draw(_rBox);
_bit.copyPixels(_bit, _bit.rect, new Point(0, 0), _Alpha, new Point(0, 0), false);
return _bit.clone();
  ui包中的类:
package com.ui.interfaces
import flash.display.S
import com.ui.*;
import com.tools.R
import com.tools.D
import com.ui.TextStuta.CurrentI
import flash.display.B
import flash.text.TextFormatA
import flash.display.S
public class Interface extends Sprite
public var count:Sprite = new Sprite();
public var uploadphotos:UpLoadP
public var uploadphotos_ref:R
public var leftSpinVessel:S
private var leftSpinBtn:leftS
private var leftSpinGray:leftSpin_
public var rightSpinVessel:S
private var rightSpinBtn:rightS
private var rightSpinGray:rightSpin_
public var zoomVessel:S
private var zoomBtn:
private var zoomGray:zoom_
public var narrowVessel:S
private var narrowBtn:
private var narrowGray:narrow_
public var clearsVessel:S
private var clearsBtn:
private var clearsGray:clears_
public var okVessel:S
private var okBtn:
private var okGray:ok_
public var backsVessel:S
private var backsBtn:
private var backsGray:backs_
public var PreviewImage1:S//50*50
public var PreviewImage2:S//100*100
public var PreviewImage3:S//140*140
private var PreviewImage1_ref:R
private var PreviewImage2_ref:R
private var PreviewImage3_ref:R
public var grayPlaid:S
private var Int:int = 1;
public function Interface():void
var backGround:Bitmap = new Bitmap(new BG());
this.addChild(backGround);
var logo:Bitmap = new Bitmap(new Logo());
this.addChild(logo);
logo.x = 6;
logo.y = 2;
this.uploadphotos = new UpLoadPhotos();
this.addChild(this.uploadphotos);
this.uploadphotos.buttonMode =
this.uploadphotos.x = (400 - this.uploadphotos.width)/2;
this.uploadphotos.y = (300 - this.uploadphotos.height)/2;
this.uploadphotos_ref = new Reflection(this.uploadphotos,30,0.7);
this.addChild(this.uploadphotos_ref);
CurrentInfo.textInfoFormat.size = 12;
CurrentInfo.textInfoFormat.color = 0x999999;
CurrentInfo.textInfoFormat.font = "仿宋";
CurrentInfo.textInfoFormat.align = TextFormatAlign.LEFT;
CurrentInfo.textInfo.text = "温馨提示:上传的图片尽量大于140*140像素";
CurrentInfo.textInfo.selectable =
CurrentInfo.textInfo.mouseEnabled =
CurrentInfo.textInfo.width = 400;
CurrentInfo.textInfo.setTextFormat(CurrentInfo.textInfoFormat);
this.addChild(CurrentInfo.textInfo);
CurrentInfo.textInfo.x = 4;
CurrentInfo.textInfo.y = 276;
this.PreviewImage1 = Draws.DrawRects(51,51);
this.PreviewImage2 = Draws.DrawRects(101,101);
this.PreviewImage3 = Draws.DrawRects(141,141);
public function addChildSeleteImage():void
this.addChild(this.uploadphotos);
this.addChild(this.uploadphotos_ref);
public function removeBigBtn():void
if(this.uploadphotos.parent != null)
this.removeChild(this.uploadphotos);
this.removeChild(this.uploadphotos_ref);
public function UIInit():void
this.addChild(this.count);
grayPlaid = Draws.DrawLattice(2.3,43,396,230);
this.addChild(grayPlaid);
var Mask:Shape = new Shape();
Mask.graphics.beginFill(0x000000);
Mask.graphics.drawRect(2.3,43,396,230);
Mask.graphics.endFill();
this.addChild(Mask);
grayPlaid.mask = M
this.leftSpinVessel = new Sprite();
this.count.addChild(this.leftSpinVessel);
this.leftSpinVessel.x = 40;
this.leftSpinVessel.y = 2;
var leftAlphaBG:alphaBG = new alphaBG();
this.leftSpinVessel.addChild(leftAlphaBG);
leftAlphaBG.alpha = 0;
leftSpinBtn = new leftSpin();
this.leftSpinVessel.addChild(leftSpinBtn);
leftSpinBtn.x = (leftAlphaBG.width - leftSpinBtn.width)/2;
leftSpinBtn.y = (leftAlphaBG.height - leftSpinBtn.height)/2;
var line1:line = new line();
this.count.addChild(line1);
line1.x = this.leftSpinVessel.x + this.leftSpinVessel.width + 3;
this.rightSpinVessel = new Sprite();
this.count.addChild(this.rightSpinVessel);
this.rightSpinVessel.x = line1.x + 4;
this.rightSpinVessel.y = this.leftSpinVessel.y;
var rightAlphaBG:alphaBG = new alphaBG();
this.rightSpinVessel.addChild(rightAlphaBG);
rightAlphaBG.alpha = 0;
rightSpinBtn = new rightSpin();
this.rightSpinVessel.addChild(rightSpinBtn);
rightSpinBtn.x = (rightAlphaBG.width - rightSpinBtn.width)/2;
rightSpinBtn.y = (rightAlphaBG.height - rightSpinBtn.height)/2;
var line2:line = new line();
this.count.addChild(line2);
line2.x = this.rightSpinVessel.x + this.rightSpinVessel.width + 3;
this.zoomVessel = new Sprite();
this.count.addChild(this.zoomVessel);
this.zoomVessel.x = line2.x + 4;
this.zoomVessel.y = this.leftSpinVessel.y;
var zoomAlphaBG:alphaBG = new alphaBG();
this.zoomVessel.addChild(zoomAlphaBG);
zoomAlphaBG.alpha = 0;
zoomBtn = new zoom();
this.zoomVessel.addChild(zoomBtn);
zoomBtn.x = (zoomAlphaBG.width - zoomBtn.width)/2;
zoomBtn.y = (zoomAlphaBG.height - zoomBtn.height)/2;
var line3:line = new line();
this.count.addChild(line3);
line3.x = this.zoomVessel.x + this.zoomVessel.width + 3;
this.narrowVessel = new Sprite();
this.count.addChild(this.narrowVessel);
this.narrowVessel.x = line3.x + 4;
this.narrowVessel.y = this.zoomVessel.y;
var narrowAlphaBG:alphaBG = new alphaBG();
this.narrowVessel.addChild(narrowAlphaBG);
narrowAlphaBG.alpha = 0;
narrowBtn = new narrow();
this.narrowVessel.addChild(narrowBtn);
narrowBtn.x = (narrowAlphaBG.width - narrowBtn.width)/2;
narrowBtn.y = (narrowAlphaBG.height - narrowBtn.height)/2;
var line4:line = new line();
this.count.addChild(line4);
line4.x = this.narrowVessel.x + this.narrowVessel.width + 3;
this.clearsVessel = new Sprite();
this.count.addChild(this.clearsVessel);
this.clearsVessel.x = line4.x + 4;
this.clearsVessel.y = this.narrowVessel.y;
var clearsAlphaBG:alphaBG = new alphaBG();
this.clearsVessel.addChild(clearsAlphaBG);
clearsAlphaBG.alpha = 0;
clearsBtn = new clears();
this.clearsVessel.addChild(clearsBtn);
clearsBtn.x = clearsAlphaBG.width/2;
clearsBtn.y = clearsAlphaBG.height/2;
var line5:line = new line();
this.count.addChild(line5);
line5.x = this.clearsVessel.x + this.clearsVessel.width + 3;
this.okVessel = new Sprite();
this.count.addChild(this.okVessel);
this.okVessel.x = line5.x + 4;
this.okVessel.y = this.clearsVessel.y;
var okAlphaBG:alphaBG = new alphaBG();
this.okVessel.addChild(okAlphaBG);
okAlphaBG.alpha = 0;
okBtn = new ok();
this.okVessel.addChild(okBtn);
okBtn.x = (okAlphaBG.width - okBtn.width)/2;
okBtn.y = (okAlphaBG.height - okBtn.height)/2;
this.backsVessel = new Sprite();
this.count.addChild(this.backsVessel);
this.backsVessel.x = this.okVessel.x + this.okVessel.width + 40;
this.backsVessel.y = this.okVessel.y;
var backsAlphaBG:backAlphaBG = new backAlphaBG();
this.backsVessel.addChild(backsAlphaBG);
backsAlphaBG.alpha = 0;
backsBtn = new backs();
this.backsVessel.addChild(backsBtn);
backsBtn.x = (backsAlphaBG.width - backsBtn.width)/2;
backsBtn.y = (backsAlphaBG.height - backsBtn.height)/2;
public function CreatePreviewImage():void
this.count.addChild(this.PreviewImage1);
this.count.addChild(this.PreviewImage2);
this.count.addChild(this.PreviewImage3);
this.PreviewImage3.x = 25;
this.PreviewImage3.y = 90;
this.PreviewImage2.x = 195;
this.PreviewImage2.y = 100;
this.PreviewImage1.x = 320;
this.PreviewImage1.y = 110;
PreviewImage1_ref = new Reflection(this.PreviewImage1,30,0.5);
PreviewImage2_ref = new Reflection(this.PreviewImage2,30,0.5);
PreviewImage3_ref = new Reflection(this.PreviewImage3,30,0.5);
this.count.addChild(PreviewImage1_ref);
this.count.addChild(PreviewImage2_ref);
this.count.addChild(PreviewImage3_ref);
public function deleteGrayPlaid():void
this.removeChild(grayPlaid);
public function addGrayPlaid():void
this.addChild(grayPlaid);
public function deletePreviewImage():void
if(this.PreviewImage3.numChildren != 0)
this.PreviewImage3.removeChildAt(0);
if(this.PreviewImage1.numChildren != 0)
this.PreviewImage1.removeChildAt(0);
if(this.PreviewImage2.numChildren != 0)
this.PreviewImage2.removeChildAt(0);
if(this.PreviewImage1.parent != null)
this.count.removeChild(this.PreviewImage1);
this.count.removeChild(this.PreviewImage2);
this.count.removeChild(this.PreviewImage3);
if(this.PreviewImage1_ref != null && this.PreviewImage1_ref.parent != null)
this.count.removeChild(this.PreviewImage1_ref);
this.count.removeChild(this.PreviewImage2_ref);
this.count.removeChild(this.PreviewImage3_ref);
public function addGrayDisplay():void
if(this.Int == 1)
this.newGray();
this.Int ++;
this.leftSpinVessel.removeChildAt(1);
this.leftSpinVessel.addChildAt(this.leftSpinGray,1);
this.rightSpinVessel.removeChildAt(1);
this.rightSpinVessel.addChildAt(this.rightSpinGray,1);
this.zoomVessel.removeChildAt(1);
this.zoomVessel.addChildAt(this.zoomGray,1);
this.narrowVessel.removeChildAt(1);
this.narrowVessel.addChildAt(this.narrowGray,1);
this.clearsVessel.removeChildAt(1);
this.clearsVessel.addChildAt(this.clearsGray,1);
public function removeGrayDisplay():void
this.leftSpinVessel.removeChildAt(1);
this.leftSpinVessel.addChildAt(this.leftSpinBtn,1);
this.rightSpinVessel.removeChildAt(1);
this.rightSpinVessel.addChildAt(this.rightSpinBtn,1);
this.zoomVessel.removeChildAt(1);
this.zoomVessel.addChildAt(this.zoomBtn,1);
this.narrowVessel.removeChildAt(1);
this.narrowVessel.addChildAt(this.narrowBtn,1);
this.clearsVessel.removeChildAt(1);
this.clearsVessel.addChildAt(this.clearsBtn,1);
public function addOtherGrayDisplay():void
this.okVessel.removeChildAt(1);
this.okVessel.addChildAt(this.okGray,1);
this.backsVessel.removeChildAt(1);
this.backsVessel.addChildAt(this.backsGray,1);
public function removeOtherGrayDisplay():void
this.okVessel.removeChildAt(1);
this.okVessel.addChildAt(this.okBtn,1);
this.backsVessel.removeChildAt(1);
this.backsVessel.addChildAt(this.backsBtn,1);
private function newGray():void
//实例化至灰按钮
this.leftSpinGray = new leftSpin_gray();
this.leftSpinGray.x = this.leftSpinVessel.getChildAt(1).x;
this.leftSpinGray.y = this.leftSpinVessel.getChildAt(1).y;
this.rightSpinGray = new rightSpin_gray();
this.rightSpinGray.x = this.rightSpinVessel.getChildAt(1).x;
this.rightSpinGray.y = this.rightSpinVessel.getChildAt(1).y;
this.zoomGray = new zoom_gray();
this.zoomGray.x = this.zoomVessel.getChildAt(1).x;
this.zoomGray.y = this.zoomVessel.getChildAt(1).y;
this.narrowGray = new narrow_gray();
this.narrowGray.x = this.narrowVessel.getChildAt(1).x;
this.narrowGray.y = this.narrowVessel.getChildAt(1).y;
this.clearsGray = new clears_gray();
this.clearsGray.x = this.clearsVessel.getChildAt(1).x;
this.clearsGray.y = this.clearsVessel.getChildAt(1).y;
this.okGray = new ok_gray();
this.okGray.x = this.okVessel.getChildAt(1).x;
this.okGray.y = this.okVessel.getChildAt(1).y;
this.backsGray = new backs_gray();
this.backsGray.x = this.backsVessel.getChildAt(1).x;
this.backsGray.y = this.backsVessel.getChildAt(1).y;
package com.ui.TextStuta
import flash.text.TextF
import flash.text.TextF
public class CurrentInfo
public static var textInfo:TextField = new TextField();
public static var textInfoFormat:TextFormat = new TextFormat();
package com.ui
import flash.display.S
import flash.display.B
import flash.display.DisplayObjectC
import flash.events.E
import flash.events.MouseE
import flash.ui.M
public class MouseCursor extends Object
public static var MOUSE_MOVING:uint = 3;
public static var MOUSE_RESIZABLE:uint = 1;
public static var MOUSE_MOVABLE:uint = 2;
private static var _status:uint = MOUSE_NORMAL;
public static var MOUSE_NORMAL:uint = 0;
public static var MOUSE_RESIZABLEH:uint = 4;
private static var _resizable:S
private static var _moving:S
private static var _movable:S
private static var _resizableh:S
public function MouseCursor()
public static function hide():void
show(MOUSE_NORMAL);
public static function setPoint(X:Number, Y:Number):void
_movable.x = Math.round(X);
_movable.y = Math.round(Y);
_resizable.x = Math.round(X);
_resizable.y = Math.round(Y);
_resizableh.x = Math.round(X);
_resizableh.y = Math.round(Y);
_moving.x = Math.round(X);
_moving.y = Math.round(Y);
public static function init(disobjc:DisplayObjectContainer):void
var bitmap:Bitmap =
if (disobjc.stage == null)
disobjc.addEventListener(Event.ADDED_TO_STAGE, addedHandler);
if (_resizable == null)
_resizable = new Sprite();
bitmap = new Bitmap(new ResizeCursor());
bitmap.x = (-bitmap.width) / 2;
bitmap.y = (-bitmap.height) / 2;
_resizable.addChild(bitmap);
_resizable.visible =
_resizable.mouseChildren =
_resizable.mouseEnabled =
disobjc.stage.addChild(_resizable);
if (_resizableh == null)
_resizableh = new Sprite();
bitmap = new Bitmap(new ResizeHCursor());
bitmap.x = (-bitmap.width) / 2;
bitmap.y = (-bitmap.height) / 2;
_resizableh.addChild(bitmap);
_resizableh.visible =
_resizableh.mouseChildren =
_resizableh.mouseEnabled =
disobjc.stage.addChild(_resizableh);
if (_movable == null)
_movable = new Sprite();
bitmap = new Bitmap(new MoveCursor());
bitmap.x = (-bitmap.width) / 2;
bitmap.y = (-bitmap.height) / 2;
_movable.addChild(bitmap);
_movable.visible =
_movable.mouseChildren =
_movable.mouseEnabled =
disobjc.stage.addChild(_movable);
if (_moving == null)
_moving = new Sprite();
bitmap = new Bitmap(new MoveCursor());
bitmap.x = (-bitmap.width) / 2;
bitmap.y = (-bitmap.height) / 2;
_moving.addChild(bitmap);
_moving.visible =
_moving.mouseChildren =
_moving.mouseEnabled =
disobjc.stage.addChild(_moving);
disobjc.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveHandler);
disobjc.stage.addEventListener(MouseEvent.CLICK, clickHandler);
disobjc.stage.addEventListener(Event.MOUSE_LEAVE, leaveHandler);
public static function leaveHandler(event:Event):void
_movable.visible =
_resizable.visible =
_resizableh.visible =
_moving.visible =
private static function addedHandler(event:Event):void
event.target.removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
MouseCursor.init(event.target as DisplayObjectContainer);
public static function clickHandler(event:MouseEvent):void
if (_status != MOUSE_NORMAL)
Mouse.hide();
setPoint(event.stageX, event.stageY);
public static function moveHandler(event:MouseEvent):void
setPoint(event.stageX, event.stageY);
_movable.visible = _status == MOUSE_MOVABLE;
_resizable.visible = _status == MOUSE_RESIZABLE;
_resizableh.visible = _status == MOUSE_RESIZABLEH;
_moving.visible = _status == MOUSE_MOVING;
event.updateAfterEvent();
public static function show(num1:uint, num2:uint = 0):void
if (num1 == MOUSE_RESIZABLE)
if (num2 % 90 == 0)
num1 = MOUSE_RESIZABLEH;
_resizableh.rotation = num2 + 90;
_resizable.rotation = num2 + 45;
if (_status == num1)
_status = num1;
if (num1 == MOUSE_RESIZABLE)
Mouse.hide();
_resizableh.visible =
_movable.visible =
_moving.visible =
_resizable.visible =
else if (num1 == MOUSE_RESIZABLEH)
Mouse.hide();
_resizable.visible =
_moving.visible =
_movable.visible =
_resizableh.visible =
else if (num1 == MOUSE_MOVABLE)
Mouse.hide();
_resizable.visible =
_resizableh.visible =
_moving.visible =
_movable.visible =
else if (num1 == MOUSE_MOVING)
Mouse.hide();
_resizable.visible =
_resizableh.visible =
_movable.visible =
_moving.visible =
_resizable.visible =
_resizableh.visible =
_movable.visible =
_moving.visible =
Mouse.show();
package com
import com.ui.MouseC
import flash.display.S
import flash.display.DisplayO
import flash.events.MouseE
import flash.events.E
import flash.geom.P
import flash.geom.R
import flash.display.S
public class EditBounds extends Sprite
private var ox:N
private var ratio:Number = 1;
private var currDir:S
public var selectWidth:Number = 100;
private var constraints:Boolean =
public var selectHeight:Number = 100;
public var line:S
private var outRangle:Boolean =
private var soy:N
private var resizeDir:O
private var cornerWidth:Number = 6;
public var minHeight:Number = 4.9;
public var maxHeight:Number = 1.7;
public var minWidth:Number = 4.9;
public var maxWidth:Number = 1.7;
private var corners:O
private var _target:DisplayO
private var sox:N
private var bounds:R
private var mousedown:Boolean =
private var oh:N
private var rox:N
private var roy:N
private var ow:N
private var oy:N
private var cursorRotations:O
public static var busy:Boolean =
public function EditBounds():void
corners = {};
cursorRotations = {lt:135,t:0,rt:45,r:90,rb:135,b:0,lb:45,l:90};
resizeDir = {lt:resize_lt,t:resize_t,rt:resize_rt,r:resize_r,rb:resize_rb,b:resize_b,lb:resize_lb,l:resize_l};
selectWidth = 100;
selectHeight = 100;
cornerWidth = 6;
maxWidth = Number.MAX_VALUE;
maxHeight = Number.MAX_VALUE;
minWidth = Number.MIN_VALUE;
minHeight = Number.MIN_VALUE;
constraints =
ratio = 1;
mousedown =
bounds = new Rectangle(0,0,100,100);
outRangle =
line = new Sprite();
line.x = cornerWidth / 2;
line.y = cornerWidth / 2;
line.graphics.beginFill(0x0000FF);
line.graphics.drawRect(0, 0, (selectWidth - 1), 1);
line.graphics.drawRect((selectWidth - 1), 0, 1, (selectHeight - 1));
line.graphics.drawRect(1, (selectHeight - 1), (selectWidth - 1), 1);
line.graphics.drawRect(0, 1, 1, (selectHeight - 1));
line.graphics.endFill();
line.graphics.beginFill(0, 0);
line.graphics.drawRect(1, 1, selectWidth - 2, selectHeight - 2);
line.graphics.endFill();
line.scale9Grid = new Rectangle(2,2,selectWidth - 4,selectHeight - 4);
corners.lt = createCorner("lt",0,0,cornerWidth);
corners.t = createCorner("t",0,0,cornerWidth);
corners.rt = createCorner("rt",0,0,cornerWidth);
corners.r = createCorner("r",0,0,cornerWidth);
corners.rb = createCorner("rb",0,0,cornerWidth);
corners.b = createCorner("b",0,0,cornerWidth);
corners.lb = createCorner("lb",0,0,cornerWidth);
corners.l = createCorner("l",0,0,cornerWidth);
addChild(line);
addChild(corners.lt);
addChild(corners.rt);
addChild(corners.rb);
addChild(corners.lb);
constraints =
addChild(corners.t);
addChild(corners.r);
addChild(corners.b);
addChild(corners.l);
MouseCursor.init(this);
resetCorner();
private function resize_lt(W:Number, H:Number):void
var num1:Number = 0;
var num2:Number = 0;
var num3:Number = 0;
var num4:Number = 0;
num1 = ow - W;
num2 = oh - H;
if (constraints)
if (Math.min(num1,num2) == num1)
num2 = Math.round(num1 / ratio);
num1 = Math.round(num2 * ratio);
if (num1 & sox + ow + cornerWidth / 2)
var num5:* = sox + ow + cornerWidth / 2;
num1 = sox + ow + cornerWidth / 2;
num2 = num5;
if (num2 & soy + oh + cornerWidth / 2)
var num6:* = soy + oh + cornerWidth / 2;
num2 = soy + oh + cornerWidth / 2;
num1 = num6;
num3 = limitedResizeWidth(num1);
num4 = limitedResizeHeight(num2);
limitedMoveX(sox + (ow - num3));
limitedMoveY(soy + (oh - num4));
_target.x = this.x;
_target.y = this.y;
private function panelMouseOverHandler(event:MouseEvent):void
if (mousedown)
MouseCursor.show(MouseCursor.MOUSE_MOVABLE);
public function set target(obj:DisplayObject):void
this.x = _target.x;
this.y = _target.y;
line.width = _target.
line.height = _target.
this.width = _target.
this.height = _target.
override public function get height():Number
return line.
private function limitedMoveX(num:Number):Number
num = Math.round(Math.max(bounds.x,num));
num = Math.round(Math.min(bounds.width - this.width,num));
var num2:* =
return num2;
private function panelMouseUpHandler(event:MouseEvent):void
stage.removeEventListener(MouseEvent.MOUSE_UP, panelMouseUpHandler);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, panelMouseMoveHandler);
mousedown =
this.dispatchEvent(new Event(Event.CHANGE));
private function limitedMoveY(num:Number):Number
num = Math.round(Math.max(bounds.y,num));
num = Math.round(Math.min(bounds.height - this.height,num));
var num2:* =
return num2;
override public function set height(num:Number):void
line.height =
resetCorner();
private function mouseMoveHandler(event:MouseEvent):void
var myx:Number = NaN;
var myy:Number = NaN;
if (mousedown)
myx = stage.mouseX;
myy = stage.mouseY;
resizeDir[currDir](Math.round(myx - ox),Math.round(myy - oy));
resetCorner();
MouseCursor.setPoint(stage.mouseX, stage.mouseY);
event.updateAfterEvent();
private function cornerMouseOverHandler(event:MouseEvent):void
if (mousedown)
MouseCursor.show(MouseCursor.MOUSE_RESIZABLE, cursorRotations[event.target.name]);
MouseCursor.setPoint(stage.mouseX, stage.mouseY);
private function createCorner(Name:String, X:Number, Y:Number, WH:Number):Sprite
var corner:Sprite =
corner = new Sprite();
corner.name = N
corner.graphics.lineStyle(1, 0xFFFFFF);
corner.graphics.beginFill(0x0000FF);
corner.graphics.drawRect(X, Y, WH, WH);
corner.graphics.endFill();
corner.addEventListener(MouseEvent.MOUSE_OVER, cornerMouseOverHandler);
corner.addEventListener(MouseEvent.MOUSE_DOWN, cornerMouseDownHandler);
corner.addEventListener(MouseEvent.MOUSE_OUT, cornerMouseOutHandler);
corner.addEventListener(MouseEvent.MOUSE_UP, cornerMouseUpHandler);
line.addEventListener(MouseEvent.MOUSE_OVER, panelMouseOverHandler);
line.addEventListener(MouseEvent.MOUSE_DOWN, panelMouseDownHandler);
line.addEventListener(MouseEvent.MOUSE_OUT, panelMouseOutHandler);
line.addEventListener(MouseEvent.MOUSE_UP, panelMouseUpHandler);
public function get changing():Boolean
override public function get x():Number
return super.x + cornerWidth / 2;
override public function get y():Number
return super.y + cornerWidth / 2;
private function panelMouseMoveHandler(event:MouseEvent):void
if (mousedown)
limitedMoveX(sox + (stage.mouseX - ox));
limitedMoveY(soy + (stage.mouseY - oy));
_target.x = this.x;
_target.y = this.y;
MouseCursor.setPoint(stage.mouseX, stage.mouseY);
event.updateAfterEvent();
private function resetCorner():void
corners.lt.x = Math.round(line.x - cornerWidth / 2);
corners.lt.y = Math.round(line.y - cornerWidth / 2);
corners.t.x = Math.round(line.width / 2);
corners.t.y = corners.lt.y;
corners.rt.x = corners.lt.x + line.
corners.rt.y = corners.lt.y;
corners.r.x = corners.rt.x;
corners.r.y = Math.round(line.height / 2);
corners.rb.x = corners.rt.x;
corners.rb.y = corners.lt.y + line.
corners.b.x = corners.t.x;
corners.b.y = corners.rb.y;
corners.lb.x = corners.lt.x;
corners.lb.y = corners.b.y;
corners.l.x = corners.lb.x;
corners.l.y = corners.r.y;
private function panelMouseDownHandler(event:MouseEvent):void
mousedown =
ox = stage.mouseX;
oy = stage.mouseY;
sox = super.x;
soy = super.y;
stage.addEventListener(MouseEvent.MOUSE_UP, panelMouseUpHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, panelMouseMoveHandler);
private function limitedResizeWidth(W:Number):Number
if (W &= minWidth)
line.width = minW
_target.width = line.
return minW
if (W &= maxWidth)
line.width = maxW
_target.width = line.
return maxW
_target.width = W;
var n:Number = W;
line.width = W;
public function get target():DisplayObject
override public function set width(Width:Number):void
line.width = W
resetCorner();
private function resize_b(W:Number, H:Number):void
var num1:Number = NaN;
var num2:Number = NaN;
var num3:Number = NaN;
if (constraints)
num2 = Math.round((oh + H) / 2) * 2;
num1 = Math.round(num2 * ratio);
if (num2 + soy & bounds.height)
var n1:Number = bounds.height -
num2 = bounds.height -
num1 = n1;
if (num1 / 2 + (sox + ow / 2) & bounds.width)
var n2:Number = (bounds.width - (sox + ow / 2)) * 2;
num1 = (bounds.width - (sox + ow / 2)) * 2;
num2 = n2;
if (sox + ow / 2 - num1 / 2 & bounds.x)
var n3:Number = (sox + ow / 2 + cornerWidth / 2) * 2;
num1 = (sox + ow / 2 + cornerWidth / 2) * 2;
num2 = n3;
num3 = limitedResizeWidth(num1);
limitedResizeHeight(num2);
limitedMoveX(sox + (ow - num3) / 2);
_target.x = this.x;
limitedResizeHeight(oh + H);
private function resize_l(W:Number, H:Number):void
var num1:Number = NaN;
var num2:Number = NaN;
var num3:Number = NaN;
var num4:Number = NaN;
if (constraints)
num3 = Math.round((ow - W) / 2) * 2;
num4 = Math.round(num3 * ratio);
if (num3 & sox + ow + cornerWidth / 2)
var n1:Number = sox + ow + cornerWidth / 2;
num3 = sox + ow + cornerWidth / 2;
num4 = n1;
if (num4 / 2 + (soy + oh / 2) & bounds.height)
var n2:Number = (bounds.height - (soy + oh / 2)) * 2;
num4 = (bounds.height - (soy + oh / 2)) * 2;
num3 = n2;
if (soy + oh / 2 - num4 / 2 & bounds.y)
var n3:Number = (soy + oh / 2 + cornerWidth / 2) * 2;
num4 = (soy + oh / 2 + cornerWidth / 2) * 2;
num3 = n3;
num1 = limitedResizeWidth(num3);
num2 = limitedResizeHeight(num4);
limitedMoveX(sox + (ow - num1));
limitedMoveY(soy + (oh - num2) / 2);
_target.x = this.x;
_target.y = this.y;
num1 = limitedResizeWidth(ow - W);
limitedMoveX(sox + (ow - num1));
_target.x = this.x;
private function cornerMouseOutHandler(event:MouseEvent):void
if (mousedown)
MouseCursor.hide();
event.updateAfterEvent();
private function resize_r(W:Number, H:Number):void
var num1:Number = NaN;
var num2:Number = NaN;
var num3:Number = NaN;
if (constraints)
num1 = Math.round((ow + W) / 2) * 2;
num2 = Math.round(num1 / ratio);
if (num1 + sox & bounds.width)
var n1:Number = bounds.width -
num1 = bounds.width -
num2 = n1;
if (num2 / 2 + (soy + oh / 2) & bounds.height)
var n2:Number = (bounds.height - (soy + oh / 2)) * 2;
num2 = (bounds.height - (soy + oh / 2)) * 2;
num1 = n2;
if (soy + oh / 2 - num1 / 2 & bounds.y)
var n3:Number = (soy + oh / 2 + cornerWidth / 2) * 2;
num2 = (soy + oh / 2 + cornerWidth / 2) * 2;
num1 = n3;
limitedResizeWidth(num1);
num3 = limitedResizeHeight(num2);
limitedMoveY(soy + (oh - num3) / 2);
_target.y = this.y;
limitedResizeWidth(ow + W);
private function resize_t(W:Number, H:Number):void
var num1:Number = 0;
var num2:Number = 0;
var num3:Number = 0;
var num4:Number = 0;
if (constraints)
num4 = Math.round((oh - H) / 2) * 2;
num3 = Math.round(num4 * ratio);
if (num4 & soy + oh + cornerWidth / 2)
var n1:Number = soy + oh + cornerWidth / 2;
num4 = soy + oh + cornerWidth / 2;
num3 = n1;
if (num3 / 2 + (sox + ow / 2) & bounds.width)
var n2:Number = (bounds.width - (sox + ow / 2)) * 2;
num3 = (bounds.width - (sox + ow / 2)) * 2;
num4 = n2;
if (sox + ow / 2 - num3 / 2 & bounds.x)
var n3:Number = (sox + ow / 2 + cornerWidth / 2) * 2;
num3 = (sox + ow / 2 + cornerWidth / 2) * 2;
num4 = n3;
num1 = limitedResizeWidth(num3);
num2 = limitedResizeHeight(num4);
limitedMoveX(sox + (ow - num1) / 2);
limitedMoveY(soy + (oh - num2));
_target.x = this.x;
_target.y = this.y;
num2 = limitedResizeHeight(oh - H);
limitedMoveY(soy + (oh - num2));
_target.y = this.y;
private function resize_rt(W:Number, H:Number):void
var num1:Number = NaN;
var num2:Number = NaN;
var num3:Number = NaN;
num1 = ow + W;
num2 = oh - H;
if (constraints)
if (Math.min(num1,num2) == num1)
num2 = Math.round(num1 / ratio);
num1 = Math.round(num2 * ratio);
if (num2 & soy + oh + cornerWidth / 2)
var n1:Number = soy + oh + cornerWidth / 2;
num2 = soy + oh + cornerWidth / 2;
num1 = n1;
if (num1 + this.x - cornerWidth / 2 & bounds.width)
var n2:Number = bounds.width - this.x + cornerWidth / 2;
num1 = bounds.width - this.x + cornerWidth / 2;
num2 = n2;
limitedResizeWidth(num1);
num3 = limitedResizeHeight(num2);
limitedMoveY(soy + (oh - num3));
_target.y = this.y;
public function set selectBounds(rectangle:Rectangle):void
bounds.x = rectangle.x - cornerWidth / 2;
bounds.y = rectangle.y - cornerWidth / 2;
bounds.width = rectangle.width - (cornerWidth / 2);
bounds.height = rectangle.height - (cornerWidth / 2);
private function resize_rb(W:Number, H:Number):void
var num1:Number = NaN;
var num2:Number = NaN;
num1 = ow + W;
num2 = oh + H;
if (constraints)
if (Math.min(num1,num2) == num1)
num2 = Math.round(num1 / ratio);
num1 = Math.round(num2 * ratio);
if (num1 + this.x - cornerWidth / 2 & bounds.width)
var n1:Number = bounds.width - this.x + cornerWidth / 2;
num1 = bounds.width - this.x + cornerWidth / 2;
num2 = n1;
if (num2 + this.y - cornerWidth / 2 & bounds.height)
var n2:Number = bounds.height - this.y + cornerWidth / 2;
num2 = bounds.height - this.y + cornerWidth / 2;
num1 = n2;
limitedResizeWidth(num1);
limitedResizeHeight(num2);
private function limitedResizeHeight(num:Number):Number
if (num &= minHeight)
line.height = minH
_target.height = line.
return minH
if (num &= maxHeight)
line.height = maxH
_target.height = line.
return maxH
_target.height =
var H:Number =
line.height =
override public function get width():Number
return line.
private function cornerMouseUpHandler(event:MouseEvent):void
stage.removeEventListener(MouseEvent.MOUSE_UP, cornerMouseUpHandler);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mousedown =
if (! corners[event.target.name] || ! corners[event.target.name].hitTestPoint(stage.mouseX,stage.mouseY))
cornerMouseOutHandler(event);
this.dispatchEvent(new Event(Event.CHANGE));
private function resize_lb(W:Number, H:Number):void
var num:Number = NaN;
var num1:Number = NaN;
var num2:Number = NaN;
num = ow - W;
num1 = oh + H;
if (constraints)
if (Math.min(num,num1) == num)
num1 = Math.round(num / ratio);
num = Math.round(num1 * ratio);
if (num & sox + ow + cornerWidth / 2)
var num3:* = sox + ow + cornerWidth / 2;
num = sox + ow + cornerWidth / 2;
num1 = num3;
if (num1 + this.y - cornerWidth / 2 & bounds.height)
var num4:* = bounds.height - this.y + cornerWidth / 2;
num1 = bounds.height - this.y + cornerWidth / 2;
num = num4;
num2 = limitedResizeWidth(num);
limitedResizeHeight(num1);
limitedMoveX(sox + (ow - num2));
_target.x = this.x;
override public function set x(num:Number):void
super.x = num - cornerWidth / 2;
override public function set y(num:Number):void
super.y = num - cornerWidth / 2;
private function cornerMouseDownHandler(event:MouseEvent):void
mousedown =
ox = stage.mouseX;
oy = stage.mouseY;
ow = line.
oh = line.
sox = super.x;
soy = super.y;
rox = event.target.mouseX;
roy = event.target.mouseY;
this.setChildIndex(event.target as DisplayObject, (this.numChildren - 1));
currDir = event.target.
stage.addEventListener(MouseEvent.MOUSE_UP, cornerMouseUpHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
private function panelMouseOutHandler(event:MouseEvent):void
if (mousedown)
MouseCursor.hide();
其中还用到一些第三方类库:greensock、json、图像编码等...,最后是后台的一些脚本和页面:
saveImage.asp
dim strSaveFileName
dim strNow
strnow =replace(replace(replace(now(), ":", ""), "-", ""), " ", "")
if request.servervariables("REQUEST_METHOD")="POST" then '当前为post
FormSize=Request.TotalBytes
FormData=Request.BinaryRead(FormSize) '接收数据到FormData
strSaveFileName =strNow &".png"
set dr=CreateObject("Adodb.Stream")
dr.Write(FormData)
dr.SaveToFile Server.MapPath(strSaveFileName),2
set dr=nothing
response.Write(strSaveFileName)
仅供参考!  
阅读(...) 评论()
Powered By:

我要回帖

更多关于 kernelbase.dll win7 的文章

 

随机推荐