What is Software? | What is Education? | What is Technology? | What is Research? | What is Wi-Fi? | What is Communication? | What is Customer Service?

Free SEO Tutorials & Help

Tutorials:   Adobe Flash   Adobe Photoshop   CorelDRAW   SEO  

Site Map

Website Development | Cable & Broadband Magazine | Solutions for Higher Education | Auction Anything Online

 

Adobe Flash Help & Tutorials

 Back to Topics

 

How to Write Scripts for Earlier Versions of Flash Player in Flash

Writing Scripts for Earlier Versions of Flash Player

About targeting earlier versions of Flash Player

Using Flash 8 to create content for Flash Player 4

Using Flash 8 to open Flash 4 files

Using slash syntax

 

Writing Scripts for Earlier Versions of Flash Player

TOP

ActionScript has changed considerably with each release of the Macromedia Flash authoring tools and Flash Player. When you create content for Macromedia Flash Player 8, you can use the full power of ActionScript. You can still use Flash 8 to create content for earlier versions of Flash Player, but you can't use every ActionScript element.

This chapter provides guidelines to help you write scripts that are syntactically correct for the player version you are targeting.

 

About targeting earlier versions of Flash Player

TOP

When you write scripts, use the Availability information for each element in the ActionScript 2.0 Language Reference to determine if an element you want to use is supported by the Flash Player version you are targeting. You can also determine which elements you can use by showing the Actions toolbox; elements that are not supported for your target version appear in yellow.

If you create content for Flash Player 6, 7 or 8, you should use ActionScript 2.0, which provides several important features that aren't available in ActionScript 1.0, such as improved compiler errors and more robust object-oriented programming capabilities.

To specify the player and ActionScript version you want to use when publishing a document, select File > Publish Settings and make your selections on the Flash tab. If you need to target Flash Player 4, see the next section.

 

Using Flash 8 to create content for Flash Player 4

TOP

To use Flash 8 to create content for Flash Player 4, specify Flash Player 4 on the Flash tab of the Publish Settings dialog box (File > Publish Settings).

Flash Player 4 ActionScript has only one basic primitive data type, which is used for numeric and string manipulation. When you write an application for Flash Player 4, you must use the deprecated string operators located in the Deprecated > Operators category in the ActionScript toolbox.

You can use the following Flash 8 features when you publish for Flash Player 4:

  • The array and object access operator ([])

  • The dot operator (.)

  • Logical operators, assignment operators, and pre- and post-increment/decrement operators

  • The modulo operator (%), and all methods and properties of the Math class

The following language elements are not supported natively by Flash Player 4. Flash 8 exports them as series approximations, which creates results that are less numerically accurate. In addition, because of the inclusion of series approximations in the SWF file, these language elements need more space in Flash Player 4 SWF files than they do in Flash Player 5 or later SWF files.

  • The for, while, do..while, break, and continue actions

  • The print() and printAsBitmap() actions

  • The switch action
     

Using Flash 8 to open Flash 4 files

TOP

Flash 4 ActionScript had only one true data type: string. It used different types of operators in expressions to indicate whether the value should be treated as a string or as a number. In subsequent releases of Flash, you can use one set of operators on all data types.

When you use Flash 5 or later to open a file that was created in Flash 4, Flash automatically converts ActionScript expressions to make them compatible with the new syntax. Flash makes the following data type and operator conversions:

  • The = operator in Flash 4 was used for numeric equality. In Flash 5 and later, == is the equality operator and = is the assignment operator. Any = operators in Flash 4 files are automatically converted to ==.

  • Flash automatically performs type conversions to ensure that operators behave as expected. Because of the introduction of multiple data types, the following operators have new meanings:

    +, ==, !=, <>, <, >, >=, <=

    In Flash 4 ActionScript, these operators were always numeric operators. In Flash 5 and later, they behave differently, depending on the data types of the operands. To prevent semantic differences in imported files, the Number() function is inserted around all operands to these operators. (Constant numbers are already obvious numbers, so they are not enclosed in Number().) For more information on these operators, see the operator table in About operator precedence and associativity and Deprecated Flash 4 operators.

  • In Flash 4, the escape sequence \n generated a carriage return character (ASCII 13). In Flash 5 and later, to comply with the ECMA-262 standard, \n generates a line-feed character (ASCII 10). An \n sequence in Flash 4 FLA files is automatically converted to \r.

  • The & operator in Flash 4 was used for string addition. In Flash 5 and later, & is the bitwise AND operator. The string addition operator is now called add. Any & operators in Flash 4 files are automatically converted to add operators.

  • Many functions in Flash 4 did not require closing parentheses; for example, Get Timer, Set Variable, Stop, and Play. To create consistent syntax, the getTimer function and all actions now require parentheses [()]. These parentheses are automatically added during the conversion.

  • In Flash 5 and later, when the getProperty function is executed on a movie clip that doesn't exist, it returns the value undefined, not 0. The statement undefined == 0 is false in ActionScript after Flash 4 (in Flash 4, undefined == 1). In Flash 5 and later, solve this problem when converting Flash 4 files by introducing Number() functions in equality comparisons. In the following example, Number() forces undefined to be converted to 0 so the comparison will succeed:

