Scrollbar with Sprite and Rectangle won't move text, just the Rectangle it's painted on.
Posted
by WebDevHobo
on Stack Overflow
See other posts from Stack Overflow
or by WebDevHobo
Published on 2010-03-08T19:59:06Z
Indexed on
2010/03/09
3:06 UTC
Read the original article
Hit count: 302
Warning: school assignment.
For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.
So I needed to get a Scrollbar, which I got here: http://kirupa.com/forum/showthread.php?t=245468
(all files in a zip linked at the end of this text)
The thing is, it works with Sprites. After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.
So I tried adding the TextFieldExtended instance to a Sprite instance using addchild. A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.
My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?
If so, any scrollbars you can recommend, because it's too extended for me at this point.
All files: http://www.mediafire.com/?q2ium22gmox This was made in Flash CS4 using ActionScript3. The Example class is the final implementation
© Stack Overflow or respective owner