Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Creative tools for business
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flash Developer Center / Graphic Effects Learning Guide /

Graphic Effects Learning Guide for Flash: Transformations

by Adobe

Adobe Flash Professional

Content

  • Move, scale, skew, rotate, and align transformations
  • Working with the Free Transform tool, Transform panel, and Align panel
  • Transformations and 9-slice scaling
  • 3D transformations
  • Where to go from here

Modified

8 August 2011

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
ActionScript Flash Professional graphic effects

Requirements

Prerequisite knowledge

This guide assumes you are familiar with the Flash Professional workspace and have a basic knowledge of working with FLA files and ActionScript.

User level

Intermediate

Required products

  • Flash Professional (Download trial)

Sample files

  • graphic-effects-lg_pt03.zip

One of the most common tasks for Flash developers is to change (transform) their graphics by moving, scaling, or otherwise altering their layout using the range of features in the Adobe Flash Professional CS5 workspace.

Move, scale, skew, rotate, and align transformations

Graphic transformations are a central part of building tweened animations in Flash Professional. For example, it's common to create an animation where the position, scale, and rotation of object change over time. The animation could be a bouncing ball or scrolling text or an infinite number of other visual effects. While the features that create these animations are very simple, the results can be quite impressive.

Graphic transformations are also used to create effects on static graphics. For example, if you were positioning buttons in a column on the Stage, you could use the Align panel to align their edges or distribute the position of the buttons equally within an area. Moving, scaling, and rotating shapes are also common tasks while creating graphic compositions.

Transformations applied to any display object are undoable. The original state of the object is saved and can be reset using the Transform panel or the Modify menu (Modify > Transform > Remove Transformation).

Working with the Free Transform tool, Transform panel, and Align panel

You can transform drawing objects, grouped objects, text blocks, and symbol instances using the Free Transform tool in the Tools panel (see Figure 1). The Free Transform tool allows you to select and transform display objects on the Stage. Use this option to quickly change your graphics while visually evaluating the transformation.

Figure 1. Free Transform tool in Flash Professional CS5
Figure 1. Free Transform tool in Flash Professional CS5

Check out Jen deHaan's blog post, Set transformation point and reset transformation point in Flash CS3, for some helpful tips for working with the Free Transform tool.

If you need precise control over the transformation effect, you can enter numerical data into the Transform panel (see Figure 2). Use the Transform panel to numerically adjust the scale, rotation, skew, 3D rotation, and center point location of the transformation. The center point is a reference to the point which the object rotates around or scales from.

Figure 2. Transform panel in Flash Professional CS5
Figure 2. Transform panel in Flash Professional CS5

Note: Use the Reset button in the lower right corner of the Transform panel to restore a display object back to its original state.

If you need to align objects, you can use the Align panel (see Figure 3). Use the Align panel to align multiple objects to each other or to the Stage. You can also match the horizontal or vertical sizes of objects or distribute objects evenly within a given area.

Figure 3. Align panel in Flash Professional CS5
Figure 3. Align panel in Flash Professional CS5

For more information on transformations, see the Transforming objects section of the Flash Professional online help and the transform section of the Flash glossary.

Transformations and 9-slice scaling

The 9-slice scaling feature was introduced in Flash Professional 8 and now features an improved, more accurate author-time preview in Flash CS4 and later. This feature gives you better control of the effects of scaling vector graphics within movie clip instances. With 9-slice scaling you can create graphics that can be scaled without the distortion that often occurs in scaling. For example, you may find this feature useful when creating button graphics with rounded corners where the graphic needs to change size while retaining the shape of the original button.

To turn on 9-slice scaling:

  1. Create a new ActionScript 3 FLA and name it 9-slice.fla.
  2. Rename Layer 1 to assets.
  3. Using the Circle tool, draw nine circles of the same size (see Figure 4).
  4. Select all nine circles and convert them to a movie clip symbol (Modify > Convert to Symbol) named Circles.
  5. In the Symbol Properties dialog box, check the Enable guides for 9-slice scaling option.
  6. Click OK to accept the settings and then double-click the instance to enter its symbol editing mode.
  7. Notice the guide lines that appear in the editing mode. Use the cursor to drag the guides to the proper locations to isolate the circles in the corners.
  8. Return to the Stage to view the instance again. Scale it to a larger size using the Free Transform tool. Notice that the circles in the corners do not scale and that the stroke weight remains the same.
