PDA

View Full Version : Scrolling Funny?


logixbean
06-08-2003, 11:25 PM
Simple question, why dont my scroll buttons scroll the text?

I have two buttons up and down, coded using the code in the tutorial. The code contains no errors for either button.

I also have a text box, made into a movie clip and given the same code as in the tutorial. The script contains no errors.

Yet when I test movie my buttons do not move the text. However, if I click on the text and pull down, like you would when highliting text, it moves down.

What is going on here?

The only thing I can think of is that my text box movie clip does not contian the buttons. This is because if I were to select all, the text box and buttons,
then convert them all into one movie clip, I could not edit the actions of the buttons.

What do I do?

Thanks,
logixbean

Sualdam
06-08-2003, 11:44 PM
Can you post the FLA?

logixbean
06-09-2003, 12:03 AM
Here is my movie step by step:

3 layers,

Layer one-Textbox(movie clip)

The actions of the textbox,

onClipEvent(load){
daTextBox="mytext";
}
onClipEvent(enterFrame){
if(scrolling=="up"){
daTextBox.scroll--;
}
if(scrolling=="down"){
daTextBox.scroll++;
}
}

Layer2-Up Button

The actions of the up button:

on(press){
scrolling="up";
}
on(release,releaseOutside){
scrolling=0;
}

Layer 3-Down Button

The actions of the down button:

on(press){
scrolling="down";
}
on(release,releaseOutside){
scrolling=0;
}


Now then, what is wrong with that?

thanks,
logixbean

Sualdam
06-09-2003, 12:22 AM
Change your clip event code to:
onClipEvent(enterFrame){
if(_root.scrolling=="up"){
daTextBox.scroll--;
}
if(_root.scrolling=="down"){
daTextBox.scroll++;
}
}
It works then.

The reason is that the values of 'scrolling' are on the root timeline whilst your clip event code refers to the clip (one level down). In this particular case you could also use _parent instead of _root, because the clip's parent is the _root timeline.

By the way, you won't see anything happen unless you put enough text in the text box to actually scroll.

logixbean
06-09-2003, 12:33 AM
Thanks, it works!

Also, thanks for explaining the reason behind your answer.

logixbean