2 D Design and Animation Introduction to Flash

  • Slides: 18
Download presentation
2 D Design and Animation Introduction to Flash Actionscript 3. 0

2 D Design and Animation Introduction to Flash Actionscript 3. 0

Action. Script It is an object oriented programming language of Adobe Flash, based on

Action. Script It is an object oriented programming language of Adobe Flash, based on ECMAScript. The latest version is Action. Script 3 which was introduced in Flash Player 9. 0.

Reasons to Code in Action. Sript 3 1. It is fast. 2. Tons of

Reasons to Code in Action. Sript 3 1. It is fast. 2. Tons of new API’s. 3. Display list is very organized. 4. Double click is enabled. 5. E 4 X – ECMAScript for XML 6. Timer class is a better set. Interval 7. Audio API 8. Inverse Kinematics 9. Custom effects using Pixel Blender 10. 3 D is build it 11. Action. Script 3 programmers are indemand

Basics Execution Order All statements are read and executed from top to bottom and

Basics Execution Order All statements are read and executed from top to bottom and each line from left to right. Functions are exception. Even if it is placed on top, they are read but not executed until you call them.

Basics Semicolon It is used to terminate a statement.

Basics Semicolon It is used to terminate a statement.

Basics trace() It is a global function and you can use it anywhere in

Basics trace() It is a global function and you can use it anywhere in your code. It is primarily used for simple debugging. Any value traced will appear in the output panel. trace(“Hello world”);

Basics Errors When code contains error, the compiler throws error objects which reveal what

Basics Errors When code contains error, the compiler throws error objects which reveal what type of errors were made, where they happened and descriptions.

Basics Case Sensitivity Everything in Action. Script is case sensitive.

Basics Case Sensitivity Everything in Action. Script is case sensitive.

Basics Dot Operator (. ) It is used to acces variables and methods, gets

Basics Dot Operator (. ) It is used to acces variables and methods, gets and sets object properties, and delimits imported packages or classes. Import fl. transitions. Tween; mc. Container. mc. Background. goto. Play(5); mc. Container. alpha = 0. 5;

Basics Actions Panel The Actions panel consists of three panes: a. Actions Toolbox –

Basics Actions Panel The Actions panel consists of three panes: a. Actions Toolbox – groups elements by category b. Script Navigator – lets you move quickly between scripts c. Script Pane – where you type your Action. Script code Best Practices: a. Always use the shorcut key to open the Actions panel (F 9). b. Make sure you get a big view of the Actions panel c. Never use the Script Assist feature, it will not make you a better programmer

Basics Actions Panel

Basics Actions Panel

Understanding Scripting Terminology Variable – represents a specific piece of data that may or

Understanding Scripting Terminology Variable – represents a specific piece of data that may or may not be constant. name = “Juan” Data Type - you also assign data type which determines what kind of data the variable represent. varname: String = “Juan”;

Most Common Data Types Description String A single or sequence of characters Boolean True

Most Common Data Types Description String A single or sequence of characters Boolean True or false int Positive and negative whole numbers uint Positive whole numbers Number Positive and negative whole and float numbera

Most Common Data Types Description Object Serves as the base class for all class

Most Common Data Types Description Object Serves as the base class for all class definitions in Action. Script Array Contains a list of data Movie. Clip Animated movie clip display object Bitmap Non-animated bitmap display Shape Non-animated vector shape object Byte. Array Contains an array of binary byte data Text. Field Dynamic, optionally interactive text field object

Basics Instance Names No instance name, no Action. Script. Instance name are variables pointing

Basics Instance Names No instance name, no Action. Script. Instance name are variables pointing to objects so Action. Script can communicate to them.

Basics Properties attached to an object, properties of an object can be accessed using

Basics Properties attached to an object, properties of an object can be accessed using the dot operator. object. property; Properties are characteristics of an object.

Basics Methods are instructions or actions an object can do. Different data types offer

Basics Methods are instructions or actions an object can do. Different data types offer different sets of method. Method for Movie. Clip vs Method of Textfields. Movie. Clip can play, stop, goto. And. Play, start. Drag etc. Example object. method();

Basics Events Methods are instructions or actions an object can do. Different data types

Basics Events Methods are instructions or actions an object can do. Different data types offer different sets of method. Method for Movie. Clip vs Method of Textfields. Movie. Clip can play, stop, goto. And. Play, start. Drag etc. Example object. method();