flash accelerometer


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import flash.sensors.Accelerometer;
  2. import flash.events.AccelerometerEvent;
  3.  
  4. var my_acc:Accelerometer = new Accelerometer();
  5.  
  6. my_acc.addEventListener(AccelerometerEvent.UPDATE, onAccUpdate);
  7.  
  8. function onAccUpdate(e:AccelerometerEvent):void{
  9.  
  10. if(e.accelerationZ >=0.9)
  11. {
  12. gotoAndPlay(3);
  13. hitVal = 9;
  14. snd1.play();
  15. }
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.