Tutorial: Page (1) of 2 - 11/09/05 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page facebook
Scale-9 From Outer Space One of Flash 8's "under the radar" features explained By Kevin Schmitt

As I dive deeper and deeper into Flash 8 Pro, a few things are starting to stand out as "stealth" features, meaning that while not exactly highly touted, they are proving themselves highly useful. One such feature is 9-slice scaling (AKA Scale-9), which, judging by its various names, would seem to refer to some sort of scaling and/or slicing. So what exactly is Scale-9, and just how "highly useful" could it possibly be?

Where were you in January?

The best way to illustrate what Scale-9 does to cite a real-world example, so I'll use one which caused your humble author no small amount of pain and consternation. At the beginning of this year, I was working on a project that needed to have several text boxes, each of varying sizes and coordinates depending on the section the user was reading. I've abstracted the look of these boxes somewhat for our purposes today, but suffice it to say that it was something like the one shown in Figure 1.


Figure 1

This was a big project, one with more than a few text boxes, so I came up with a single Movie Clip that I could drag onto the stage, "attach" (in ActionScript) properties such as the height and width (which were calculated automatically from the size of the text in the field), x and y coordinates, the label, and text for each instance, and it would assume the correct position and size at runtime. Think of it as a poor man's Component I was building, since I did everything short of actually compiling it as a Component. Anyway, with the thin lines and drop shadow and everything, I had to write an inordinate amount of ActionScript in order to take all the input and essentially rebuild the "simple" box out of its various pieces each time a new instance was made. As for the shadow itself, I had to generate out several semi-transparent PNG files so the corners of the shadow would stay the same size while the left, right, top and bottom borders of the shadow would scale to fit. It was a huge pain to do, but ultimately very much worth it, as the up-front effort made the development process a lot easier for myself once it came time to put the content in. I was especially thankful I was doing it this way after text changes started coming in that altered the size of the boxes, since all that was required was to drop the new text into an external file and my pseudo-Component would resize itself on the fly based on the whatever text was there. A pain, but handy. But then Flash 8 came along and made that whole exercise moot. Enter Scale-9.

An abstract example

The simplest definition I can come up with is this: Scale-9 is the process in Flash whereby you define a 3x3 grid over a Movie Clip. This grid bisects your clip into nine sections (think of a tic-tac-toe grid), and allows scaling of the clip so that the corners will stay the same size, the top and bottom edges scale horizontally, the left and right edges scale vertically, and the center scales both ways. So, if I were to take a simple circle and enable Scale-9, you'd get something like Figure 2:


Figure 2: On the left, our base circle. In the middle, the circle scaled to 3x width and 1.5x height. On the right, same circle, same scaling, but with Scale-9 enabled.

Makes sense so far, right? Scale-9 keeps things like corners, edges, and strokes from getting wonky, yet still scales your clips as smooth as buttah. So the question becomes: how do I turn this super-cool feature on and use it in my Flash movies?

How to turn this super-cool feature on and use it in your Flash movies

There are two ways to enable Scale-9: through the GUI, and through ActionScript. Neither is particularly hard, so I'll go through both using the text area example I spoke of earlier. Let's do the GUI first.


Page: 1 2 Next Page


Related Sites: Creative Mac ,   Digital Producer ,   Digital Animators ,   Animation Artist ,   Audio Video Producer ,   Corporate Media News ,   Digital Game Developer ,   Digital Media Designer ,   Oceania ,   MacAnimationPro ,   MacDesignPro ,   Test Site ,   Flash
Related Newsletter: DMN Newsletter ,   CMN Newsletter ,   Pixels Newsletter ,   Levels Newsletter ,   Mac Alert Newsletter ,   Renders ,   Digital Media Net ,   DMNForums ,   Tutorial Finder

DMO TEXT LINKS
(Click here to place a textlink on this site)

Vegas Pro 8 + Free Vegas Seminar Series
Master classes for cutting-edge video production
A $100 value free with purchase
CLICK HERE!!!

HOT THREADS on DMN Forums
Content-type: text/html  Rss  Add to Google Reader or
Homepage    Add to My AOL  Add to Excite MIX  Subscribe in
NewsGator Online 
Real-Time - what users are saying - Right Now!
    • Re: Acid Pro 7 loops question • JohnnyRoy
    • Re: Rendering to .avi files • yigalsela
Content Insider #148 - The iGen
NO...Doesn't have a thing to do with "that" smartphone...or "that" store...or "that" tablet. It's the next generation. Kids and we mean little kids. That's what today's products are being designed for/targeted at. You happen to buy one...fine. Watch a little, little kid pick up a smartphone. He/she just uses it. They've come pre-wired and we're still trying to figure out how to IM. It's the IGen. They want it instantly. They want to use it instantly. They expect their photos, their video, their music, their stuff immediately when/where/how they want it. Read More
eBay Essential Training: Proxy Bidding
In this clip, lynda.com host Mark Abdelnour takes a look at proxy bidding. He discusses the strategy and how it works. He also discusses the maximum bid, and when to use Proxy bidding. Read More
Insider #149 - Game Demographics
The blood, gore, adrenalin challenges that were unveiled at E3 and enjoyed at ComicCon are fun to look at, easy to hold but are they really the games people want to plunk down their credit cards to own or rent time with? Seems as though the investors, the players who control the controllers have a different idea of a "good" game than the kids who develop them. While mobs of people play educational, informational, stimulating games our kid huddles in his room and mumbles "The Few, The Proud, The Gamers." Read More
Social Media #3
Part of a series of articles to plainly explain what organizations need to consider and carry out in today's social media. Read More
@ Copyright, 2010 Digital Media Online, All Rights Reserved