Chapter 9 Interactive Multimedia Authoring with Flash Introduction to Programming 1.

Slides:



Advertisements
Similar presentations
Objectives Knows and understand about another kind of flowchart’s symbols (looping) Have ability to create structured solution on simple problem(s) Have.
Advertisements

Using Matrices in Real Life
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
Exit a Customer Chapter 8. Exit a Customer 8-2 Objectives Perform exit summary process consisting of the following steps: Review service records Close.
Mean, Median, Mode & Range
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Year 6 mental test 10 second questions
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
The 5S numbers game..
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
1.
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Chapter 11: Models of Computation
Turing Machines.
PP Test Review Sections 6-1 to 6-6
Chapter 17 Linked Lists.
Modern Programming Languages, 2nd ed.
Understanding class definitions Looking inside classes 5.0.
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Name Convolutional codes Tomashevich Victor. Name- 2 - Introduction Convolutional codes map information to code bits sequentially by convolving a sequence.
1 public class Newton { public static double sqrt(double c) { double epsilon = 1E-15; if (c < 0) return Double.NaN; double t = c; while (Math.abs(t - c/t)
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
Adding Up In Chunks.
1 of 31 Images from Africa. 2 of 31 My little Haitian friend Antoine (1985)
Note to the teacher: Was 28. A. to B. you C. said D. on Note to the teacher: Make this slide correct answer be C and sound to be “said”. to said you on.
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Decisions If statements in C.
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
Subtraction: Adding UP
Chapter Three Arithmetic Expressions and Assignment Statements
Analyzing Genes and Genomes
Types of selection structures
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Pointers and Arrays Chapter 12
Essential Cell Biology
1 Chapter 3:Operators and Expressions| SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2006 | Last Updated: July 2006 Slide 1 Operators and Expressions.
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
Languages for IT & CS Pseudo-code What HTML isn’t Early history Compiling & interpreting Classifying languages The process of programming.
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
Chapter 3 Flow of Control Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
Chapter 10 Programming Fundamentals with JavaScript
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Presentation transcript:

Chapter 9 Interactive Multimedia Authoring with Flash Introduction to Programming 1

2 Some Common Terms Writing code – means entering the code – is part of the process of creating the computer program Running code, executing code – refers to the process by which the computer carries out the instructions in a computer program Compiling – refers to the process of assembling code into a format suitable for the computer to execute the instructions

3 More Common Terms Computer Programming Languages – are for writing instructions that can be followed by a computer IDE – stands for: Integrated Development Environment – refers to: the software in which you are developing an application for example, Adobe Flash, Microsoft Visual Studio

4 Programming Languages low level high levelProgramming languages that look more like human language. Easy for human to read and write, but require more "translation" behind the scenes to be understandable to the computer. e.g. C++, Java, FORTRAN lowest level: Machine language: a programming language that communicates with a computer through 0's and 1's Assembly language Multimedia authoring scripting languages, such as Flash Actionscript and Director Lingo are often the highest level.

5 Scripting Languages Examples: Flash ActionScript, Director Lingo, Javascript Very-high-level programming languages Advantage: easier for non-programmer to learn because the syntax and keywords are close to human languages Disadvantages: – Not as full-fledged as programming languages such as C++, Java, and FORTRAN – Don't have the features to let the programmer to control low level details, such as memory allocation

6 Flash Actionscript a scripting language getting full-fledged based on the same standard as Javascript Actionscript 1.0, 2.0, 3.0 Easiest to learn. Has stricter rules than 1.0. The newest version of ActionScript. More difficult than the other two versions. This is what we will be using in this course.

Syntax prescribes the ways in which statements must be written in order for them to be understood by the computer like the rules of grammar and punctuation in human languages, but these rules must be followed precisely in computer programming for examples, for ActionScript: – case sensitive – each statement ends with a semi-colon(;) – the naming of variables and functions has to start with a letter, _ or $ 7

Variables Purpose: to store values that can be updated and retrieved at runtime Data is stored in memory as bits. Variable lets you refer, by name, to the data's memory location stored. 8

Variable Naming can contain a number, a letter, underscore (_), or dollar sign ($) cannot begin with a number in this course, variables always begin with a letter cannot be a keyword look up Actionscript 3.0 Language Reference in Help for all the keywords If the word turns blue in your code window, it means it is a keyword. 9

Case Sensitivity of Variable Names score and Score are different number and nuMBer are different 10

Assigning a Value to a Variable Means giving a value to a variable The statement that assigns a value to a variable is called an assignment statement. 11

Assigning a Value to a Variable General Syntax: variableName = value or expression; Examples: score = 10; letterGrade = "A"; sum = a + b; 12

Declaring a Variable Before you use a variable or assigning a value to a variable, you need to declare the variable. General Syntax: Two ways to declare a variable: – Declare without assigning a value: var variableName:dataType; – Declare and assign a value: var variableName:dataType = value or expression; 13

Declaring a Variable Examples: var score:int; var score:int = 0; 14

Data Types Basic Data Types in Actionscript int uint Number String Boolean MovieClip Object Null void 15

How a Program Runs A program is written as a sequence of statements as instructions. The program executes the instructions sequentially--one instruction after the other, in the order in which they appear in the code. Use control structures to make nonsequential execution of the instructions. 16

Types of Control Structures Loop – A set of statements is executed repeatedly until a certain condition is reached – Will be covered in Chapter 11 Conditional – A set of statements is executed only if some conditions are met – if statements and switch statements 17

if Statements if if...else if...else if Nested if statements 18

if General Syntax: if (logical expression(s)) { statement(s) } 19 The statements grouped within the curly braces are called the block statements.

if Example: if (score > 600) { grade = "pass"; } 20

if If there is only one statement to be executed, the curly braces are optional. Examples: if (score > 60) grade = "pass"; The statement may be on a single line: if (score > 60) grade = "pass"; 21

if...else General Syntax: if (logical expression(s)) { statement(s) } else { statement(s) } 22

if...else Example: if (score > 60) { grade = "pass"; } else { grade = "fail"; } 23

if...else if General Syntax: if (logical expression(s)) { statement(s) } else if (logical expression(s)) { statement(s) }... else if (logical expression(s)) { statement(s) } else { statement(s) } 24

if...else if Example: if (score > 90) { grade = "A"; } else if (score > 80) { grade = "B"; } else if (score > 70) { grade = "C"; } else if (score > 60) { grade = "D"; } else { grade = "F"; } 25

if...else if The conditions are checked one at a time sequentially. Once a condition is found to be true, the statement(s) for that condition will be executed and the rest of the conditions in the if... else if statements group will not be checked. 26

if...else if Example: if (score > 90) { grade = "A"; } else if (score > 80) { grade = "B"; } else if (score > 70) { grade = "C"; } else if (score > 60) { grade = "D"; } else { grade = "F"; } 27 Suppose score = 85.

if...else if Example: if (score > 90) { grade = "A"; } else if (score > 80) { grade = "B"; } else if (score > 70) { grade = "C"; } else if (score > 60) { grade = "D"; } else { grade = "F"; } 28 Suppose score = 85. First check: (score > 90). (85 > 90) is false!

Logical Operators &&AND ||OR !NOT 29

Logical AND: && logicalExpression1 && logicalExpression2 true : only when both logicalExpression1 and logicalExpression2 are true false : when either logicalExpression1 or logicalExpression2 is false 30

Logical OR: || logicalExpression1 || logicalExpression2 true : when either logicalExpression1 or logicalExpression2 is true false : only when both logicalExpression1 and logicalExpression2 is false 31

Logical NOT: ! !logicalExpression1 true : when logicalExpression1 is false false : when logicalExpression1 is true 32

Examples Example 1 if (age < 40 && weight < 150) { group = 2; } else { group = 3; } Example 2 if (age < 40 || weight < 150) { group = 2; } else { group = 3; } 33 Which statement will be executed in these examples when age = 38 and weight = 145?

Examples Example 1 if (age < 40 && weight < 150) { group = 2; } else { group = 3; } Example 2 if (age < 40 || weight < 150) { group = 2; } else { group = 3; } 34 Which statement will be executed in these examples when age = 38 and weight = 157?

Examples Example 1 if (age < 40 && weight < 150) { group = 2; } else { group = 3; } Example 2 if (age < 40 || weight < 150) { group = 2; } else { group = 3; } 35 Which statement will be executed in these examples when age = 46 and weight = 145?

Examples Example 1 if (age < 40 && weight < 150) { group = 2; } else { group = 3; } Example 2 if (age < 40 || weight < 150) { group = 2; } else { group = 3; } 36 Which statement will be executed in these examples when age = 46 and weight = 157?