实现用滑块控制图片缓动左右播放的功能
Flash as中用滑块mc控制的pic_mc的图片缓动播放的制作
代码如下:
left = bar_mc._x+dragBox_mc._width/2;
right = bar_mc._x+bar_mc._width-dragBox_mc. _width/2;
bottom = top=bar_mc._y;
//确定滑块可移动的左右及上下边界
this.dragBox_mc.onPress = function() {
this.startDrag(true,left,top,right,bottom);
box_mc.onEnterFrame = function() {
var _posX:Number = (dragBox_mc._x-left)/(right-left)*(mask._width-this._width)+mask._x;
this._x += (_posX-this._x)*.2;
Math.abs(_posX-this._x)<.2 && delete this.onEnterFrame;
};
};
this.dragBox_mc.onRelease = this.dragBox_mc.onReleaseOutside=function () {
this.stopDrag();
};
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |