Just a txt.textWidth should do the trick
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Perdue, Blake Sent: donderdag 21 december 2006 22:28 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Measuring width of some text I need to measure the width of some text. Here's the function I'm using: private function getTextWidth(txt,fontSize) { var fmt=new TextFormat(); fmt.font='Univers 67 CondensedBold'; fmt.size=fontSize; fmt.autoSize='left'; var metrics=fmt.getTextExtent(txt); return metrics.textFieldWidth; } This function is not predictable - for the same text, it returns different numbers on different OSes or flash player versions: - works fine in IE/FF for flash player 6 - doesn't work in Mac Safari for flash player 6 - works fine in IE/FF for flash player 8 using Service Pack 1 - doesn't work for IE/FF for flash player 8 using Service Pack 2 Is there another function I can use, or another way to go about measuring the width of some text? Blake Perdue | 212.522.1292 | AIM: blakepCNN _______________________________________________ Flashcoders@chattyfig.figleaf.com 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 _______________________________________________ Flashcoders@chattyfig.figleaf.com 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