Home arrow Flash arrow Page 2 - ActionScript 101
FLASH

ActionScript 101


While there were some ActionScripts in the earlier versions of Flash, the language really didn't get its start until the year 2000, when it was officially named. Heavily influenced by JavaScript, the language went from a few simple commands to an evolving powerhouse of functions. This article will explain some of those functions.

Author Info:
By: James Payne
Rating: 4 stars4 stars4 stars4 stars4 stars / 10
January 16, 2008
TABLE OF CONTENTS:
  1. · ActionScript 101
  2. · Working with Properties
  3. · Width/Height
  4. · Visibility
  5. · Alpha

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
ActionScript 101 - Working with Properties
(Page 2 of 5 )

Properties define certain characteristics of Symbols in Flash. Using ActionScript, we can change these properties to create some pretty cool effects. In this tutorial, we will learn to do just that.

Below is a table listing the Symbol Properties.

 

Property

What it Does

X. Y Coordinates

The coordinates of an object indicate where it is located on the stage

Width/Height Measures

The width and height of an object

Xscale, Yscale

Adjusts the object size

Visible

Makes an object visible or invisible

Rotation

Sets the object's degree of rotation; i.e. by how much to rotate a ball

Quality

Used to change the quality of a scene (and therefore every object in the scene)

Name

Used to read or change the name of an object

Alpha

Affects the transparency of an object

Xmouse, Ymouse

Gives you the coordinates at which a user clicks their mouse

CurrentFrame

Tells you which layer in a movie is presently playing

TotalFrame

Tells you the total amount of frames in a movie

URL

Returns the URL of the SWF file the movie was downloaded from

Target

Returns the path of a movie clip

DropTarget

*Discussed in-depth later

FocusRect

Boolean that lets you know if a keyboard has focus

FramesLoaded

Tells you the total frames of a movie that were downloaded

SoundBufTime

*Discussed in-depth later.

X, Y Coordinates

As described above, X and Y represent the coordinates of an object. The best way to explain this is to actually work with the properties. Open up Flash and draw a shape on your stage. Change the shape to a symbol (press the F8 key) and name the image something like Mov_Rect or something along those lines. Set its Behavior as a Movie Clip and press the OK button.

Next, select the shape you created and look at your Properties Pane (this should be located at the bottom of your window, below the stage). Where it says Instance Name, erase what is there and type in Rectangle.

Finally, right-click the frame in the Timeline and choose Actions from the pop-up menu. Being sure that you have turned off the Script Assistant, type in the following code:


onClipEvent (mouseDown) {

setProperty("", _x, "250");

setProperty("", _y, "250");

}

Now test the movie. If you click on the Rectangle object (or whatever object you created), its position on the stage will relocate. If you go back and change the coordinates to say, 300, and test the movie again, you the object will move to a new location once you click it.


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

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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