Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy 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
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / Flash Developer Center /

Manipulating springs of an inverse kinematics bone for animations

by Fumio Nonaka

Fumio Nonaka
  • fumiononaka.com
  • jactionscripters.com

Created

4 October 2010

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash Player 10.1Flash Professional CS5
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

Prerequisite knowledge

Some prior experience working with ActionScript 3 is recommended. Familiarity with the Flash authoring environment is also helpful.

User level

Beginning

Required products

  • Flash Professional CS5 (Download trial)
  • Flash Player 10.1

This article is the second of seven in a series highlighting examples of programming strategies that make it easier than ever before to create rich content in Adobe Flash CS5 Professional. Adobe Flash Player 10 introduced the ability to control parts of an animation using inverse kinematics (IK). Now, using Flash CS5, you can apply the effect of a spring to an IK armature.

The Developer Center article titled Exploring the Spring tool in Flash Professional CS5 explains how to add and control the spring's motion. In order to control an IK armature with ActionScript 3, you must first create the animation elements in the Flash authoring environment.

The following sample movie is designed as a bare bones test, so that is easier to understand how to set and control the properties. In a real world example, you can use any number of elements in the armatures you create.

  1. Create two objects on the Stage.
  2. Press F8 to convert each object to a movie clip symbol. (In this example, a bitmap graphic of a penguin and a yellow rounded rectangle shape were used to create the two movie clip symbols—but you can use two ovals or other shapes as desired).
  3. Use the Bone tool to draw one IK bone that connects the two symbol instances. While it is selected, enter its name in the Property inspector: ikBoneBar.
  4. In the Property inspector, enable Joint Rotation and set the Constrain values to a minimum value of −45° and a maximum value of 45°.
  5. Rename the layer name of the IK armature to myArmature in the Timeline, as shown in Figure 1.

Notice that when you are working in the authoring environment, you could set the value for Spring by entering a numeric value in the Spring section at the bottom of the Property inspector; leave this value set to 0.

Create one IK bone without a Spring setting to build the IK armature.
Figure 1. Create one IK bone without a Spring setting to build the IK armature.
  1. To set the Spring value with ActionScript, select the IK armature in the Timeline and set the Animation Type to Runtime using the Type menu in the Options section of the Property inspector (see Figure 2).
Set the IK armature from Authortime to Runtime in the Type menu.
Figure 2. Set the IK armature from Authortime to Runtime in the Type menu.

A Spring is assigned to a reference of an IK joint obtained from the IK bone. The process for controlling IK joints with ActionScript is essentially the same as in Flash CS4. First, you'll use the IKManager.getArmatureByName() method to get an IKArmature object, in order to pass in the IK Armature's name. Next, call the IKArmature.getBoneByName() method with the IKArmature object referrer and pass an IK bone's name to the method as an argument. The method will return the reference of the IKBone object. Finally, you can manipulate the IKJoint object by setting its IKBone.headJoint and IKBone.tailJoint properties.

At this point, a spring can be assigned to the IKJoint object. As you saw in Figure 4, the Spring section in the Property inspector for an IK bone contains two controls, Strength and Damping. Using ActionScript, two properties are available to set the values: IKJoint.springStrength and IKJoint.springDamping respectively.

  1. Paste the following frame script into Frame 1 of the ActionScript layer. This script sets the IKJoint.springStrength and IKJoint.springDamping properties to a value of 50 each:
// frame action // IK Armature: myArmature // IK Bone: ikBoneBar import fl.ik.IKManager; import fl.ik.IKArmature; import fl.ik.IKBone; import fl.ik.IKJoint; var ikNodeBar:MovieClip; var myArmature:IKArmature = IKManager.getArmatureByName("myArmature"); var myBone:IKBone = myArmature.getBoneByName("ikBoneBar"); var myJoint:IKJoint = myBone.tailJoint; myJoint.springStrength = 50; myJoint.springDamping = 50;

In the code above, a spring was assigned to an IKJoint of the IKBone object. Because the IK armature was set to Runtime, the instance of the head joint can be dragged in the published SWF file.

  1. Save and test the movie.
  2. Click and drag the objects in the SWF file. The instance of the tail joint follows with a spring-like motion (see Figure 3).
The spring-like effect motion can be seen as you drag the head joint of the two symbol instances.
Figure 3. The spring-like effect motion can be seen as you drag the head joint of the two symbol instances.

If you drag the instances too quickly, the movement may appear unnatural. After testing your animation, you may choose to make the armature more complex by setting some restrictions to the joint.

To learn more about working with Inverse Kinematics, watch the videos Using Spring properties with IK bones and Spring for bones on Adobe TV.

Where to go from here

As you can see from these examples, there are many new possibilities to explore when developing ActionScript 3 projects in Flash Professional CS5. Hopefully the scripts provided in these examples will serve as the starting point as you begin experimenting with the new events and capabilities for delivering rich content with interactivity.

Be sure to check out my other articles in this series:

  • Working with TLF Text to control the appearance of text elements
  • Leveraging code snippets and using enhanced code hinting
  • Dynamically drawing a vector instance that contains elements
  • Displaying the audio waveform captured from a microphone
  • Deploying projects on devices with touch panels
  • Catching errors globally to facilitate troubleshooting

To learn more about developing with ActionScript 3, see the following online resources:

  • ActionScript Technology Center
  • ActionScript 3.0 Reference for the Adobe Flash Platform
  • Adobe ActionScript Cookbook

Also be sure to visit the Flash Developer Center to find more articles and sample files to help you take your Flash projects to the next level.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

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 © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement