Flash
  Home arrow Flash arrow ActionScript 2.0 Overview
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  
Dedicated Servers  
Download TestComplete 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
eWeek
 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 2.0 Overview
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2004-08-03

    Table of Contents:
  • ActionScript 2.0 Overview
  • Features Introduced by Flash Player 7
  • Flash MX 2004 Version 2 Components
  • New Component Features in v2
  • ActionScript 1.0 and 2.0 in Flash Player 6 and 7
  • Setting a Movie’s ActionScript Version and Player Version
  • Changes to ActionScript 1.0 in Flash Player 7

  • 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

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    ActionScript 2.0 Overview
    (Page 1 of 7 )

    This chapter presents some basics of ActionScript 2.0. It offers a quick summary of ActionScript 2.0’s core features and Flash Player 7’s new capabilities such as syntactic support for traditional object-oriented features and CSS-based stylesheet support. (From the book Essential ActionScript 2.0, by Colin Moock, O'Reilly Media, ISBN:0596006527.)

    moockOver the course of this book, we’ll study ActionScript 2.0 and object-oriented programming in Flash exhaustively. There’s lots to learn ahead but, before we get into too much detail, let’s start with a quick summary of ActionScript 2.0’s core features and Flash Player 7’s new capabilities. If you have an ActionScript 1.0 background, the summary will give you a general sense of what’s changed in the language. If, on the other hand, you’re completely new to Flash or to ActionScript, you may want to skip directly to Chapter 2.

    ActionScript 2.0 Features

    Introduced in Flash MX 2004 and Flash MX Professional 2004, ActionScript 2.0 is a major grammatical overhaul of ActionScript as it existed in Flash 5 and Flash MX (retroactively dubbed ActionScript 1.0). ActionScript 2.0 adds relatively little new runtime functionality to the language but radically improves object-oriented development in Flash by formalizing objected-oriented programming (OOP) syntax and methodology.

    While ActionScript 1.0 could be used in an object-oriented way, it lacked a traditional, official vocabulary for creating classes and objects. ActionScript 2.0 adds syntactic support for traditional object-oriented features. For example, ActionScript 2.0 provides a class keyword for creating classes and an extends keyword for establishing inheritance. Those keywords were absent from ActionScript 1.0 (though it was still possible to create prototypical objects that could be used as classes). The traditional OOP syntax of ActionScript 2.0 makes the language quite familiar for programmers coming from other OOP languages such as Java and C++.

    Most of the new OOP syntax in ActionScript 2.0 is based on the proposed ECMAScript 4 standard. Its specification is posted at:
    www.mozilla.org/js/language/es4.

    Here are some of the key features introduced in ActionScript 2.0. Don’t worry if these features are new to you; the remainder of the book covers them in detail:

    • The class statement, used to create formal classes. The class statement is covered in Chapter 4.

    • The extends keyword, used to establish inheritance. In ActionScript 1.0 inheritance was typically established using the prototype property but could also be established via the __proto__ property. Inheritance is covered in Chapter 6.

    • The interface statement, used to create Java-style interfaces (i.e., abstract datatypes). Classes provide implementations for interfaces using the implements keyword. ActionScript 1.0 did not support interfaces. Interfaces are covered in Chapter 8.

    • The official file extension for class files is .as. Formerly, classes could be defined in timeline code or in external .as files. ActionScript 2.0 now requires classes to be defined in external class files. Class files can be edited in Flash MX Professional 2004’s script editor or in an external text editor.

    • Formal method-definition syntax, used to create instance methods and class methods in a class body. In ActionScript 1.0, methods were added to a class via the class constructor’s prototype property. See Chapter 4.

    • Formal getter and setter method syntax, which replaces ActionScript 1.0’s Object.addProperty( ) method. See Chapter 4.

    • Formal property-definition syntax, used to create instance properties and class properties in a class body. In ActionScript 1.0, instance properties could be added in several ways—via the class constructor’s prototype property, in the constructor function, or on each object directly. Furthermore, in ActionScript 1.0, class properties were defined directly on the class constructor function. See Chapter 4.

    • The private and public keywords, used to prevent certain methods and properties from being accessed outside of a class.

    • Static typing for variables, properties, parameters, and return values, used to declare the datatype for each item. This eliminates careless errors caused by using the wrong kind of data in the wrong situation. See Chapter 3 for details on type mismatch errors.

    • Type casting, used to tell the compiler to treat an object as though it were an instance of another datatype, as is sometimes required when using static typing. See Chapter 3 for details on casting.

    • Classpaths, used to define the location of one or more central class repositories. This allows classes to be reused across projects and helps make source files easy to manage. See Chapter 9.

    • Exception handling—including the throw and try/catch/finally statements—used to generate and respond to program errors. See Chapter 10.

    • Easy linking between movie clip symbols and ActionScript 2.0 classes via the symbol Linkage properties. This makes MovieClip inheritance easier to implement than in ActionScript 1.0, which required the use of #initclip and Object. registerClass( ). See Chapter 13.

    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

    - ActionScript Syntax for Flex Applications
    - ActionScript in Flex Applications
    - A Closer Look at Apollo`s File System API
    - Using the File System API
    - ActionScript 101
    - Flash Buttons
    - Advanced Flash Animation
    - Creating Your First Animated Movie with Flas...
    - Flash: Building Blocks
    - Building Preloaders
    - Fun Things to Do with Movie Clips in Flash MX
    - Referencing Movie Clips in Flash MX
    - Organizing Movie Clips in Flash MX
    - Making Movie Clips Perform in Flash MX
    - Video and the Flash Communication Server


     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway