Use Math.round( ) to round a number to the nearest integer : Math : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » Math »

 

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
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» Math