Roy McElmurry. ActionScript : an object-oriented programming language similar to JavaScript MXML : A flavor of XML that helps simplify user interface.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Pages and boxes Building quick user interfaces. learning objectives o Build a quick UI with pages and boxes o understand how pages and boxes work o click.
Java Script Session1 INTRODUCTION.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
1 Javascrbipt Intro Javascript (or js) is a programming language. Interpreted, not compiled. Not the same as java, but, similar. Use tags to use. Object-oriented.
COMP 14 Introduction to Programming Mr. Joshua Stough February 28, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript for Python Programmers
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Object Oriented Software Development
A First Program Using C#
Hello AP Computer Science!. What are some of the things that you have used computers for?
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
Visual C++ Programming: Concepts and Projects Chapter 6A: Methods (Concepts)
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Introduction to Python
Introduction to Programming Writing Java Beginning Java Programs.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
BIM211 – Visual Programming Objects, Collections, and Events 1.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
JavaScript, Fourth Edition
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
POS 406 Java Technology And Beginning Java Code
Getting a handle on ActionScript A basic primer for non-programmers.
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
JavaScript Syntax, how to use it in a HTML document
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
XP Tutorial 8 Adding Interactivity with ActionScript.
February ,  2/16: Exam 1 Makeup Papers Available  2/20: Exam 2 Review Sheet Available in Lecture  2/27: Lab 2 due by 11:59:59pm  3/2:
Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
The Math Class Methods Utilizing the Important Math Operations of Java!
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
CS 5JA Introduction to Java Graphics One of the powerful things about Java is that there is.
CSE 190 M Flash Sessions Session 2 Alex Miller, Spring 2011.
XP Tutorial 8 Adding Interactivity with ActionScript.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
ActionScript Programming Help
>> Introduction to JavaScript
Learning to Program D is for Digital.
T. Jumana Abu Shmais – AOU - Riyadh
Fundamentals of Functional Programming
February , 2009 CSE 113 B.
JavaScript: Introduction to Scripting
Web Programming and Design
Presentation transcript:

Roy McElmurry

ActionScript : an object-oriented programming language similar to JavaScript MXML : A flavor of XML that helps simplify user interface construction code Flash : An authoring program that assists the user in creating graphical ActionScript code Flex : An interactive development environment and a software development package that extends ActionScript with MXML More:

 An object oriented scripting language  Very similar to JavaScript, reminiscent of Java  The Adobe Flash program writes this code for you  A.swf file is the compiled version of Actionscript

What’s cool about Flash:  It is installed on almost every computer  Appears the same on all machines  We can write games and small programs easily  Flash allows us to put video on the web easily  Flash can be run on the desktop, outside of the browser

