datatypes, variables, constants flash class. what does actionscript do? automates examples: –...

15
Datatypes, Variables, Constants Flash Class

Upload: lewis-barnett

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Datatypes, Variables, Constants

Flash Class

Page 2: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

What Does ActionScript Do?

• Automates• Examples:– Tells animation what to do button is clicked– Turn off sound

• Designer “scripts” different parts of the animation

• Examples: tell the animation to load a Web page upon clicking a link

Page 3: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off
Page 4: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Building Blocks

Flash• Flash animations made up

of:– Drawings– Text– Frames (hold drawings, text)– Timelines (hold frames)

ActionScript 3• ActionScript made up of:

– Numbers– Strings

• Building blocks for more complicated data containers

Page 5: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

ActionScript Building Blocks

• Numbers

• Strings

• Arrays

Page 6: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Numbers

• Numbers are an important data-building block• So important there are three types:– number– int (integer)– uint (unsigned integer)

Page 7: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Review Terms

• Integer: in computer science, an integer is used to refer to a data type which represents some finite subset of the mathematical integers. These are also known as integral data types.

• In programming languages a data type is an attribute of a datum which tells the computer (and the programmer) something about the kind of datum it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it. Common data types may include: integers, floating-point numbers (decimals), and alphanumeric strings.

Page 8: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Numbers: Number

• In ActionScript, a number can be any type of number, including fractions

• Example: 2.5

Page 9: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

int

• The int datatype can represent any number from -2,147,483,648

to

2,147,483,648

It cannot represent fractions. Use Number.

Page 10: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

uint

• Unsigned integer

• Can represent numbers from 0 to4,294,967,295

• Use if you need a negative number

• Useful when identifying colors, especially since colors are always positive whole numbers

Page 11: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Using Operators

Examples of Operators• +• -• *• /• >• <• >=

Examples of Operators

• <=• ==• !=• =• See Operators at Adobe.• For more.

Page 12: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Strings

• Strings are sequential lists of letters, numbers, and symbols.

• Identify strings by placing them inside single or double quotes.

• Example: myCar + “Stutz Bearcat”

Page 13: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Strings and Operators

• Can’t do math with strings

• Concatenation (looks like string addition)

• Example: carModel = “Stutz” + “ “ + “Bearcat”;

Page 14: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Differences in Equality Operator (==) and Assignment Operator (=)

Equality Operators• Used to make a statement:

• The data on the right side of the equality operator is equal to the data on the left

• Statement may be true or false

Assignment Operator• Changes the value of the

variable on the left

Page 15: Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off

Boolean

• Definition: Boolean has one of two values, true or false

• Used when programs test conditions, then report back