Posted By

sidneydekoning on 07/15/09


Tagged

height as3 percentage


Versions (?)

Calculating the height of an object to percentages in relation to the mouse position


 / Published in: ActionScript 3
 

  1. // Calculating the mouse position within an object to percentages in relation to its height
  2.  
  3. // var scale = 100 ( result range from 0 - 100 )
  4. // var scale = 10 ( result range from 0 - 10 )
  5. // var scale = 1 ( result range from 0 - 1 )
  6.  
  7. trace( ( mySprite.mouseY / mySprite.height) * scale );

Report this snippet  

You need to login to post a comment.