[as3]
//A simple demo that shows how to pan from one side of an object to another dynamically in actionscript 3.

//demo at: http://www.adamcoulombe.info/lab/as3/sliderbox.html

import fl.transitions.Tween;
import fl.motion.easing.*;
import fl.transitions.TweenEvent;

var sliderBoxTween:Tween

stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved)

function mouseMoved(e){
var xPercent = mouseX / stage.stageWidth;
var newXPos = (stage.stageWidth – sliderBox.width) * xPercent;
sliderBoxTween = new Tween(sliderBox, "x", Circular.easeOut, sliderBox.x, newXPos, 1, true);
}
[/as3]

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation