Home arrow Flash arrow Page 3 - 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 - Width/Height
(Page 3 of 5 )

The Width and Height properties define how tall and wide the object is. You can program them in a fashion similar to that of the X,Y coordinates. Here we will create a program that resizes the Rectangle object once the user clicks on it.


onClipEvent (mouseDown) {

setProperty("", _height, "300");

setProperty("", _width, "300");

}

Xscale/YScale

Another way to adjust the size of an object is with the Xscale and Yscale properties. These allow you to, using scale, stretch the size of an image. If I set both values at 50, the object will become half of its size. If I set them at 200, the object becomes twice its size.

Here is some code that demonstrates how to change the properties:


onClipEvent (mouseDown) {

setProperty("", _xscale, "50");

setProperty("", _y, "300");

}

You can fool around with different numbers to generate different effects. For instance, if you set either property to 0, then your object disappears. If you set it to a negative number like -100, it enlarges the picture in a weird way and relocates it.

Here are some pretty pictures to demonstrate how this works.

Before the user clicks on the image:




After the user clicks on the image (value set to 200)




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 8 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials