# MX: Custom Scrollbar... \_ymouse trouble?

**URL:** <https://forum.kirupa.com/t/mx-custom-scrollbar--ymouse-trouble/169677>\
**Category:** flash\
**Created:** [November 18, 2005, 8:13am UTC](https://forum.kirupa.com/t/mx-custom-scrollbar--ymouse-trouble/169677 "2005-11-18T08:13:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CEOofAEP](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@CEOofAEP](https://forum.kirupa.com/u/CEOofAEP)\
**Post date:** [November 18, 2005, 8:13am UTC](https://forum.kirupa.com/t/mx-custom-scrollbar--ymouse-trouble/169677/1 "2005-11-18T08:13:56Z")

</div>

G’day.

I made a custom scrollbar for a textfield that works like a charm… but in it’s “alpha-state”, it was only showing where the text was scrolled to (and how long the text is, by it’s own height)- you couldn’t actually click the scrollbar and drag it.

So I added a little AS to the actual scrolling block MC that _should_ work… and kind of does- but not like I think it logically should…?

Here’s the code:[AS]on(press) {  
\_root.start\_y = \_ymouse;  
}  
on(release, releaseOutside) {  
\_root.start\_y = undefined;  
}

onClipEvent(mouseMove) {  
if (\_root.start\_y != undefined) {  
// = do the following only if left mouse button is held:  
if (\_ymouse \> \_root.start\_y) {  
trace(“Down”)  
\_root.scrollDown();  
} else {  
if (\_ymouse \< \_root.start\_y) {  
trace(“Up”)  
\_root.scrollUp();  
}  
}  
}  
}[/AS](“scrollUp” and “scrollDown” are functions on the main timeline’s “Actions” Layer for setting the textfield’s “scroll”-value… the textfield itself has an “onScroller” attached to it that positions the scrollbar)

Like I said- all this works well BUT when I’m dragging down and then back up, the traced output “sputters” something like:  
[…]  
Down  
Down \<- changed from dragging down to to dragging up, here  
Up  
Down  
Up  
Down  
Up  
Up  
Up  
[…]

When I also traced the “\_ymouse”-value, it actually _DID_ skip between values in an unusual way (higher and lower than the “\_root.start\_y” value) that justifies the sputtering- so I’m guessing that there’s a problem with the “\_ymouse”-retrieving…?

Has anyone had similar trouble? If so and you think you know what it could be, please pose a reply- if not, I’ll derive a reduced version of the FLA-file with just the code in question and post it here.

Thanks in advance!
