Learn how to control and track item position on stage using the slider component.
HERE IS THE SOURCE CODE!
// Avraham Saltoun
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
import fl.controls.Slider;
import fl.events.SliderEvent;
// This will import slider
// properties, methods and events
xSlider.value = ball.x;
ySlider.value = ball.y;
//This will adjust the sliders
// to hold the value of the
// coordinates of present location
xSlider.addEventListener (SliderEvent.CHANGE, sliderChange);
ySlider.addEventListener (SliderEvent.CHANGE, sliderChange);
//Both Sliders will go to the same function
function sliderChange (event:SliderEvent){
switch (event.target.name){
case ‘ySlider’:
ball.y = event.target.value;
break;
case ‘xSlider’:
ball.x = event.target.value;
break;}
x_txt.text = String(ball.x);
y_txt.text = String(ball.y);
}
//thanks for watching
// subscribe from the website.






2 Responses to “Controlling Item Position on Stage with the Slider Component”
Trackbacks/Pingbacks