getProperty("clip", _width) == 0

Number(getProperty("clip", _width)) == Number(0)

NOTE : If you used any Flash 5 or later keywords as variable names in your Flash 4 ActionScript, the syntax returns an error when you compile it in Flash 8. To solve this problem, rename your variables in all locations. For information, see About reserved words and About naming variables.

 

Using slash syntax

TOP

Slash syntax (/) was used in Flash 3 and 4 to indicate the target path of a movie clip or variable. In slash syntax, slashes are used instead of dots and variables are preceded with a colon, as shown in the following example:

myMovieClip/childMovieClip:myVariable

To write the same target path in dot syntax, which is supported by Flash Player 5 and later versions, use the following syntax:

myMovieClip.childMovieClip.myVariable

Slash syntax was most commonly used with the tellTarget action, but its use is also no longer recommended. The with action is now preferred because it is more compatible with dot syntax.
 

Copyright ADOBE - All Rights Reserved Worldwide

 

 

More Topics:

Working with Flash Documents

How to work in Flash WorkSpace

Working with Projects in Flash

Process to Build your First Application in Flash

Using Symbols, Instances and Library Assets in Flash

How to Build Video Player in Flash

How to Work with Color, Strokes and Fills in Flash

How to Create Document in Flash

What is Vector and Bitmap Graphics in Flash

How to Create a Banner in Flash, Part 1

How to Work with Text in Flash

How to Create a Banner in Flash, Part 2

How to Use Imported Artwork in Flash

How to Create a Banner in Flash, Part 3

How to Work with Graphic Objects in Flash

How to Work with Layers in Flash

How to Use Filters and Blends

Working with Graphics in Flash

What is Accessibility Features in Flash

How to Create Motion (Shape Tween & Motion Tween) in Flash

How to Create an Application in Flash

What is Masking in Flash

How to Work with Video in Flash

How to Use Layout Tools in Flash

What are Behaviors in Flash

How to Work with Sound in Flash

How to Create Symbols and Instances in Flash

What is ActionScript in Flash

How to Write ActionScript With Script Assist in Flash

How to Add Button Animation and Navigation in Flash

What is Data Integration in Flash

How to Work with Screens

How to Create a Presentation with Screens

What is Extending Flash

How to Create Multilanguage Text in Flash

How to Create Graphics: Draw in Flash

What is Flash Lite

Ways of Data Integration

How to Create Graphics: Create a Timeline Animation in Flash

Getting Started with Flash Lite in Flash

How to Publish Flash Documents

How to Create Graphics: Making Animations with Easing

Learning Flash Lite 1.X ActionScript in Flash

How to Export Flash Content and Images from Flash

How to Create Graphics: Applying Gradients in Flash

Process of Writing and Editing ActionScript 2.0 in Flash

How to Create Accessible Content in Flash

How to Create Graphics: Apply Graphic Filters and Blends

What is Data and Data Types in Flash

Process of Printing from SWF Files in Flash

Using ActionScript: How to Use Script Assist mode in Flash

Learn Syntax and Language Fundamentals in Flash

How to Create E-learning Content in Flash

Using ActionScript: How to Write Scripts in Flash

Working with Functions and Methods in Flash

Process of Using Templates in Flash

Using ActionScript: Process of Adding Interactivity in Flash

What are Classes in Flash

Control Tag Summary of XML to UI in Flash

Using ActionScript: How to Create a Form with Conditional Logic and Send Data in Flash

What is Inheritance in Flash

What is Data Integration: Overview

Using ActionScript: How to Work with Objects and Classes in Flash

Overview on Interfaces in Flash

What is Data Integration: Using XML for a Timesheet

How to Work with Text and Strings in Flash

How to use Handling Events in Flash

What is Data Integration: Using XUpdate to Update the Timesheet

Learning Animation, Filters and Drawings in Flash

How to Work with Movie Clips in Flash

How to Create Interaction with ActionScript in Flash

How to Work with Images, Sound, and Video in Flash

How to Work with External Data in Flash

What is Security in Flash

How to Debug Applications in Flash

List of Error Messages in Flash

Using Object-Oriented Programming with ActionScript 1.0 in Flash

How to Write Scripts for Earlier Versions of Flash Player in Flash

List of all Keyboard Keys and Key Code Values for using in Flash

Terminology

Introduction to Components in Flash

What are Components in Flash

How to Create an Application with Components

How to Work with Components in Flash

How to Handle Component Events in Flash

How to Customize Components in Flash

How to Create Components in Flash

What is Collection Properties in Flash