flash scrolling text quesiton
- Started
- Last post
- 13 Responses
- pkny
for all the flash mx pros.. i got a question for you all.. how do i find out the "maximum lines" from a loaded text file containing a string e.g. "text=sdfdsfsfsdfsfdf" using loadVariable ("url", "target) function??
i'm trying to build my scroll bar and it works if dont use the "loadvarable" because i'm using the "text.maxscroll" to find ou the maximum no' lines in a string..
get my drift??
so how do i get maxscroll from a loaded text file?!!??!?! ahdfdsfkdsjlfdjslfsdfjdsf sigh..
thanks
- cosmo0
'list' is the variable name to your dynamic textarea.
scrolling up:
on (rollOver) {
list.scroll++;
}scrolling down:
on (rollOver) {
list.scroll--;
}
- pkny0
thnx for your tip cosmo,
i know what you're talking about.. but in my situation i'm actually trying to build a "vertical scroll bar" that you can drag and it verticla height is dynamically adjusted to the amount of "lines" you have in a text.. sort of like the scroll bar in your internet browers.. the height of hte bar changes.. but i cannot find ou the "maximum line count" when i use "loadvariable" to load a variable from a text file /etc...using your example.. list.maxscroll will only work when i have something like this : list = "blahb lhab lah
blah blah"
list.maxscroll will show up as 2 lines.. get what i mean? - do you a way to find out how many lines from a externally loaded variable?
- pkny0
bump * help a brother out will ya >
- rockonski0
patience, daniel son.
- cosmo0
i'm still n00b at flash bro. ask ponyboy, he is the man for flash.
- pkny0
didn't mean to scare you off cosmo : P
but thanks for everyone who's replied.. i'm looking at tutorials on google.. but i want to appy comp sci skills and write my own >
- Visia0
personally, I don't do it that way. What I usually do is build out a scroll pane from scratch. I find it easier/faster than using the component scrollpane. Plus, you get complete control over everything.
So, basically make a clip called scrollPane.
Drop another clip into that clip at 0,0.
Call the nested clip "kontent" since Flash loves to usurp the name "content".
Then drop a mask overtop of it and call it "kontentMask".
Set the mask.
Then make another clip that will be your scrollbar and call it scrollBar.
Set the scrollBar clip up with some drag action. Lock it to it's own x and then stop it from going beyond the height of your pane on the Y.
Then add an OnClipEvent(enterFrame) to the scrollBar clip.
In the clipEvent set it like so:
reverseY = this._y * -1;
mag = (_parent.kontent._height - _parent.kontentMask._height ) /_parent._kontentMask._height;
_parent.kontent._y = Math.floor(reverseY * mag);What this does is automatically detect the height of the kontent clip and then scrolls it in the opposite direction of the scrollBar clip with a maganification factor according to it's height vs. the height of it's mask.
That way you can do away with the bullshit maxScroll property and drop anything you want into the clip. Text, Images, Animation, Video, etc.
Hope that helps.
- Visia0
whoops, but in my own code. Forgot to subtract the height of the scrollbar from the height of the mask to get the proper mag. should be like so:
reverseY = this._y * -1;
mag = (_parent.kontent._height - (_parent.kontentMask._height - this._height))/_parent._kontentM...
_parent.kontent._y = Math.floor(reverseY * mag);
- kevinv0330
^bump
- pkny0
nm for some reason it works now
anyone interested in my flash - make a post here i'll post it later when its polished
- pkny0
nm it was by fluke
damit
- pkny0
bump
- pkny0
bump bump ba bump