Posted By

adamcoulombe on 06/26/10


Tagged

actionscript flash demo slide as3 panning


Versions (?)

Who likes this?

14 people have marked this snippet as a favorite

Demian
socialflasher
mdavidwalker
TrentSkunk
adrianparr
davidino1978
tspitzr
onemanstudio
mitien
ckueda
swapnil
dubogii
sashby
jondiscipulo


AS3 Easy Mouse Panning


 / Published in: ActionScript 3
 

URL: http://www.adamcoulombe.info/lab/as3/sliderbox.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

  1. //A simple demo that shows how to pan from one side of an object to another dynamically in actionscript 3.
  2.  
  3. //demo at: http://www.adamcoulombe.info/lab/as3/sliderbox.html
  4.  
  5. import fl.transitions.Tween;
  6. import fl.motion.easing.*;
  7. import fl.transitions.TweenEvent;
  8.  
  9. var sliderBoxTween:Tween
  10.  
  11. stage.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoved)
  12.  
  13. function mouseMoved(e){
  14. var xPercent = mouseX / stage.stageWidth;
  15. var newXPos = (stage.stageWidth - sliderBox.width) * xPercent;
  16. sliderBoxTween = new Tween(sliderBox, "x", Circular.easeOut, sliderBox.x, newXPos, 1, true);
  17. }

Report this snippet  

You need to login to post a comment.