1 Reply Latest reply on Oct 2, 2013 4:29 AM by Ned Murphy

# movie clip position that effect numeric dynamic text box

Hi

How is it possible to make a movie clip, that would act like a horizontal scroll bar

and when i move it to the left end would generate 0 number in dynamic text box and when i move it to the right it will generate bigger result..

http://i.imgur.com/GqR3Yv3.png

where can i find piece of code to study from ?

thanks

• ###### 1. Re: movie clip position that effect numeric dynamic text box

The concept you need to base this on is to take the ratio of the position of the movieclip to range of positions it could possibly have and use that ratio against some range of values.  In mathematical terms it would be

mc.x/(mcXmax-mcXmin) * 1000

In that calculation, mc.x is the mc's current position, mcXmax and mcXmin are the endpoints of its possible positions (its drag limits), and 1000 is the range of values that you want its position to represent (the 1000 value in the image you linked)  You will need to use the Math.round() function to get the values to be integers.