Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : textbox scrolls by itself, how to stop it?


savlanoot
4/18/2004 1:23:29 PM
HI,

I am having an issue with a textbox (Flash MX2004 Pro), please take a look at
[b]www.angelfire.com/bug/grossmantesting[/b]. Click on profile and the textbox
magically starts moving all on it's own. The buttons (white squares) are
supposed to do this and are asked with actionscript!

The makeup of the movie contains two frames, frame 1 is work, frame 2 is
profile. Each frame has a stop(); action and 'work' and 'profile' have
gotoAndStop(); actions.

The white square buttons seem to work otherwise. Any suggestions? I want the
textbox to stay still until asked!

THANKS,
Amy

other relevant info:

a movieclip 'controller' is attached in the second frame, with these actions
and five frames within it:

if (_root.up_btn) {
_root.textField.scroll += 1;
} else if (_root.down_btn) {
_root.textField.scroll -= 1;
}
gotoAndPlay(1);

each white square button has this action (up and down):

on (rollOver) {
_root.up_btn = true;
}
on (press, release, releaseOutside, rollOut, dragOut) {
_root.up_btn = false;
}

kglad
4/18/2004 1:45:05 PM
you've set your textfield to scroll every time controller loops whether a
button action occurs or not. (when a boolean variable is undefined it defaults
to false.) if it's not your intention to have your textfield scroll
automatically, then you shouldn't use controller. why not attach the scroll
code directly to your buttons?
savlanoot
4/18/2004 2:51:50 PM
Thanks for the suggestion. I used the controller because my button has not been
a continuos scroll otherwise. So there must be a fix? With this code,

on (rollOver) {
_root.textField.scroll += 1;
}

it moves up a bit and then stops. How should I manipulate the code? Thanks for
your help!
kglad
4/18/2004 3:15:32 PM
if you want continuous scrolling it's cleaner to use setInterval() to start a
loop, rather than using a movieclip loop. if you're on the _root timeline try:

up button:

on (rollOver) {
scrollI=setInterval(scrollF,80,-1); // if your buttons are really movieclip
buttons you should use _root.scrollF
}
on(rollOut){
clearInterval(scrollI);
}

down button:

on (rollOver) {
scrollI=setInterval(scrollF,80,1);
}
on(rollOut){
clearInterval(scrollI);
}

and attached to a frame:

function scrollF(dir){
textField.scroll += dir;
}

savlanoot
4/19/2004 9:39:51 AM
I am not having any luck with this function.

The textbox does not scroll. Any troubleshooting ideas for me? I am clueless here..


savlanoot
4/19/2004 10:01:18 AM
Looks like I am not as clueless I as I thought! I figured it out, it was as simple as fixing the - to a +.

kglad
4/19/2004 11:34:00 AM
AddThis Social Bookmark Button