Hello,
You may have noticed my post yesterday. Well I’m almost done with the little project. I’ve got a TLF text field with a custom scroll bar AND some buttons attached to it so I’m feeling pretty slick. Unfortunately, I just dont have enough knowledge to make the buttons interact with the scroll bar (as we see in the browser scroll bars or the UIScrollBar)
So I can scroll away AND I can click the buttons to make the text roll. but the buttons don’t affect the position of the scroller and that just isn’t good enough! If you would care to have a peek and see inside the mind of a newbie I’ve attached my FLA file and pasted the AC code below. Please help me by explaining how to make the scroller interact with my buttons. Thank you for your time!!!
import flash.geom.Rectangle;
var dragRect:Rectangle = new Rectangle(drag_mc.x,drag_mc.y,0,bar_mc.height - drag_mc.height);
drag_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragMouseDown);
function dragMouseDown(e:MouseEvent):void
{
drag_mc.startDrag(false,dragRect);
stage.addEventListener(MouseEvent.MOUSE_UP, dragMouseUp);
addEventListener(Event.ENTER_FRAME, scrollText);
}
function dragMouseUp(e:MouseEvent):void
{
drag_mc.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, dragMouseUp);
removeEventListener(Event.ENTER_FRAME, scrollText);
}
function scrollText(e:Event):void
{
var percentScrolled:Number = (drag_mc.y - bar_mc.y) / (bar_mc.height - drag_mc.height);
info_txt.scrollV = Math.round(percentScrolled * info_txt.maxScrollV);
}
upBtn_mc.addEventListener(MouseEvent.MOUSE_DOWN, pullText);
function pullText(e:MouseEvent):void
{
info_txt.scrollV --;
}
downBtn_mc.addEventListener(MouseEvent.MOUSE_DOWN, pushText);
function pushText(e:MouseEvent):void
{
info_txt.scrollV ++;
}