Home arrow Flash arrow Page 5 - Flash Hack A Custom Color Transform Class
FLASH

Flash Hack A Custom Color Transform Class


See how to implement a custom color transform class in ActionScript 2.0 using object-oriented programming (OOP) instead of using a procedural timeline-based code. (From the book, Flash Hacks, by Sham Bhangal, O'Reilly Media, 2004, ISBN: 0596006454.)

Author Info:
By: O'Reilly Media
Rating: 4 stars4 stars4 stars4 stars4 stars / 14
October 12, 2004
TABLE OF CONTENTS:
  1. · Flash Hack A Custom Color Transform Class
  2. · Code Listing: A Custom Transform Class
  3. · A Closer Look at the Code
  4. · Constructor Function Transform()
  5. · Enhancing the Custom Class

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Flash Hack A Custom Color Transform Class - Enhancing the Custom Class
(Page 5 of 5 )

Consider enhancing this custom class to implement additional features, such as:

  • Making theRATE value user-definable.

     

  • Adding controls to repeat the transitions. This would allow blinking or other repetitive effects.
  • Adding more complex methods that involve more than one movie clip, allowing cross-fades between two movie clips. This would introduce some powerful effects useful with video.

The use of ActionScript 2.0 allows you to create new features that can be accessed via methods of new classes. This is the preferred way of building up libraries of commonly used features not native to ActionScript.

For many designers, the ActionScript 2.0 OOP coding style may initially seem a little long-winded because more lines of code seem to be concerned with building up the code structure than actually solving the problem at hand, especially for modest classes. This extra structure is, however, a real advantage in the long term. It gives you a structured way to make your code flexible enough to reuse in several different applications and also makes your code easier to transfer to other users (which is particularly useful in a design environment consisting of an ActionScript coder and several non-scripting designers).

Finally, although OOP code may appear longer than other styles of code, the compiled bytecode can be more efficient [Hack #100]. Flash Player 7 is optimized for OOP code. Benchmarking of well-written OOP code against procedural ActionScript shows that OOP can increase performance through the greater use of local variables and passing of data as arguments, both of which tend to create more optimized bytecode. 

 

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.

 
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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