Hey Wilbert!
These things are awesome. I'm starting a new "Code of the week" forum and this is the number one post. You could get rich with your component skills man......unreal.
Printable View
Hey Wilbert!
These things are awesome. I'm starting a new "Code of the week" forum and this is the number one post. You could get rich with your component skills man......unreal.
Quote:
Originally Posted by w.brants
That was me...I was subtracting -15 to test until I knew it was a go. I've since squared it away...good eye man!
Hi Chris
Wher do I have to insert the code, that adds the scrollbar?
I know that Im a noob :-D
Niclas
Hang tight Zongo..I'll make a movie that has two dynamic textboxes. One with text that exceeeds the visible space and one that doesn't so you can see how the code is placed and how it works depending on the text length. BRB.
That woud be so cool!
Nice board, nice people :-)
Niclas
http://actionscript.hobby-site.com/e...ongoZongo.html
This uses that second example Wilbert posted that lets you also click inside the text and scroll with a mousewheel (as well as with the bar itself). Save this man...to me...it's just one of the best snippets I've seen since buying KM and exactly what you wanted in your original post. Wilbert is our resident script guru and this is just a perfect example of why ;)
I better explain how maxscroll is used in that.
if(o.maxscroll >1){
If so much as one line of the text inside the field exceeds the visible space (number of lines) in the field...it will attach the bar. If it is even one line less than the visible space...it will not. They are fast too just like he said. I played with them all night ;)
ok, that works fine. But there is one Problem left :-)
How can i remove the scrollbar? I need this functionality, becaus the text inside the textfield is dynamic. So if a short text is loaded into the textfield, the scrollbar remains.
thx,
Niclas
Has to be your coding. My forum is using code like that now ( every bit of text in my fields is delivered via MySQL/PHP) and is acting perfect with that exact thing. Some posts are long...some short. It attaches as it should. Remember...it needs to be initiated after the text is loaded. If you reload or the text changes at runtime (which my forum does if people edit their posts) you have to make sure to reload the routine. Post your fun file if need be :)
For example...my posts are brought in with a loadvars. On success the text is sent to the field and then my clip is told to advance one frame where I initiate that routine. It then checks the textsize and attaches if need be. If any user edits a post...on submit the whole sequence is reloaded as above so it's always based on the current text value.
If you want to hide it, you can use the _visible property.
Like Chris suggested you can use maxscroll. In case the textfield is named 'txt1' and the scrollbar 'slider', You could use something like thisIn case maxscroll is bigger than one the expression will be true so the scrollbar will be visible. Otherwise visibility will be set to false.Code:slider._visible = txt1.maxscroll > 1;
ok, I modified the zongozongo.fun. Its still a quite simple example. But if you set the text und then remove it, the bar stays. I execute the code everytime the button a button is pushed.
www.maduria.de/diverses/ZongoZongo.fun
Niclas
Oh, w.brants was too fast. I didnt read that post. Now everything is fine :-)
Thank you guys
Niclas
We're thinking of kidnapping him...tying him down and tickling him with a feather to see what other secrets he holds ;)
Hey Chris
Do you know, how I can remove the bevel of the scrollbar? Are there more parameter to set the looking? Coldnt find anything in the www.
And one last important thing: How can i scroll the text to the beginnen with actionscript?
THX,
Niclas
You can set a text to the beginning with the scroll parameter.The bevel can be controlled with the s array. You can place it after the c array you use to set the colors.Code:myTextField.scroll = 1;
,c:[0xbfbfdf,0xefefff,0xefefff,0x6f6f9f],s:[0,0,0]
The first value is the amount of bevel, the second the angle, and the third the alpha of the slider shadow (between 0 and 1)