150 likes | 286 Views
Datatypes , Variables, Constants. Flash Class. 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.
E N D
Datatypes, Variables, Constants Flash Class
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
Building Blocks Flash ActionScript 3 ActionScript made up of: Numbers Strings Building blocks for more complicated data containers • Flash animations made up of: • Drawings • Text • Frames (hold drawings, text) • Timelines (hold frames)
ActionScript Building Blocks • Numbers • Strings • Arrays
Numbers • Numbers are an important data-building block • So important there are three types: • number • int (integer) • uint (unsigned integer)
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.
Numbers: Number • In ActionScript, a number can be any type of number, including fractions • Example: 2.5
int • The intdatatype can represent any number from -2,147,483,648 to 2,147,483,648 It cannot represent fractions. Use Number.
uint • Unsigned integer • Can represent numbers from 0 to 4,294,967,295 • Use if you need a negative number • Useful when identifying colors, especially since colors are always positive whole numbers
Using Operators Examples of Operators Examples of Operators <= == != = See Operators at Adobe. For more. • + • - • * • / • > • < • >=
Strings • Strings are sequential lists of letters, numbers, and symbols. • Identify strings by placing them inside single or double quotes. • Example: myCar + “Stutz Bearcat”
Strings and Operators • Can’t do math with strings • Concatenation (looks like string addition) • Example: carModel = “Stutz” + “ “ + “Bearcat”;
Differences in Equality Operator (==) and Assignment Operator (=) Equality Operators Assignment Operator Changes the value of the variable on the left • 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
Boolean • Definition: Boolean has one of two values, true or false • Used when programs test conditions, then report back