I want to create a scrollbar to view an imported txt file, want to use 2 buttons for up and down but don’t know where to start.
Can anyone help…
Just up and down buttons eh?
Well in that case you can start here…
Thx for the quick response, indeed i can scroll text but not imported text do you have the next step??
That one is covered here…
http://www.kirupa.com/developer/mx/dynamic_scroller.asp
Just skip the step of the scrollbar component.
Still having problems…
It works fine as a separate movie, but when I want to use in another movie, the text field remains empty.
What could be wrong??
In your movie with your scrollable text area change any _root locators tobe _parent. If instance names (or var names) don’t have a locator, add _parent.
For example if the code is something like
myTextBox.scroll()
It would become
_parent.myTextBox.scroll()
I didn’t get to look over the tutorials to give you more accurate code, but I am in a rush, so I don’t have time to, I just know a lot of times loaded movies don’t work when things are _root because the _root of the loaded movie becomes the _root of the movie it is loading into, so in that case the location through AS is different and you need to use _parent.
You completely lost me…
The stripped source file is too big to attach to this message 370k.
Can I mail it to you?
Greetings Beuvema
Can you upload it to a server and link to it?
yes, I put it on
greetings Beuvema
Now that I got to see your actual setUp and everything it was easier to diagnose. My first diagnosis was wrong, you did not need ANY _parents or anything. So I removed those, then I had to fix your loadVars script. You had something like scrollabletext.scroll = this.contacttext or something like that, but it really should have been scrollabletext.text not .scroll, after I changed this I also set your textboxes Instance name and Var name to “scrollabletext” (no quotes). Also… You kept in the AS text too. You had scrollabletext = “blah blah blah”, I think that was counteracting your loadVars possible, so I removed that as well.
Everything worked great after that.
I can’t upload as an attachment because it is too big, and my FTP is acting all floopy like… of course, my server has been down for days, and when it comes back up and I can use it, my FTP program wants to be a pain…lol.
I will post the code to change…
Your loadVars code should look like this…
loadText = new loadVars();
loadText.load("contact.txt");
loadText.onLoad = function() {
scrollableText = this.contacttext;
};
stop();
Your up button code should look like this…
on (press, release, keyPress "<Up>") {
currentScroll = scrollableText.scroll;
if (Number(currentScroll)>1) {
scrollableText.scroll = currentScroll-1;
}
}
Your down button code should look like this…
on (press, release, keyPress "<Down>") {
currentScroll = scrollableText.scroll;
if (Number(currentScroll)<Number(scrollableText.maxscroll)) {
scrollableText.scroll = Number(currentScroll)+1;
}
}
LOSTINBETA THANX, THANX, THANX,
My problem is solved.
Greetings and have a nice weekend Beuvema
No problem. Glad you got everything working.
I have another question concerning the scroll bar.
If the text runs out the screen I want to start a movie within the main scene. The code I used does not start the movie.
if
(Number
(currentScroll)
< Number
(_root.scroller.scrollableText.maxscroll)
)
{
lees_verder.play(1)
}
actually nothing is triggerd at all
Can you help me again???
Untested, but you can try this…
on (release, keyPress "<Down>") {
currentScroll = scrollableText.scroll;
if (Number(currentScroll)<Number(scrollableText.maxscroll)) {
scrollableText.scroll = Number(currentScroll)+1;
} else {
trace("scroll down complete");
}
}
I removed the press command so now it is just release and keyPress… I didn’t see a need for both press and release.
Note: Put this on your down button, then test your movie. Keep clicking the down button. When it reaches the end it SHOULD display “scroll down complete” in the output window.
I think I formulated the question in the wrong way;
What I meant was that if the text is bigger than the text screen
a button [more…] becomes visible
sorry for the inconvenience
Oh… I don’t know how to do that. At least not off the top of my head :-\ I might have to work at it for a bit, but I don’t have much time to.
Thx anyway, c u on this forum…