/ Published in: ActionScript 3
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
demo at: http://www.adamcoulombe.info/lab/as3/sliderbox.html
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//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); }
URL: http://www.adamcoulombe.info/lab/as3/sliderbox.html