江西广告网

标题: 图片放大缩小移动类 [打印本页]

作者: 与你同行    时间: 2009-5-2 13:08
标题: 图片放大缩小移动类
-图片放大缩小移动类: -----------------------class------------------------- class ZoomOpenMove { private var obj:MovieClip; private var pos_scale:Number; private var x_speed:Number; private var y_speed:Number; private var scale_speed:Number; private var scale_step:Number; public function ZoomOpenMove(_obj:MovieClip) { this.obj = _obj; } public function get s_speed():Number { return scale_speed; } public function set s_speed(_s_speed:Number):Void { scale_speed = _s_speed; } public function get _x_speed():Number { return x_speed; } public function set _x_speed(_x_x_speed:Number):Void { x_speed = _x_x_speed; } public function get _y_speed():Number { return y_speed; } public function set _y_speed(_y_y_speed:Number):Void { y_speed = _y_y_speed; } public function get _scale_step():Number { return scale_step; } public function set _scale_step(scalestep:Number):Void { scale_step = scalestep; } public function get _scale_speed():Number { return scale_speed } public function set _scale_speed(scalespeed:Number):Void { scale_speed = scalespeed } public function get _pos_scale():Number { return pos_scale; } public function set _pos_scale(posscale:Number):Void { pos_scale = posscale; } public function Open() { if (_root._xmouse<Stage.width and _root._xmouse>0 and _root._ymouse>0 and _root._ymouse<Stage.height) { obj._xscale<pos_scale ? obj._xscale=obj._yscale = scale_step : obj._xscale=obj._yscale=pos_scale; } } public function Zoom() { if (_root._xmouse<Stage.width and _root._xmouse>0 and _root._ymouse>0 and _root._ymouse<Stage.height) { obj._x = (0-obj._x)/scale_speed; obj._y = (0-obj._y)/scale_speed; obj._xscale = (100-obj._xscale)/scale_speed; obj._yscale = (100-obj._yscale)/scale_speed; } } public function Move() { if (obj.hitTest(_root._xmouse, _root._ymouse, true)) { var pos_x = _root._xmouse*(Stage.width-obj._width)/Stage.width; var pos_y = _root._ymouse*(Stage.height-obj._height)/Stage.height; obj._x = (pos_x-obj._x)/x_speed; obj._y = (pos_y-obj._y)/y_speed; }  




欢迎光临 江西广告网 (http://bbs.jxadw.com/) Powered by Discuz! X3.2