AS3: Rounding to nearest N


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

syntax:

roundToNearest(45, YourValueHere);


Copy this code and paste it in your HTML
  1. function roundToNearest(roundTo:Number, value:Number):Number{
  2. return Math.round(value/roundTo)*roundTo;
  3. }

URL: http://www.johncblandii.com/index.php/2009/01/as3-rounding-to-nearest-n.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.