Figure 4. Guides available for placement while editing a 9-slice scaling enabled movie clip symbol
Figure 4. Guides available for placement while editing a 9-slice scaling enabled movie clip symbol

For more information on 9-slice scaling, see the Scaling and caching symbols section of the Flash Professional online help and the 9-slice scaling section of the Flash glossary.

3D transformations

Flash Professional CS4 (and later) and Flash Player 10 support 3D rotation of two-dimensional objects using the z property and the rotationX , rotationY , and rotationZ properties of the DisplayObject class. You can access these properties in ActionScript 3 or by using the 3D Rotation tool (W) in Flash Professional (see Figure 5).

Figure 5. View of a display object while being transformed with the 3D Rotation tool.
Figure 5. View of a display object while being transformed with the 3D Rotation tool.

To create a 3D transformation:

  1. Create a new ActionScript 3 FLA file and name it 3d-tween.fla.
  2. Rename Layer 1 to assets.
  3. Draw a shape on Frame 1 and convert it to a movie clip symbol (Modify > Convert to Symbol) named Shape.
  4. Right-click the keyframe containing the shape and choose Create Motion Tween. Make sure the playhead is in the last frame on the Timeline.
  5. Select the 3D Rotation tool. Click the shape and drag it into position. You can adjust the x, y, or z axis by clicking the different lines in the 3D rotation view.
  6. Export the SWF file (Control > Test Movie) to see the 3D tween play.
  7. Save the file.

Note: The 3D Rotation tool can be used with TLF text fields but cannot be directly used on Classic text fields or bitmap images.

For more information on 3D transformations, see the 3D graphics section of the Flash Professional online help and the 3D Rotation tool section of the Flash glossary. Also check out the 3D rotation and advanced 3D effects ActionScript samples.

Display objects can also be transformed using ActionScript at runtime. Each display object contains a common programming interface which allows you to move, scale, rotate, and change the characteristics of the display object instance.

To transform an object using ActionScript:

  1. Create a new ActionScript 3 FLA file and name it transform_as.fla.
  2. Rename Layer 1 to assets.
  3. Draw a shape on Frame 1 and convert it to a movie clip symbol (Modify > Convert to Symbol) named Shape.
  4. Select the instance and name it shape_mc in the Properties panel.
  5. Rename Layer 1 to assets and add a new layer named actions above it.
  6. Select Frame 1 of the actions layer and open the Actions panel (Window > Actions).
  7. Copy and paste the following code in the Script window of the Actions panel:
import flash.events.Event; function enterFrameHandler(event:Event):void { shape_mc.rotationY += 5; } addEventListener(Event.ENTER_FRAME, enterFrameHandler);
  1. Run the Test Movie (Control > Test Movie) command to see the effect. Notice that the shape rotates in three-dimensional space spinning on its y axis. Use a number larger than 5 to speed up the animation.
  2. Save the file.

This sample uses the Stage's ENTER_FRAME event as an animation engine to transform the rotation of the shape. The ENTER_FRAME event fires every time Flash Player enters a new frame, or in the case of a single frame timeline, loops at the speed of the frame rate.

For more information on display object programming, see the Manipulating display objects section of the ActionScript 3 Developer's Guide.

Where to go from here

This section of the Graphic Effects Learning Guide provides an overview of transformation effects and options for applying transformations to your graphics. Spend some time experimenting with the workspace features in Flash Professional and then see if you can reproduce the same effects in ActionScript.

Check out the following resources for more advanced information on working with transformations in ActionScript:

  • Transform and Matrix classes (ActionScript 3 Reference for the Flash Platform)
  • Using matrices for transformations, color adjustments, and convolution effects in Flash (Phil Chung)
  • Working in three dimensions (ActionScript 3 Developer's Guide)

Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License+Adobe Commercial Rights

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

More Like This

  • Graphic Effects Learning Guide for Flash: Color
  • Graphic Effects Learning Guide for Flash: Overview
  • Graphic Effects Learning Guide for Flash: Bitmaps
  • Graphic Effects Learning Guide for Flash: Blend modes
  • Graphic Effects Learning Guide for Flash: Tiles and patterns
  • Graphic Effects Learning Guide for Flash: Inverse kinematics
  • Graphic Effects Learning Guide for Flash: Masks
  • Graphic Effects Learning Guide for Flash: Filters
  • Graphic Effects Learning Guide for Flash: Text
  • Graphic Effects Learning Guide for Flash: Vectors

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement