PDA

View Full Version : continuous scrolling textbox issue


interfacer
02-21-2006, 08:03 AM
Ok, so I am attempting to change my textbox's to be continuously scrolling instead of having repeated clicking. Here is my plan:

1. Have two buttons (up_btn, down_btn) and when pressed, the content (content_mc) is scrolled up or down. Pressing the button changes a variable called yDir to +/-1 to control direction.

var yDir:Number =1;
loadMovie("info.swf", "content_mc");

up_btn.onPress = function() {
trace("up_btn button has been hit");
yDir=1;
content_mc.gotoAndPlay(2);
}

up_btn.onRelease = function() {
trace("up_btn button has been released");
content_mc.gotoAndStop(1);
}

down_btn.onPress = function() {
yDir=-1;
content_mc.gotoAndPlay(2);
}

down_btn.onRelease = function() {
content_mc.gotoAndStop(1);
}

2. On the movieClip content_mc, there are three frames. the first frame contains a stop(); function.

this is teh 2nd frame:
trace("frame2");
this._y+=5*_root.yDir;

the 3rd frame of the MC has a 'gotoAndPlay(2);' on it. can anyone tell me why it only happens to play the 2nd frame twice and then does nothing when the buttons are pressed? it does not appear to be moving as well.

is this a bad approach as well? can anyone recommend something simpler if it is?

interfacer
02-21-2006, 08:49 AM
eeeehhh, i fixed it :) here was my solution:

stop();
content_mc.onEnterFrame = function() {
stop();
}

var yDir:Number =1;
loadMovie("info.swf", "content_mc");

up_btn.onPress = function() {
trace("up button has been hit");
yDir=1;

content_mc.onEnterFrame = function() {
if(this._y<45) {
this._y+=this._height*yDir*.015;
}
}
}

up_btn.onRelease = function() {
trace("up button has been released");
content_mc.onEnterFrame = function() {
this.stop();
}
trace(content_mc._y);
}

down_btn.onPress = function() {
trace("down button has been hit");
yDir=-1;
content_mc.onEnterFrame = function() {
if(this._y > (150-this._height)) {
this._y+=this._height*yDir*.015;
}
}
}

down_btn.onRelease = function() {
trace("down button has been released");
content_mc.onEnterFrame = function() {
this.stop();
}
trace(content_mc._y);
}


the limits were arbitrarily there as part of a mask i created to control when the textbox was visible and where.

basically i eliminated the timeline on the movie clip, and just made the movieclip move and stop based on button actions.

can anyone tell me if it is continuosly stopping the movie clip after the buton is released and if so how to work around that?