Dynamic text with scrollbar

Page 1 of 2
Greg Meyer
This user is yet to take control of their account and provide a biography. If you are the author of this article, please contact us via support AT actionscript DOT org.
View all articles by Greg MeyerWritten by: Greg Meyer
Difficulty Level: Advanced
Requirements: Flash 4
Download FLA
NB: Tutorial upated May 23rd 2001
1) Let start.

Create 2 lyers "actions" and "Lyer 1"
Add actionscript for lyer "actions" on frame 1 :
ms = textbox.Message.maxscroll;
if (ms>1) {
if (dragpress<1) {
scale = 138/ms;
_root.textbox.scrollbar.scrollbox._yscale = 200/textbox.Message.maxscroll;
_root.textbox.scrollbar.scrollbox._y = -68+((textbox.Message.scroll-1)*scale);
if (textbox.scrollbar._visible == false) {
_root.textbox.scrollbar._visible = true;
}
} else if (textbox.scrollbar.scrollbox._y<-66 and move<0) {
move = 0;
textbox.scrollbar.scrollbox._y = -68;
} else if (textbox.scrollbar.scrollbox._y+textbox.scrollbar.scrollbox._height>69 and move>0) {
move = 0;
} else {
textbox.scrollbar.scrollbox._y = textbox.scrollbar.scrollbox._y+(move*scale);
textbox.Message.scroll = ((textbox.scrollbar.scrollbox._y+68)/scale)+1.2;
}
} else {
if (textbox.scrollbar._visible == true) {
textbox.scrollbar._visible = false;
}
}
Add actionscript for lyer "actions" on frame 2:
gotoAndPlay (1);
Create MC (emailmovie) for lyer "Lyer 1" and in INSTANS window name is a "textbox"

Edit MC (emailmovie)

Lyer 2 has an actionscript on frame 1
loadVariables ("message.txt", "_root.textbox");
stop ();
Lyer 1 has a text field on frame 1
Lyer 3 has a MC scrollbar on frame 1 and in INSTANS window name is a "scrollbox"

