Mega Code Archive

 
Categories / Flash ActionScript / Development
 

Use Math round( ) to round a number to the nearest integer

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         trace(Math.round(204.499));  // Displays: 204         trace(Math.round(401.5));    // Displays: 402     }   } }