Visit the following webpage and follow the instructions Coming Soon What you need to do Download the Flex SDK Install the StandAlone Flash player Start writing some ActionScript Files

 There are many types of variables one can use  int, Number, String, Boolean, Object  The value you give you variable must be consistent with the type you specified  The name of your variable can be anything that starts with a letter or underscore, with a few exceptions  Specifying type is not mandatory, but is good practice Syntax: var name : type = value ;

 Comments are very important: leave them for yourself and for others  Don’t have unnecessary comments clutter your code  You can also use them to temporarily “turn off” some code Syntax: // One Line /* Multiline */

 Arrays are used to store multiple values that we know are related or have meaning together  Arrays are also useful in junction with for loops Syntax: var name :Array = [ value1, value2,…,valuen ]; var name :Array = new Array( value1, value2, …, valuen );

 The brackets allow you to grab just one of the values stored in an array  Indexing starts at zero, so the first value in the array is at index zero  The first piece of syntax simply access the index  The second piece of syntax is for reassigning the value of the array at the given index Syntax: name [ index ] name [ index ] = value ;

 If statements are used to conditionally run some code  These can be done in combination with else if and else statements to run different code based on mutually exclusive tests Syntax: if ( condition ) { //statements }

 You can have as many else if statements as you want  You may or may not include the else case Syntax: if ( condition ) { //statements } else if (condition) { //statements } else { //statements }

 for loops are used to do similar code a definite number of times  Typically we define a new loop variable and have our condition and update based on it Syntax: for ( declaration ; condition ; update ) { //Statements }

 Notice that we have a variable i which we could use during the statements section, this is common practice  Typically the loop variable is called i, j, or k Syntax: for (var i:int = 0; i < condition ; i++) { //Statements }

 while loops are used for executing similar code when we don’t know how many times we will do it  For instance we may want to grab user input until they give us a certain piece of information Syntax: while ( condition ) { //statements }

 A function is used to capture a procedure that you may want to use several times  With functions you can reuse code and make it much easier to read Syntax: function name ( parameter1:type,…,parametern:type ): type { //statements }

 To use a function you simply call its function name, and give it whatever parameters it needs  If the function has a return type other than void, you can capture that returned value by assigning the function call to a variable Syntax: name ( value1, …, valuen ); var name : type = functionName ( value1, …, valuen );

 There are many functions you may want to use that you didn’t write yourself  To do so, you must use the dot notation, such as Math.sqrt(4); Math Function Math.sqrt( number );Square Root Math.abs( number );Absolute Value Math.max( number1, number2 );Maximum, there is also a min Math.round( number );Round Math.E, Math.PIE and Pi values

 Actionscript files are saved with an “as” extension as in “HelloWorld.as” Template: package { import flash.display.Sprite; [SWF(backgroundColor="#ffffff", frameRate="24", width=" 550 ”, height=" 400 ")] public class NAME extends Sprite { //STUFF HERE }

 There are three kinds of text fields static, dynamic and input Example: import flash.text.*; … var myTextField:TextField = new TextField(); myTextField.text = “Hello World”; myTextField.x = 100; myTextField.y = 100; More:

 You choose to have a dynamic or input text box by changing the type field of your TextField variable Example: var myTextField:TextField = new TextField(); myTextField.text = “Hello World”; myTextField.type = TextFieldType.INPUT; myTextField.border = true; More:

 The graphics object has many kinds of shapes we can draw Example: import flash.display.*; … var myShape:Shape = new Shape(); myShape.graphics.beginFill(0x000000); myShape.drawCircle(100, 100, 50); More:

 A Lot of the graphics methods are just like with the graphics object that we saw in the DrawingPanel Graphics Function beginFill(color:uint)Sets the “paintbrush” color drawCircle(x:Number, y:Number, radius:Number) Draws a circle drawRect(x:Number, y:Number, width:Number, height:Number) Draws a Rectangle moveTo(x:Number, y:Number)Moves the “paintbrush” to (x,y) lineTo(x:Number, y:Number)Draws line to (x,y) clear()Erases everything More:

 Objects are not by default displayed on the screen, instead we must add them to the screen by calling addChild()  You can actually add things as the children of objects other than the screen Syntax: addChild( SOMETHING ); More:

package { import flash.display.Sprite; import flash.display.*; [SWF(backgroundColor="#ffffff", frameRate="24", width=" 550 ”, height=" 400 ")] public class Shapes extends Sprite { public function Shapes():void { var myShape:Shape = new Shape(); myShape.graphics.beginFill(0x000000); //black myShape.graphics.drawCircle(50, 75, 25); myShape.graphics.drawRect(150, 150, 100, 75); addChild(myShape); }

 There are many other parameters you can pass to your object tag with an inner param tag  IE has problems with the object tag, click the more link for tips on how to embed flash in IE Syntax: <object type="application/x-shockwave-flash” data=“ yourfile.swf ” width=“ 550 ” height=“ 400 ” > More: More:

 Shapes have many properties including the above  Each of the above is with respect to the shapes parent Shape Properties shape.xX coordinate w.r.t. its parent shape.yY coordiante w.r.t. its parent shape.rotationRotation w.r.t. its parent shape.widthWidth w.r.t. its parent shape.heightHeight w.r.t. its parent More:

 So far we only know of Shape and TextField objects, but actually we also know about the Sprite class which we extend.  We can instantiate more sprites and add children to them to create more complicated designs Syntax: sprite.addChild( SOMETHING ); More: