AS3 Scale9 Bitmap
General:
AS3 Scale9 Bitmap is helper class that lets you create scale9 sprites with bitmap data fill - originally this was not possible in Flash 9. The helper class creates a "fake" scale 9 sprite containing 9 shapes that scale according to user-defined scaling matrix. Extremely useful for user interface work (creating buttons, scalable UI elements etc.).
Contents:
- Scale9SimpleStateButton - class for creating resizing 1, 3 or 3 state buttons from bitmap data (skins);
- Scale9SimpleBitmapSprite - class for creating static resizing UI elements from bitmap data (skins);
- Example code (Flex Builder 3 project);
Requirements:
Actionscript 3
Demonstration 1:
Scale9SimpleStateButton (top left), Scale9SimpleBitmapSprite (top right) and original skin files (bottom row)
Demonstration 2:
UI elements created from a stylesheet using AS3 Scale9 Bitmap class, see this blog post for details.
Example Syntax:
Actionscript:
-
var scale9_example:Rectangle = new Rectangle(6,6,105,20);
-
-
/* Initialize the button with all 3 states (normal, hover, down) using 3 different bitmaps */
-
var button_example:Scale9SimpleStateButton = new Scale9SimpleStateButton(
-
scale9_example,
-
button_skin_normal.bitmapData,
-
button_skin_hover.bitmapData,
-
button_skin_down.bitmapData
-
);
-
-
/*
-
* Scale the button using "width" and "scaleY" properties
-
* (in general you can use "width", "height", "scaleY", "scaleX" properties for scaling)
-
*/
-
-
button_example.width = 300;
-
button_example.scaleY = 2;
Latest version
Download link (48Kb)


February 18th, 2009 at 7:11 pm
[...] Documentation Download AS3 Scale9 Bitmap [...]
February 18th, 2009 at 11:25 pm
[...] http://www.uza.lt/codex/as3-scale9-bitmap/ [...]
February 19th, 2009 at 8:08 am
[...] 翻译自:http://www.uza.lt/codex/as3-scale9-bitmap/ [...]
February 20th, 2009 at 6:30 am
[...] know yesterday I released one of the new UI helper classes that we are using in this project - AS3 Scale9 Bitmap letting you create scalable, state aware UI elements from bitmap data. Today I will show you a very [...]
February 21st, 2009 at 11:49 am
[...] programuotojas Paulius Uza pristatė AS3 biblioteką, palengvinančią grafinės sąsajos elementų kūrimą naudojant rastrinius paveiksliukus. [...]
October 15th, 2009 at 6:09 pm
Seems very usefull, but as a newbie I cant get it to work. Getting the error :
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at AS3Scale9Bitmap()
Is it posible to provide a working fla file?
Martijn
January 18th, 2010 at 5:35 pm
[...] AS3 Scale9 Bitmap [...]
February 5th, 2010 at 5:19 am
[...] AS3 Scale9 Bitmap 一个创建9宫的类。 [...]
March 6th, 2010 at 10:36 am
[...] AS3 Scale9 Bitmap 一个创建9宫的类。 [...]
May 16th, 2010 at 7:23 pm
[...] AS3 Scale9 Bitmap 一个创建9宫的类。 [...]
July 15th, 2010 at 8:48 am
[...] AS3 Scale9 Bitmap 一个创建9宫的类。 [...]