Return to Snippet

Revision: 15736
at July 15, 2009 06:02 by sidneydekoning


Updated Code
// Calculating the mouse position within an object to percentages in relation to its height

// var scale = 100 ( result range from 0 - 100 )
// var scale = 10  ( result range from 0 - 10 )
// var scale = 1   ( result range from 0 - 1 )

trace( ( mySprite.mouseY / mySprite.height) * scale );

Revision: 15735
at July 15, 2009 05:53 by sidneydekoning


Initial Code
// Calculating the mouse position within an object to percentages in relation to its height

// result range from 0 - 1
trace( ( mySprite.mouseY / mySprite.height) * 1 );
// result range from 0 - 100
trace( ( mySprite.mouseY / mySprite.height) * 100 );

Initial URL


Initial Description


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

Initial Tags


Initial Language
ActionScript 3