View Full Version : Basic Scrolling AS Question
wyclef
January 20th, 2005, 10:59 AM
Hi, i've got a text field "scrollable_text" and two buttons with the following code on them to "scroll" the text. Just wondering if there is a way to stop it when it reaches the end of the text (top and bottom). currently u can scroll up or down as long as u want.....
on( press, release, keyPress "")
{
scrollable_text._y -= 30;
}
on( press, release, keyPress "")
{
scrollable_text._y += 30;
}
lunatic
January 20th, 2005, 11:03 AM
Are you loading in dynamic text that changes a lot? Or is it a set amount of text?
:hr:
wyclef
January 20th, 2005, 11:18 AM
it will not be dynamically loaded in but it will change a lot, however...if there was an easy way to designate top and bottom i might eb able to just set the max and min pts and not worry too much. as long as it doesnt go on forever...
lunatic
January 20th, 2005, 11:44 AM
You can use the textWidth and textHeight properties of a textfield to set those mins and maxs and tell the scroller not to go beyond say textHeight +5 or something.
:hr:
wyclef
January 20th, 2005, 11:49 AM
can u give me an example of what the AS would look like?
lunatic
January 20th, 2005, 11:55 AM
Find the attachment in this thread (post #5): auto resize a caption (http://www.kirupa.com/forum/showthread.php?t=55969)
This doesn't use a scroller but captures the text field width and height and adjusts them for the amout of text loaded in. It's really just a resizing rollover caption for buttons but you get the idea.
Hope it helps!
:hr:
wyclef
January 20th, 2005, 12:16 PM
I added this to my buttons now and nothing scrolls anymore...what's wrong with the code?
on (press, release, keyPress "<Up>") {
if (scrolling && scroll_txt._y<0) {
scroll_txt._y += 10;
}
}
on (press, release, keyPress "<Down>") {
if (scrolling && scroll_txt._y>-(scroll_txt._height-50)) {
scroll_txt._y -= 10;
}
}
lunatic
January 20th, 2005, 12:18 PM
Post your fla?
:hr:
wyclef
January 20th, 2005, 12:31 PM
here...
lunatic
January 20th, 2005, 12:36 PM
Post an MX version? :beam:
wyclef
January 20th, 2005, 12:55 PM
MX 2004 Pro
lunatic
January 20th, 2005, 01:05 PM
lol, no COULD you post an MX version? That's all I have access to at the moment.
:hr:
wyclef
January 20th, 2005, 01:18 PM
here...
lunatic
January 20th, 2005, 01:33 PM
Well, it still seems to be MX2004 version.
Anyone with MX2004 want to take a shot at helping out wyclef?
:hr:
wyclef
January 20th, 2005, 01:45 PM
go here...
http://www.actionscript.org/tutorials/beginner/Basic_Scrolling/index.shtml
and jdownload the FLA and just add my new button AS in...and change the text instance name...
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.