Flash
  Home arrow Flash arrow Page 3 - ActionScript 101
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

ActionScript 101
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2008-01-16

    Table of Contents:
  • ActionScript 101
  • Working with Properties
  • Width/Height
  • Visibility
  • Alpha

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    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)



    More Flash Articles
    More By James Payne


       · Hey, didn't see you there. Thanks for dropping by to read my article on...
       · Good article mate.Don't try to be funny ;)
       · Thank you! This was very helpful and easy to follow. Great examples.
     

    FLASH ARTICLES

    - 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
    - Organizing Frames and Layers for Flash Anima...
    - Organizing Frames and Layers
    - Using XML and ActionScript with Flex Applica...
    - Interfaces and Events with ActionScript and ...
    - Manipulating Data with ActionScript in Flex ...
    - ActionScript Syntax for Flex Applications







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT