Flash
  Home arrow Flash arrow Page 3 - Flash Hack A Custom Color Transform Class
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

Flash Hack A Custom Color Transform Class
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 14
    2004-10-12

    Table of Contents:
  • Flash Hack A Custom Color Transform Class
  • Code Listing: A Custom Transform Class
  • A Closer Look at the Code
  • Constructor Function Transform()
  • Enhancing the Custom Class

  • 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


    Flash Hack A Custom Color Transform Class - A Closer Look at the Code


    (Page 3 of 5 )

    There’s a lot of code there, so let’s take a closer look. But first, you may wonder why we didn’t add the methods of our custom Transform class to the MovieClip or Color class. In ActionScript 1.0, doing so would have been common and even recommended. But in ActionScript 2.0, the preferred approach in most cases is to create a custom class rather than enhancing existing classes.

    If you are not familiar with ActionScript 2.0 syntax, notice theclasskeyword used to define the class. Several variables are declared for the class and its instances, outside of any of the methods within the class. The static properties or class properties, defined with the keywordstatic, are defined once for the class (here, we’ve initialized various common transformation types and the refresh rate at which we want our transitions to work,RATE, is set to 50 milliseconds).

    The remaining variables declared without the keywordstaticare instance properties (i.e., each instance of the class maintains its own value for the property). Theprivatekeyword identifies class properties and instance properties that are not to be accessed from outside the class. Variables declared within a method, such asgetTrans, which is declared within applyTransform( ), are local variables. The datatypes for all variables, properties, parameters, and method return types are specified using a colon followed by the datatype, such as:Number.

    It is good practice to use a standardized variable-naming convention in all code, but because of the precise structuring and datatyping of OOP code, it is perhaps more important here than in other coding styles. Constant variable names (i.e., our static datatypes) have been defined in UPPERCASE, and non-constants have been defined in so-called “camelCase” (a mixture of upper- and lowercase).

     

    Buy the book!If you've enjoyed what you've seen here, or to get more information, click on the "Buy the book!" graphic. Pick up a copy today!

    Visit the O'Reilly Network http://www.oreillynet.com for more online content.

    More Flash Articles
    More By O'Reilly Media


     

    FLASH ARTICLES

    - 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
    - ActionScript in Flex Applications







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