Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.

Slides:



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

Lecture 2 Introduction to C Programming
Introduction to C Programming
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection)
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Introduction to a Programming Environment
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
A First Program Using C#
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 13: An Introduction to C++
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
More on Input Output Input Stream : A sequence of characters from an input device (like the keyboard) to the computer (the program running). Output Stream.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Flow of Control Part 1: Selection
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Chapter 3 - Structured Program Development Outline 3.1Introduction 3.2Algorithms 3.3Pseudocode 3.4Control Structures 3.5The If Selection Structure 3.6The.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Control Statements I.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
Quiz 3 is due Friday September 18 th Lab 6 is going to be lab practical hursSept_10/exampleLabFinal/
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
CPS120: Introduction to Computer Science Variables and Constants.
CMPD 434 MULTIMEDIA AUTHORING Chapter 06 Multimedia Authoring Process IV.
1 Overview of Programming Principles of Computers.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
Chapter 7 Conditional Statements. 7.1 Conditional Expressions Conditions - compare the values of variables, constants and literals using one or more relational.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Programming Language C++ Lecture 3. Control Structures  C++ provides control structures that serve to specify what has to be done to perform our program.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
 2003 Prentice Hall, Inc. All rights reserved. 1 Basic C++ Programming.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Intro to Programming STARS College of Communication and Information Florida State University Written by: Hannah Brock Alissa Ovalle Nicolaus Lopez Martin.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Programming Language Basics. What is a Programming Language? “A computer, human-created language used to write instructions for a computer.” “An artificial.
ActionScript Programming Help
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Chapter 10 Programming Fundamentals with JavaScript
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Learning to Program D is for Digital.
Chapter 2.1 Control Structures (Selection)
Introduction to the C Language
Chapter 10 Programming Fundamentals with JavaScript
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
3 Control Statements:.
JavaScript What is JavaScript? What can JavaScript do?
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
Programming Language Basics
JavaScript What is JavaScript? What can JavaScript do?
ICT Gaming Lesson 2.
The structure of programming
An Overview of C.
Presentation transcript:

Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor Office: 7800 York Road, Room 422 | Phone: (410) website: 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 statements and looping Both if statements and Loops can be used to make a program execute nonsequentially. 22

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

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

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) } 25

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"; } 26

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. 27

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.

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"; } 29 Suppose score = 85. First check: (score > 90). (85 > 90) is false!

Logical Operators &&AND ||OR !NOT 30

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

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

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

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 = 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; } 35 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; } 36 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; } 37 Which statement will be executed in these examples when age = 46 and weight = 157?

Examples Sum = addTogether(2,5); By examining the statement above you should be able to infer that addTogether() Returns a value, and, Takes arguments 38

functions and procedures (see text pages ) function: block of code that forms a discrete unit with a name; Procedure: very similar to functions, excerpt that they do not return values. Otherwise, both functions and procedures can take paremeters. 39