如何实现由按钮控制文本滚动
一、比较保守的方法,如果要放到按钮上的效果就onRollOver,别忘了再写个onRollOut配它哦。
以下为引用的内容:
upBtn.onPress = function() {
onEnterFrame = function () {
textHolder.scroll += 2;
};
};
upBtn.onRelease = function() {
delete onEnterFrame;
};
dnBtn.onPress = function() {
onEnterFrame = function () {
textHolder.scroll -= 2;
};
};
dnBtn.onRelease = function() {
delete onEnterFrame;
};
二、
以下为引用的内容:
this.createEmptyMovieClip("a_mc", 100);
this.createEmptyMovieClip("c_mc", 200);
down_btn.onPress = function() {
a_mc.onEnterFrame = function() {
textField_txt.scroll += 1;
};
};
down_btn.onRollOver = function() {
a_mc.onEnterFrame = function() {
textField_txt.scroll += 3;
};
};
up_btn.onPress = function() {
c_mc.onEnterFrame = function() {
textField_txt.scroll -= 1;
};
};
up_btn.onRollOver = function() {
c_mc.onEnterFrame = function() {
textField_txt.scroll -= 3;
};
};
up_btn.onRelease = function() {
delete c_mc.onEnterFrame;
};
up_btn.onRollOut = function() {
delete c_mc.onEnterFrame;
};
down_btn.onRollOut = function() {
delete a_mc.onEnterFrame;
};
down_btn.onRelease = function() {
delete a_mc.onEnterFrame;
};