Flash
  Home arrow Flash arrow Page 6 - 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  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
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 2.0 Overview
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 20
    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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    ActionScript 2.0 Overview - Setting a Movie’s ActionScript Version and Player Version


    (Page 6 of 7 )

    Flash MX 2004 lets you export .swf files (a.k.a. movies) in a format compatible with specific versions of the Flash Player. Don’t confuse this with the version of the Flash Player the end user has installed (which is beyond your control except for checking their Player version and suggesting they upgrade when appropriate).

    To set the version of a .swf file, use the drop-down list under File -> Publish Settings -> Flash -> Version. For maximum compatibility, always set your .swf file’s Flash Player version explicitly to the lowest version required, and no higher. If the .swf file version is higher than the end user’s version of the Flash Player, it might not display correctly, and most code execution will fail.

    Setting the version of a Flash movie has the following effects:

    • The movie will be compatible with (i.e., playable in) the specified version of the Flash Player (or later versions). In earlier versions, most ActionScript code will either not execute properly or not execute at all.

    • The movie will play properly in the most recent version of the Flash Player, even if it uses features that have changed since the specified version was released. In other words, the newest Flash Player will always play older format .swf files properly. For example, ActionScript identifiers in a Flash Player 6–format .swf file playing in Flash Player 7 are not case sensitive, even though identifiers in Flash Player 7–format .swf files are case sensitive. However, there’s one exception: the security changes to the rules of cross-domain data loading in Flash Player 7 affect Flash Player 6–format .swf files in some cases. For details see http://moock.org/asdg/technotes/crossDomainPolicyFiles.

    When exporting Flash Player 6– and Flash Player 7–format movies from either Flash MX 2004 or Flash MX Professional 2004, you can tell Flash whether to compile your code as if it is ActionScript 1.0 or ActionScript 2.0. Naturally, you should make this choice at the beginning of development, as you don’t want to rewrite your code at the end. To specify which version of the ActionScript compiler to use when creating a .swf file, use the drop-down list under File -> Publish Settings -> Flash -> Action-Script Version.

    Throughout the remainder of the text, this book assumes you are using ActionScript 2.0’s compiler.

    When the ActionScript version is set to ActionScript 1.0, the following changes take effect:

    • ActionScript 2.0 syntax is not recognized and ActionScript 2.0 features, such as type checking (including post-colon syntax) and error handling, can either cause compiler errors (for Flash Player 6–format movies) or simply fail silently (for Flash Player 7–format movies).

    • Flash 4–style “slash syntax” for variables is allowed (but this coding style is deprecated and not recommended).

    • Reserved words added in ActionScript 2.0 such as class, interface, and public can be used as identifiers (but this practice makes code difficult to update and is highly discouraged).

    The following runtime features of ActionScript 2.0 will not work in .swf files exported to a Flash Player 6–format .swf file, no matter which version of the Flash Player is used:

    • Exception handling (see Chapter 10).

    • Case sensitivity. (Scripts exported in Flash Player 6–format .swf files are not case sensitive, even in Flash Player 7. But beware! ActionScript 1.0 code in a Flash Player 7–format .swf file is case sensitive when played in Flash Player 7. See Table 1-2.)

    • Type casting (see “Runtime Casting Support” in Chapter 3).

    Table 1-2 outlines case sensitivity for various possible permutations of the .swf file version and the user’s Flash Player version. Note that runtime case sensitivity is unrelated to the ActionScript compiler version chosen and is dependent only on the format of the exported .swf file and the Flash Player version. In other words, both ActionScript 1.0 and 2.0 are case sensitive when exported in Flash Player 7–format . swf files and played in Flash Player 7. In other cases, code is case insensitive subject to the exceptions cited in the footnotes to Table 1-2. Consult my book ActionScript for Flash MX: The Definitive Guide (O’Reilly) for a full discussion of case sensitivity and its implications in Flash Player 6.

    Table 1-2. Runtime case sensitivity support by language, file format, and Flash Player version

    Movie compiled as either ActionScript 1.0 or 2.0 and

    Played in Flash Player 6

    Played in Flash Player 7

    Flash Player 6–format .swffile

    Case insensitive(a)

    Case-insensitive(a)

    Flash Player 7–format .swffile

    Not supported(b)

    Case-sensitive

    Table notes:

    (a) Identifiers (i.e., variable and property names), function names, frame labels, and symbol export IDs are case insensitive in Flash Player 6–format .swf files. However, reserved words such as “if” are case sensitive, even in Flash Player 6.

    (b) Flash Player 6 cannot play Flash Player 7–format .swf files.

    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

    - 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
    - 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







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