Controlling Item Position on Stage with the Slider Component

Wed, Jan 27, 2010

ActionScript

Controlling Item Position on Stage with the Slider Component

This movie requires Flash Player 9

Learn how to control and track item position on stage using the slider component.

HERE IS THE SOURCE CODE!

//The ActionScript 3.0 The Slider Component
// 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.

Related Articles:

, , , , , , , , , , , , , , ,

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


Trackbacks/Pingbacks

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


1,260
Unique Visitors
Previous 30 Days
Powered By Google Analytics