Home arrow Flash arrow Basic Flash ActionScript for Designers
FLASH

Basic Flash ActionScript for Designers


If you already know the basics of Flash, using tools and creating animations, you may want to add some interactivity to your work. ActionScript, an object oriented programming language built into Flash, is the key to this. Adi Reddy Mora explains the basics of ActionScript.

Author Info:
By: Adi Reddy Mora
Rating: 4 stars4 stars4 stars4 stars4 stars / 202
June 01, 2005
TABLE OF CONTENTS:
  1. · Basic Flash ActionScript for Designers
  2. · Buttons, Movie Clips, and Making them Draggable
  3. · Navigating, URLs, and Loading Images
  4. · Loading External MP3 Files

print this article
SEARCH DEVARTICLES

Basic Flash ActionScript for Designers
(Page 1 of 4 )

I'll be using Flash MX 2004, and I'll assume that you're already familiar with working on the Timeline and creating animations with keyframes. You should also know how to create buttons and movie clips, as well as being able to publish a movie. It may be helpful to review my previous article, What is ActionScript for some real basics. That said, let's look at editing movie clips.

Controlling movie clips

To control movies with ActionScript, you should name movie clip instances, which will uniquely identify them as objects. As objects, ActionScript can controlled them. When you give a movie clip instance an instance name, the instance name identifies it as an object of the MovieClip class.

You can use global ActionScript functions or the methods of the MovieClip class to perform tasks on movie clips. To use a method, you need to invoke it by using the target path of the instance name and then the method name and parameters, as shown in the following examples:

// Plays the movie clip with instance name “anim_mc”
anim_mc.play();
// Sends the playhead to frame 3 in the movie clip with instance name
// “subanim_mc” and plays it, which is inside “anim_mc”
anim_mc.subanim_mc.gotoAndPlay(3);

Note that using suffix _mc is a good practice while naming movie clip instance names.

You can use the following methods and properties to control movie clips:

// Stops the movie clip “anim_mc”
anim_mc.stop();
// Sends the playhead to frame 10 in the movie clip with instance name
// “anim_mc” and stops it
anim_mc.gotoAndStop(10);

// Sends the playhead to the next frame of the movie clip
anim_mc.nextFrame();

// Sends the playhead to the previous frame of the movie clip
anim_mc.prevFrame();

Besides the methods of the movie clip class, you can also use its properties to control behaviour and appreance.

// Sets the transparency value of a movie clip instance
anim_mc._alpha = 60;

// Sets the height of a movie clip instance, in pixels
anim_mc._height = 400;

// Sets the width of a movie clip instance, in pixels
anim_mc._width = 300;

// Sets the degree of rotation of a movie clip instance
anim_mc._rotation = 15;

// Value that determines whether a movie clip instance is
// visible or hidden (true or false)
anim_mc._visible = false;

// Sets the xcoordinate of a movie clip instance
anim_mc._x = 25;

// Sets the ycoordinate of a movie clip instance
anim_mc._y = 125;


blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials