//核心代码; class as.Win extends MovieClip { private var tl_mc:MovieClip; private var tc_mc:MovieClip; private var tr_mc:MovieClip; private var cl_mc:MovieClip; private var cc_mc:MovieClip; private var cr_mc:MovieClip; private var bl_mc:MovieClip; private var bc_mc:MovieClip; private var br_mc:MovieClip; private var title_txt:TextField; private var content_mc:MovieClip; private var load_mc:MovieClip; //------------------------------------------------; private var width:Number; private var height:Number; //------------------------------------------------; private var move_mar:Number; private var size_mar:Number; private var speed:Number; private var _ddw:Number; private var _ddh:Number; private var _ddx:Number; private var _ddy:Number; //------------------------------------------------; function Win() { this.setSize(200, 100); this.move(this._x, this._y); this.setSpeed(5); this.setTitle("无标题"); } public function setSize(w:Number, h:Number):Void { clearInterval(this.size_mar); w = Math.max(w, this.tl_mc._width+this.tr_mc._width); this.width = Math.max(w, this.bl_mc._width+this.br_mc._width); this.height = h; this.draw(this.width, this.height); } public function getWidth():Number { return this.width; } public function getHeight():Number { return this.height; } public function setTitle(title:String):Void{ this.title_txt.text = title; } public function loadSwf(url:String):Void{ this.content_mc = this.createEmptyMovieClip("hand_mc",5); this.content_mc._x = this.cc_mc._x; this.content_mc._y = this.cc_mc._y; this.content_mc.loadMovie(url); } public function removeSwf():Void{ this.content_mc.removeMovieClip(); } private function draw(w:Number, h:Number):Void { this.tl_mc._x = this.cl_mc._x=this.bl_mc._x=0; this.tl_mc._y = this.tc_mc._y=this.tr_mc._y=0; this.tc_mc._x = this.tl_mc._x+this.tl_mc._width; this.tc_mc._width = w+this.cl_mc._width+this.cr_mc._width-this.tl_mc._width-this.tr_mc._width; this.title_txt._x = this.tc_mc._x; this.title_txt._width = this.tc_mc._width; this.tr_mc._x = this.tc_mc._x+this.tc_mc._width; this.cl_mc._y = this.cc_mc._y=this.cr_mc._y=this.tl_mc._y+this.tl_mc._height; this.cl_mc._height = this.cc_mc._height=this.cr_mc._height=h; this.cc_mc._x = this.cl_mc._x+this.cl_mc._width; this.cc_mc._width = w; this.cr_mc._x = this.cc_mc._x+this.cc_mc._width; this.bl_mc._y = this.bc_mc._y=this.br_mc._y=this.cl_mc._y+this.cl_mc._height; this.bc_mc._x = this.bl_mc._x+this.bl_mc._width; this.bc_mc._width = w+this.cl_mc._width+this.cr_mc._width-this.bl_mc._width-this.br_mc._width; this.br_mc._x = this.bc_mc._x+this.bc_mc._width; } public function setSpeed(speed:Number):Void { this.speed = speed; } public function moveSize(w:Number,h:Number,showed:Boolean):Void { if(showed == undefined){ showed = false; } w = Math.max(w, this.tl_mc._width+this.tr_mc._width); this._ddw = Math.max(w, this.bl_mc._width+this.br_mc._width); this._ddh = h; this.content_mc._visible = showed; clearInterval(this.size_mar); this.size_mar = setInterval(this, "moveSizeAction", 50); } private function moveSizeAction() { var dw:Number = this.cc_mc._width - this._ddw; var dh:Number = this.cc_mc._height - this._ddh; var ow:Number = dw/this.speed; var oh:Number = dh/this.speed; this.draw(this.cc_mc._width-ow,this.cc_mc._height-oh); if(Math.abs(dw)<1 && Math.abs(dh)<1){ this.content_mc._visible = true; this.setSize(this._ddw,this._ddh); } } public function moveTo(x:Number,y:Number):Void { this._ddx = Math.round(x); this._ddy = Math.round(y); clearInterval(this.move_mar); this.move_mar = setInterval(this, "moveToAction", 50); } private function moveToAction() { var dx:Number = this._x - this._ddx; var dy:Number = this._y - this._ddy; var ox:Number = dx/this.speed; var oy:Number = dy/this.speed; this._x -= ox; this._y -= oy; if(Math.abs(dx)<1 && Math.abs(dy)<1){ this.move(this._ddx,this._ddy); } } public function move(x:Number, y:Number):Void { this._x = Math.round(x); this._y = Math.round(y); clearInterval(this.move_mar); } } |
/upimg/soft/1_061231090156.rar |
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |