# Dynamically Display custom Slider value

**URL:** <https://forum.kirupa.com/t/dynamically-display-custom-slider-value/292175>\
**Category:** flash\
**Created:** [July 10, 2009, 10:00pm UTC](https://forum.kirupa.com/t/dynamically-display-custom-slider-value/292175 "2009-07-10T22:00:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewlong](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@andrewlong](https://forum.kirupa.com/u/andrewlong)\
**Post date:** [July 10, 2009, 10:00pm UTC](https://forum.kirupa.com/t/dynamically-display-custom-slider-value/292175/1 "2009-07-10T22:00:38Z")

</div>

I had to create a non-component slider for a project. I am new to actionscript (and entirely self-taught so bear with my probably poor programming style) and have no idea how to display the value as the thumb moves. Is there a way to use the sliderevents outside of the slider components, or is there a way to update a text box as the slider moves outside of the sliderevents. Here is the code for one of the sliders if it helps:

function getPercentageA() {  
return Math.ceil(((slidera.thumb.x-slidera.Track.x)/slidera.Track.width)\*100);  
}  
slidera.Track.addEventListener(MouseEvent.MOUSE\_DOWN, slidethumba);  
function slidethumba(event:MouseEvent):void {  
slidera.thumb.x=mouseX-slidera.x;  
slidera.thumb.startDrag(false, new Rectangle(slidera.Track.x,slidera.Track.y,slidera.Track.width,0));  
a\_display.text=String(getPercentageA())+"%";  
}  
slidera.Track.addEventListener(MouseEvent.MOUSE\_DOWN, changecolora);  
function changecolora(event:MouseEvent):void {  
var myColor:ColorTransform=slidera.thumb.transform.colorTransform;  
myColor.color=0x33ff00;  
slidera.thumb.transform.colorTransform=myColor;  
slidera.Track.removeEventListener(MouseEvent.MOUSE\_DOWN, changecolora);  
}  
stage.addEventListener(MouseEvent.MOUSE\_UP, stopslidea);  
function stopslidea(event:MouseEvent):void {  
slidera.thumb.stopDrag();  
}  
slidera.thumb.addEventListener(MouseEvent.MOUSE\_DOWN, slidethumba);

Thank you for your help
