function roundToDecimal(val:Number, places:int):Number {
    var factor:int = Math.pow(10, places)
    return Math.round(val * factor) / factor;
}

trace(roundToDecimal(Math.random(), 1));
trace(roundToDecimal(Math.random(), 2));
trace(roundToDecimal(Math.random(), 3));


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to