请问用flash如何制作带滑块的滚动条呀?
时间:2006-09-04
来源:互联网
作者: jamesbobo 发布时间: 2006-09-04
作者: HBrO 发布时间: 2006-09-04
http://www.zhugao.cn/downloads/study_flash/scroll_002.rar
作者: luzhugao 发布时间: 2006-09-04
作者: lzgxp2005 发布时间: 2006-09-04
作者: duoduo005 发布时间: 2006-09-05
作者: flash297359 发布时间: 2006-09-05
作者: jamesbobo 发布时间: 2006-09-06
作者: jamesbobo 发布时间: 2006-09-06
// Set the target text field for the scroll bar.
my_sb.setScrollTarget(my_txt);
// Size it to match the text field.
my_sb.setSize(16, my_txt._height);
// Move it next to the text field.
my_sb.move(my_txt._x + my_txt._width, my_txt._y);
把你的静态文本实例名取为my_txt
作者: salanglillian 发布时间: 2006-09-06
一共11句代码搞定,希望对LZ有帮助
场景一个MC,里面有3个东西,1,要滑动的MC,2,滑动条,3,折罩图形 4,AS语句(放最上层)
分别名字是:picture,scrollBar,mask
到4,AS语句里面写
scrollBar.x = scrollBar._x;//定义滚动条的X坐标
scrollBar.miny = scrollBar._y;//定义滚动条的最小Y坐标
scrollBar.maxy = mask._y+mask._height-scrollBar._height;//定义滚动条的最大Y坐标
scrollBar.onPress = function() {
this.startDrag(false, this.x, this.miny, this.x, this.maxy);//限制他的拖动范围
};
scrollBar.onMouseUp = function() {
this.stopDrag();//释放鼠标就停止拖动滚动条
};
var rate = (mask._height-picture._height)/scrollBar.maxy; //设定Y 的比率
onEnterFrame = function () {
picture._y += (scrollBar._y*rate-picture._y)*0.2;//根据滚动条和MC的Y和 比率,求得MC的Y坐标,并用缓冲公试制作效果,
};
希望对你有帮助
作者: human9151 发布时间: 2006-09-07
下载源文件
引用:
// http://log.7thpark.com//各mc纵坐标自动基于scrollMask定位,顶端对齐;
//scoll的控制条部分根据scrollBar的横坐标自动居中对齐;
//不需要修改代码
var _maskY:Number = int(scrollMask._y);
var _maskH:Number = int(scrollMask._height);
var _barH:Number = int(scrollBar._height);
var _upH:Number = int(scrollUp._height);
var _downH:Number = int(scrollDown._height);
var top:Number = _maskY+_upH;
var bottom:Number = _maskY+_maskH-_barH-_downH;
scrollBar._top = top;
scrollBar._bottom = bottom;
left = int(scrollBar._x);
scrollBar._y = _maskY+_upH;
scrollContent._y = _maskY;
scrollLine._y = _maskY;
scrollLine._height = _maskH;
scrollUp._y = _maskY;
scrollDown._y = _maskY+_maskH-_downH;
var barC:Number = int(scrollBar._x+scrollBar._width/2)+1;
scrollLine._x = int(barC-scrollLine._width/2);
scrollUp._x = int(barC-scrollUp._width/2);
scrollDown._x = int(barC-scrollDown._width/2);
var speed:Number = 6;
var nSpeedLow:Number = 1;
var nSpeedHigh:Number = 3;
dis = (scrollContent._height-_maskH+10)/(bottom-top);
contentStartY = scrollContent._y;
var down:Boolean = true;
scrollContent._y = bottom;
scrollBar.onPress = function() {
scrollBar.startDrag(0, left, top, left, bottom);
down = true;
};
scrollBar.onMouseUp = function() {
scrollBar.stopDrag();
down = true;
};
this.onEnterFrame = function() {
if (down) {
disMove = (scrollBar._y-top)*dis;
scrollContent.yMove = contentStartY-disMove;
}
// end if
scrollContent._y = scrollContent._y+(scrollContent.yMove-scrollContent._y)/speed;
};
//mousewheel event------------------------
mouseListener = new Object();
mouseListener.onMouseWheel = function(delta) {
down = true;
scrollBar._y = scrollBar._y-delta*3;
if (scrollBar._y>=bottom) {
scrollBar._y = bottom;
} else if (scrollBar._y<=top) {
scrollBar._y = top;
}
// end if
};
Mouse.addListener(mouseListener);
//up and down btn event
scrollBar.onEnterFrame = function() {
if (this.d && this._y<this._bottom) {
this._y += this.s;
}
//end if
if (this.u && this._y>this._top) {
this._y -= this.s;
}
//end if
};
//down
scrollDown.onRollOver = function() {
scrollBar.d = true;
scrollBar.s = nSpeedLow;
down = true;
};
scrollDown.onPress = function() {
scrollBar.d = true;
scrollBar.s = nSpeedHigh;
down = true;
};
scrollDown.onRelease = function() {
scrollBar.d = true;
scrollBar.s = nSpeedLow;
down = true;
};
scrollDown.onRollOut = function() {
scrollBar.d = false;
scrollBar.s = 0;
down = false;
};
scrollDown.onReleaseOutside = function() {
scrollBar.d = false;
scrollBar.s = 0;
down = false;
};
//up
scrollUp.onRollOver = function() {
scrollBar.u = true;
scrollBar.s = nSpeedLow;
down = true;
};
scrollUp.onPress = function() {
scrollBar.u = true;
scrollBar.s = nSpeedHigh;
down = true;
};
scrollUp.onRelease = function() {
scrollBar.u = true;
scrollBar.s = nSpeedLow;
down = true;
};
scrollUp.onRollOut = function() {
scrollBar.u = false;
scrollBar.s = 0;
down = false;
};
scrollUp.onReleaseOutside = function() {
scrollBar.u = false;
scrollBar.s = 0;
down = false;
};
作者: airfar 发布时间: 2006-10-12
作者: jimohuoshan 发布时间: 2006-10-12
引用:
原帖由 jimohuoshan 于 2006-10-12 14:47 发表全是滚动MC的,有人能提供个直接滚动文本的吗?
作者: airfar 发布时间: 2006-10-12
用setInterval和startDrag()
很简单的搞定!
作者: kenjor01 发布时间: 2006-10-12
作者: jimohuoshan 发布时间: 2006-10-12
作者: xxx974 发布时间: 2011-03-09
作者: xxx974 发布时间: 2011-03-09
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28