inicio mail me! sindicaci;ón

t-roy.net*

blog by designer troy ginbey

scale9Grid in AS3.0

Wow… every so often you stumble upon something that you know will change the way you design forever. I was flicking through the ACP (Adobe Certified Professional) Exam Guide for Flash CS3 (as you do on a Sunday), and came across something I didn’t recognise - scale9Grid.

scale9Grid divides a display object into 9 regions, allowing different rules to be applied to it when the object is scaled.

How is this useful?? Well.. think about designing a simple content area with rounded corners. You want the content area scale vertically as the amount of text it holds increases. With any normal object with rounded corners, as you scale it’s height, the corners would scale and distort the more it is verticaly scaled. Enter scale9Grid. With one line of code, you can define the regions of the rounded rectangle to allow for distortion free scaling… Here’s an example:

myRoundedRectangle.scale9Grid = new Rectangle(10,10,300,600);

The above code adds a scale9Grid to a rounded rectangle object - meaning when it is scaled, the rounded corners will stay the same…. Brilliant!

2 Comments »

  marc wrote @ August 1st, 2008 at 2:39 pm

proof it.

:)

I haven’t been able to get a dynamic textfield to resize the scaling in Flash CS 3

In flex it’s easy to do for buttons etc, but I just haven’t run into any examples on how to do it for flash with a movieclip instead of a button

Thanks,
marc

  Paul Ferrie wrote @ September 12th, 2008 at 6:42 pm

Yeah i have none about 9slice for some time but never used till recently. I am porting my flash site ( http://www.innovativedesigns.org.uk/go.php )AS2 over to AS3 and as part of that i am using 9slice with most of my objects to make sure the site and elements are minimal. Really useful when look at the bigger picture of something.

Your comment

HTML-Tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>