www.pudn.com > windows.rar > Win.as


import mx.controls.scrollClasses.ScrollBar; 
import mx.containers.ScrollPane; 
import mx.controls.TextArea; 
import mx.utils.Delegate; 
class Win extends MovieClip { 
	var TL:MovieClip; 
	var TM:MovieClip; 
	var TR:MovieClip; 
	var ML:MovieClip; 
	var MR:MovieClip; 
	var BL:MovieClip; 
	var BM:MovieClip; 
	var BR:MovieClip; 
	var titleTXT:TextField; 
	var CT:MovieClip; 
	var loadtxt:TextField; 
	// 
	var _win_x:Number; 
	var _win_y:Number; 
	var _win_w:Number; 
	var _win_h:Number; 
	// 
	var _type:String; 
	var _status:String; 
	var _intervalID:Number; 
	var _autoSize:Boolean; 
	// 
	var _resizeAble:Boolean; 
	var createClassObject:Function; 
	function Win() { 
		_status = "normal"; 
		_resizeAble = true; 
		_autoSize = false; 
		ScrollBar.prototype.upArrowOverName = ""; 
		ScrollBar.prototype.downArrowOverName = ""; 
		ScrollBar.prototype.upArrowDownName = ""; 
		ScrollBar.prototype.downArrowDownName = ""; 
		ScrollBar.prototype.thumbGripName = ""; 
	} 
	function onLoad() { 
		TR.nomal_btn._visible = false; 
		TL.onPress = TM.onPress=Delegate.create(this, startDragWin); 
		TL.onRelease = TM.onRelease=TL.onReleaseOutside=TM.onReleaseOutside=Delegate.create(this, stopDragWin); 
		BR.onPress = Delegate.create(this, startResizeWin); 
		BR.onRelease = BR.onReleaseOutside=Delegate.create(this, stopResizeWin); 
		TR.close_btn.onRelease = Delegate.create(this, closeWin); 
		TR.min_btn.onRelease = Delegate.create(this, minWin); 
		TR.max_btn.onRelease = Delegate.create(this, maxWin); 
		TR.nomal_btn.onRelease = Delegate.create(this, normalWin); 
	} 
	function startDragWin() { 
		if (!(_status eq "max")) { 
			this.startDrag(false); 
		} 
	} 
	function stopDragWin() { 
		stopDrag(); 
	} 
	function startResizeWin() { 
		if (!(_status eq "max") && _resizeAble) { 
			var oldX:Number = BR._xmouse; 
			var oldY:Number = BR._ymouse; 
			onMouseMove = function () { 
				BR._x += Math.floor(BR._xmouse-oldX); 
				BR._y += Math.floor(BR._ymouse-oldY); 
				if (BR._xStage.width) { 
				w = Stage.width; 
			} 
			if (h>Stage.height) { 
				h = Stage.height; 
			} 
			reSize(w-16, h-50); 
			resetPosition(); 
			resizeAble = false; 
			CT.vScrollPolicy = "off"; 
			CT.hScrollPolicy = "off"; 
			_visible = true; 
		} 
		loadtxt._visible = false; 
	} 
	function closeWin() { 
		this.removeMovieClip(); 
	} 
	function minWin() { 
		_status = "min"; 
		loadtxt._visible = CT._visible=ML._visible=MR._visible=BL._visible=BM._visible=BR._visible=TR.min_btn._visible=false; 
		TR.nomal_btn._visible = true; 
	} 
	function maxWin() { 
		_win_x = _x; 
		_win_y = _y; 
		_win_w = CT.width; 
		_win_h = CT.height; 
		_status = "max"; 
		_x = 0; 
		_y = 0; 
		reSize(Stage.width,Stage.height); 
		TR.nomal_btn._visible = CT._visible=ML._visible=MR._visible=BL._visible=BM._visible=BR._visible=true; 
		TR.min_btn._visible = false; 
	} 
	function normalWin() { 
		if (_status eq "max") { 
			_x = _win_x; 
			_y = _win_y; 
			reSize(_win_w, _win_h); 
		} else if (_status eq "min") { 
			CT._visible = ML._visible=MR._visible=BL._visible=BM._visible=BR._visible=true; 
		} 
		_status = "normal"; 
		TR.nomal_btn._visible = false; 
		TR.min_btn._visible = true; 
	} 
	function set resizeAble(B:Boolean) { 
		if (B) { 
			BR.resizeAble_mc._visible = true; 
			_resizeAble = true; 
		} else { 
			BR.resizeAble_mc._visible = false; 
			_resizeAble = false; 
		} 
	} 
	function resetPosition() { 
		_x = Math.floor((Stage.width-_width)/2); 
		_y = Math.floor((Stage.height-_height)/2); 
	} 
}