PDA

View Full Version : Scrollbar with imported txt file



beuvema
January 21st, 2003, 05:38 PM
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......

lostinbeta
January 21st, 2003, 05:44 PM
Just up and down buttons eh?

Well in that case you can start here...

http://www.kirupa.com/developer/flash5/scrolltext.asp

beuvema
January 21st, 2003, 06:02 PM
Thx for the quick response, indeed i can scroll text but not imported text do you have the next step??

lostinbeta
January 21st, 2003, 06:32 PM
That one is covered here...

http://www.kirupa.com/developer/mx/dynamic_scroller.asp


Just skip the step of the scrollbar component.

beuvema
January 22nd, 2003, 07:33 AM
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??

lostinbeta
January 22nd, 2003, 09:02 AM
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.

beuvema
January 22nd, 2003, 04:29 PM
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

lostinbeta
January 22nd, 2003, 10:48 PM
Can you upload it to a server and link to it?

beuvema
January 23rd, 2003, 04:02 AM
yes, I put it on

greetings Beuvema

lostinbeta
January 24th, 2003, 01:40 AM
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;
}
}

beuvema
January 24th, 2003, 04:46 PM
LOSTINBETA THANX, THANX, THANX,

My problem is solved.

Greetings and have a nice weekend Beuvema

lostinbeta
January 24th, 2003, 04:51 PM
No problem. Glad you got everything working.

beuvema
January 24th, 2003, 05:49 PM
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???

lostinbeta
January 24th, 2003, 05:56 PM
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.

beuvema
January 24th, 2003, 06:17 PM
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

lostinbeta
January 24th, 2003, 09:14 PM
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.

beuvema
January 25th, 2003, 05:35 AM
Thx anyway, c u on this forum...