advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the Sample Code
Partners & Affiliates
advertisement
advertisement
advertisement
Rate this item | 0 users have rated this item.
Email this articleEmail this article
 
Get Distortion-Free MovieClip Scaling in Nine Easy Slices
When it comes to Flash 8's scale9grid feature, it really does depend on how you slice it. 

advertisement
ow many times have you scaled a movie clip that started out looking like Figure 1 ...and ended up looking like Figure 2?


It's quite common to see your carefully created movie clips distort before your very eyes, losing all corner definition, thinning and thickening their strokes, and generally making messes of themselves.

How many times have you wished that your beautiful rounded-corner movie clips would scale like components, without distorting the corners or the thickness of the lines? Wouldn't you rather your scaled movie clip look like Figure 3?

Well, now it can, thanks to Flash 8's scale9grid movie clip property.


Figure 1. Before: This is the original movie clip prior to scaling.
 
Figure 2. After: This is the same movie clip after scaling.

This feature works on a fairly simple principle, one that should even be quite familiar to many Web designers. The idea is to divide the movie clip into 9-slices, effectively creating a 3 x 3 grid, as seen in Figure 4.

The center of the grid will scale normally. The top, center and bottom, center cells of the grid will only scale horizontally, and the left, center and right, center sides of the grid will only scale vertically. The four corners of the grid will not scale at all, thus maintaining a crisp and clean appearance.


Figure 3. Cornered: This is the same movie clip as in Figure 2 after scaling with 9-slice scaling.
 
Figure 4. Diced: This is the same movie clip as in Figure 1 with 9-slice scaling enabled.

Enabling 9-slice Scaling via the Flash Interface
Although you have more freedom to change your mind on the fly when using ActionScript, taking advantage of 9-slice scaling does not require code. When creating a symbol, you will see the typical Create New Symbol or Convert to Symbol dialogs. If your dialog is minimized, click on the Advanced button. You will then see Linkage options, as well as a Source section when working with imported assets. The same features can be seen in the Symbol Properties dialog (seen in Figure 5), which is accessible via the Library.

Down at the bottom of this enlarged dialog is a checkbox labeled "Enable guides for 9-slice scaling." When enabled, a default set of grid guides will be positioned 25 percent of the clip width from the left and right edges, and 25 percent of the clip height from the top and bottom edges. This grid can be seen in the Library preview, illustrated in Figure 6.


Figure 5. Sans Script: You can enable 9-slice scaling, without any ActionScript, through the Symbol Properties dialog.
 
Figure 6. Grid Guides: When enabled, the grid guides for movie clips that have 9-slice scaling can be seen in the Library preview.

Although the grid cannot be seen when editing a movie clip in place on the stage, each time you edit the symbol via the Library or Symbol Menu, the gridlines can be manually adjusted by dragging each with the mouse. Thereafter, scaling will honor this grid and preserve the appearance of the movie clip as you originally intended it to look. The first source file that accompanies this article, "scale9grid_01.fla," uses this technique to enable 9-slice scaling for the sole movie clip in the file.

  Next Page: Dynamically Assigning the Property with ActionScript


Page 1: IntroductionPage 2: Dynamically Assigning the Property with ActionScript
Untitled
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES