Automatic resize

I know in php there is a tag to resize a image simply:

$width = 120;
$height = 80;

  if ($width && ($size[0] < $size[1])) {

$width = ($height / $size[1]) * $size[0];
} else {
$height = ($width / $size[0]) * $size[1];
}

However, how to do this in FLASH???