From 66386a90af8f741e342dd6be88ebb935616ee304 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 24 Nov 2008 23:14:47 +0000 Subject: [PATCH] Use toBitmapData. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@721 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/as/com/threerings/flash/SimpleIconButton.as | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/as/com/threerings/flash/SimpleIconButton.as b/src/as/com/threerings/flash/SimpleIconButton.as index 21816064..71393a6c 100644 --- a/src/as/com/threerings/flash/SimpleIconButton.as +++ b/src/as/com/threerings/flash/SimpleIconButton.as @@ -22,15 +22,8 @@ public class SimpleIconButton extends SimpleButton */ public function SimpleIconButton (icon :*) { - var bmp :BitmapData; - if (icon is Class) { - icon = new (Class(icon))(); - } - if (icon is BitmapData ) { - bmp = BitmapData(icon); - } else if (icon is Bitmap) { - bmp = Bitmap(icon).bitmapData; - } else { + var bmp :BitmapData = ImageUtil.toBitmapData(icon); + if (bmp == null) { throw new Error("Unknown icon spec: must be a Bitmap or BitmapData, or a Class " + "that becomes one."); }