PDA

View Full Version : continuous scroll of loaded text.


jake88
12-29-2000, 06:27 PM
does anyone know of a tutorial that shows you how to do a continuous text scroll. I know how to scroll a text but you have to keep pressing the scroll button to scroll each line. What I need to do is to scroll the text by pressing down on the scroll button and it scrolls continuously without me having to press the button each time. a good example would be the MS Windows scroll bars, you could either press once to scroll one line or keep it down to scroll continuously. I've found ones that has continuous scroll but the text has to be within the moive, What I am looking for is to do the continuous scroll with a loaded text with the loadvariablenum command.

FlashGuru
12-29-2000, 10:40 PM
ok create a new movieclip and give it these actions:

onClipEvent(enterFrame){
if(_root.scrollup){
_root.textfieldname.scroll++
}else if(_root.scrolldown){
_root.textfieldname.scoll--
}
}

now on your up button add this code:

on(press){
_root.scrollup=true
}
on(release, release outside){
_root.scrollup=false
}

And finally add this code to your down button:

on(press){
_root.scrolldown=true
}
on(release,release outside){
_root.scrolldown=false
}


now you should have a fully functional continuous scroller

jake88
12-29-2000, 11:18 PM
Thank You, I'll try that.

jake88
01-02-2001, 11:01 PM
Hey FlashGuru

I followed the instructions you gave, but it didn't work.

Here is what I have:


On the main time line I have a movie clip called update
and on the clip I have put the following action into it:

onClipEvent (enterFrame) {
if (_root.scrollup) {
_root.textfieldname.scroll++;
} else if (_root.scrolldown) {
_root.textfieldname.scoll--;
}
}

Then, within the update movie clip I have the scroll buttons and on the up button I have assigned the following actions:

on(press){
_root.scrollup=true
}
on(release){
_root.scrollup=false
}

and on the down button I have the following actions:

on(press){
_root.scrolldown=true
}
on(release){
_root.scrolldown=false
}

The text field variable is update as well.

in the movie clip I also have assigned the following actons to load the text file:

loadVariables ("/update.txt", _root.update);


but when I go and test it, it doesn't work. Could you, or perhaps some other expert please help me out? Thanks

minor
01-03-2001, 04:31 AM
are the scrollup/scrolldown instances, variables or built-in properties of flash5? just wondering...

jake88
01-03-2001, 06:37 AM
never mind,

I figured it out. But Now I have questions in regards to the script:

1st: Why was the "if" command used?
2nd: the line "_root.textfilename.scroll--;" in flash 5
normal mode, how do you enter it (for people that are
new to actionscript)? I can't find anything to click
on to generate that. I just copy and pasted, but I'd
like to know for the future.
3: Perhaps someone could explain in detail how
the scripts work or why the certain commands
are used.

Thanks



[Edited by jake88 on 01-03-2001 at 01:45 AM]

flyrod
01-17-2001, 03:25 PM
can i make flash check for certain .txt files @ a specific time interval? i guess you can think of thia as similar to an outlook date/time reminder...

tah!

stanlee_max
10-11-2002, 03:10 PM
I am having the same problem... I wonder if you could show me how to set it up? I wonder if you could attach the Flash file so I can take a look at to see where I made the mistake.

I have this scrolling text flash file that only work with static text but when i convert it to dynamic text it won't show up.

Please can you help me out on this...Thanx..


Here is the file..

// =========== SCROLL INIT ===================

// Specify the name of the clip to scroll.
var scrollTarget = _root.content;

// Specify the name of the clip that will act
// as the background for the scrolled clip.
// scrollTarget will only move within the bounding
// box of scrollBG.
var scrollBG = _root.contentBG;

// Specify amount of room to allow scrolling after
// the bottom of the scrollTarget has been reached.
var bottomBuffer = 20;

// Specify scrolling speed, in pixels per second.
var scrollSpeed = 100;





/*
*************************
*** FUNCTION scroll() ***
*************************

> DESCRIPTION:
Moves scrollTarget up or down, within legal scrolling limits
determined by the dimensions of scrollBG. Called by an
enterFrame event on an empty clip on the scroll process layer.
*/

function scroll () {
// Determine how much time has last since the last scroll.
thisScrollTime = getTimer();
elapsed = (thisScrollTime - lastScrollTime);

// Calculate distance to move based on elapsed time.
scrollDist = (elapsed / 1000) * scrollSpeed;

// Move at least .5 of a pixel. Smaller amounts are not
// rendered by the player.
scrollDist = scrollDist < .5 ? .5 : scrollDist;


// If the down button is being held...
if (scrolling == "down") {
// Determine the y-coord of the bottom of scrollTarget
var scrollBottom = scrollTarget._y + scrollTarget._height + bottomBuffer;
// Determine the y-coord of the bottom of scrollBG
var scrollBGbottom = scrollBG._y + scrollBG._height;
// Check how far scrollTarget is from the legal lowest scroll point.
var distanceToBottom = scrollBottom - scrollBGbottom;

// If the amount to move won't overshoot the legal lowest scroll point...
if (distanceToBottom > scrollDist) {
// ...then move the calculated amount.
scrollTarget._y -= scrollDist;
} else {
// ...otherwise just go to the legal limit.
scrollTarget._y = scrollBGbottom - (scrollTarget._height + bottomBuffer);
}
} else if (scrolling == "up") {
// The up button is being held, so scroll up if possible.

// If the amount to move won't overshoot the legal highest scroll point...
if (scrollTarget._y + scrollDist < scrollBG._y) {
// ...then move the calculated amount.
scrollTarget._y += scrollDist;
} else {
// ...otherwise just go to the legal limit.
scrollTarget._y = scrollBG._y;
}
}

// Remember the time so we can calculate how long it's been
// between moves next time we scroll.
lastScrollTime = thisScrollTime;
}