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:

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

Leave a Reply

Security Code:

AVA Trading Forex
WIX create a FREE website.
Try ACT! 2010 Today
Accept Credit Cards
UseNeXT Fast Downloads
For Free Stuff Click Here

Get Paid for Filling Surveys


Go Daddy $7.49.com sale 125x125 Huddle Collaboration
oDesk Certified Action Script Programmer oDesk Certified Adobe Flash CS3 Designer oDesk Certified Adobe Photoshop 6.0 Designer

Compare Web Hosting Services and Prices

web hosting - Web Hosting guide to popular hosts.

Twitter Followers