注册
 找回密码
 注册
江西广告网
查看: 686|回复: 0
打印 上一主题 下一主题

图片放大缩小移动类

[复制链接]

该用户从未签到

1
跳转到指定楼层
发表于 2009-5-2 13:08:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
-图片放大缩小移动类: -----------------------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; }  
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表