XP Tutorial 8 Adding Interactivity with ActionScript.

Slides:



Advertisements
Similar presentations
Tutorial 7 Planning and Creating a Flash Web Site.
Advertisements

Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Tutorial 6 Creating a Web Form
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
The Web Warrior Guide to Web Design Technologies
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 6 Working with Web Forms
Tutorial 10 Programming with JavaScript
Macromedia Flash 5 Advanced Level Course. Using Actions Toolbox ListActions List Parameters area Add/Delete a StatementMove Action Up/Down Expand/Collapse.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
Introduction to Macromedia Flash 8
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Button library Create a button Learn.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Buttons library Edit a button instance.
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
Publishing a Macromedia Flash Movie – Lesson 131 Publishing a Macromedia Flash Movie Lesson 13.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
© 2012 Adobe Systems Incorporated. All Rights Reserved. Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® INTRODUCTION TO FLASH ANIMATION.
XP Tutorial 1 Introduction to Macromedia Flash MX 2004.
1 JavaScript in Context. Server-Side Programming.
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.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
Using Client-Side Scripts to Enhance Web Applications 1.
XP Tutorial 4 Special Animations. XP New Perspectives on Macromedia Flash MX Special Layers for Animation Animation Using a Motion Guide Layer.
7-1 OBJ Copyright 2003, Paradigm Publishing Inc. Using ActionScript and Creating Templates Macromedia Flash Design & Application.
Tutorial 7 Planning and Creating a Flash Web Site.
Creating Buttons – Lesson 71 Creating Buttons Lesson 7.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Introduction to JavaScript CS101 Introduction to Computing.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
XP Tutorial 8 Adding Interactivity with ActionScript.
© 2011 Delmar, Cengage Learning Chapter 10 Using ActionScript to Enhance User Experience.
XP Tutorial 7 Creating a Flash Web Site. XP New Perspectives on Macromedia Flash 82 Objectives Plan and create a Flash Web site Create a Flash template.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
1 A Basic Introduction to Flash. Outline What is a flash? Macromedia Flash MX 2004 Flash concepts Flash Demos Conclusion Additional help 2.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
XP Tutorial 3 Creating Animations. XP New Perspectives on Macromedia Flash MX Elements of Animation Layers are used to organize the content of.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Adobe Flash Professional CS5 – Illustrated Unit A: Getting Started with Adobe Flash Professional.
Creating a Flash Web Site
Using Video, and Flash Components, and Printing Flash Content
Background Information
Tutorial 10 Programming with JavaScript
Adding Buttons, Actions, and Sounds
Unit Lessons Work with actions
WEB PROGRAMMING JavaScript.
Tutorial 6 Creating Dynamic Pages
Tutorial 10 Programming with JavaScript
Tutorial 10: Programming with javascript
Presentation transcript:

XP Tutorial 8 Adding Interactivity with ActionScript

XP 2New Perspectives on Macromedia Flash 8 Objectives Review the basics of ActionScript programming Use ActionScript to create links to access external Web sites Create input and dynamic text fields Use ActionScript to create an input form Create and test a Flash preloader

XP 3New Perspectives on Macromedia Flash 8 Programming with ActionScript ActionScript: programming language in Flash ActionScript is used to make a document interactive –Examples: make buttons operational, process user input ActionScript may also be used to write applications –Example: shopping card application Tutorial tasks involving the use of ActionScript –Control multimedia elements to access Web pages –Process data entered into input forms

XP 4New Perspectives on Macromedia Flash 8 Sample Flash Application

XP 5New Perspectives on Macromedia Flash 8 Working with Objects and Properties ActionScript is used to control and modify objects Object: Flash element with modifiable properties –Examples: buttons, movie clips, and text blocks Properties are identified by underscore; e.g., _alpha ActionScript examines and modifies many properties –Objects to be manipulated often require a name assignment Dot notation: links object to properties and methods –Example: circle_mc._alpha = 30 // mc stands for movie clip

XP 6New Perspectives on Macromedia Flash 8 Code Hints in the Actions Panel

XP 7New Perspectives on Macromedia Flash 8 Using Actions, Methods, and Functions Action: statement passing instruction to SWF file Functions –Statement blocks that process data when called –Return a value or perform some action –Parameters or arguments: values passed to a function Methods are functions specific to a particular object –Use dot notation to bind a method to an object –Example: circle_mc.gotoAndPlay(10)

XP 8New Perspectives on Macromedia Flash 8 Writing ActionScript Using Variables, Expressions, Operators, and Comments Variable: container that holds data while SWF plays Keyword: word or phrase reserved for ActionScript –Examples: else, if, while, this Expression: statement assigning a value to a variable Two types of data –String data: series of characters within quotation marks –Numeric data: numbers not enclosed with quotation marks Operators manipulate values in expressions

XP 9New Perspectives on Macromedia Flash 8 Writing ActionScript Using Variables, Expressions, Operators, and Comments (continued) Types of operators –Assignment operator (=): assigns value to variable –Arithmetic operators: +, -, *, and / –Comparison operators:, >=, = =, != Conditional statement –Uses comparison operators to compare values –Example: if (x > 50) { gotoAndPlay(1):} Comments: explanatory notes set off by slashes (//)

XP 10New Perspectives on Macromedia Flash 8 Comment in Script Pane

XP 11New Perspectives on Macromedia Flash 8 Writing ActionScript Code Syntax: set of rules specifying valid code constructs ActionScript statements follow a specific syntax –Example: parentheses are required to group arguments Use Actions toolbox to limit syntax errors Some places where scripts are added –Frame: script triggered when playhead reaches frame –Button: script activated when button clicked and released –Movie clip: script performed as part of a movie clip

XP 12New Perspectives on Macromedia Flash 8 ActionScript Syntax

XP 13New Perspectives on Macromedia Flash 8 Exploring ActionScript Examples Leslie’s Salad and Sandwich Shop Web site –Use this site to review ActionScript examples ActionScript code for buttons in Specials page –Controls how playhead moves in the Timeline –Playhead moves to daily special based on button click Another code example from ballsample.fla –_x property of movie clip is modified with ActionScript –_x property contains horizontal position (X coordinate)

XP 14New Perspectives on Macromedia Flash 8 ActionScript for Movie Clip

XP 15New Perspectives on Macromedia Flash 8 Linking to Web Sites Using the getURL() Function Objective: add links to a Resources page getURL(): loads a document into a browser window Format: getURL(url, window) –url (uniform resource locator): address of the Web site –window options: _self, _blank, _parent, and _top _blank option will be used in Resources page –Specifies that document is opened in a new window Button clicks cause getURL() to load document

XP 16New Perspectives on Macromedia Flash 8 getURL() Function

XP 17New Perspectives on Macromedia Flash 8 Text Block Above Buttons

XP 18New Perspectives on Macromedia Flash 8 Creating an Input Form How an input form works –User enters data into input fields –Input data processed by current page or Web server –Results of process are displayed One scenario involving an input form –Visitor enters number and type of items to be purchased –Other fields display total price based on entry Input forms must include dynamic text and input text

XP 19New Perspectives on Macromedia Flash 8 Using Dynamic and Input Text Static text: cannot be changed after document plays Dynamic text: defined to display variable contents –Variable can be manipulated to change value displayed Use the Text tool to create a dynamic text block –Select Dynamic Text type in the Property inspector Input text: allows user to enter text into text block Use Text tool to create an input text box –Select Input Text type in the Property inspector

XP 20New Perspectives on Macromedia Flash 8 Dynamic Text Options

XP 21New Perspectives on Macromedia Flash 8 Additional Options for Input Text

XP 22New Perspectives on Macromedia Flash 8 Creating the Team Jersey Calculator Page Objective: calculate costs for team jerseys Calculator requirements –Four input text boxes to gather type, quantity, add-ons –Calculate button with ActionScript to process input data –Dynamic text block to display the total cost –Explanatory text for input text and calculate button Pseudocode: programming logic in English syntax Use pseudocode to design the script

XP 23New Perspectives on Macromedia Flash 8 Dynamic Text Block For Cost Calculator Page

XP 24New Perspectives on Macromedia Flash 8 Complete ActionScript Code

XP 25New Perspectives on Macromedia Flash 8 Using a Flash Preloader SWF files are often downloaded to a client computer Factors affecting the download time of SWF files –Size of the file measured in kilobytes –Type of Internet connection; e.g., broadband or dial-up Large SWF file may require a long time to download Ways to overcome excessive download wait time –Stream the content: play frames as content arrives –Add a preloader animation to advise user of status

XP 26New Perspectives on Macromedia Flash 8 Sample Preloaders

XP 27New Perspectives on Macromedia Flash 8 Creating the Preloader ActionScript Adding a preloader requires ActionScript code Pseudocode for the preloader logic –Get the total number of bytes –Get the number of bytes loaded –If the number of bytes loaded equals the total number of bytes Play the rest of the SWF file else continue playing the preloader animation

XP 28New Perspectives on Macromedia Flash 8 Changing the Width of a Movie Clip

XP 29New Perspectives on Macromedia Flash 8 Creating a Preloader for the Jackson’s Sports Web Site Objective: create a preloader on main page Specifications for preloader –Add preloader to revised version of Main.fla file –Preloader will start Frame 1 of its own layer –ActionScript is added to second frame of Actions layer

XP 30New Perspectives on Macromedia Flash 8 ActionScript for Preloader

XP 31New Perspectives on Macromedia Flash 8 Completing the Actions for the Jackson’s Sports Web Site Objective: make new buttons on Main.fla functional Resources and Calculate buttons load SWF files Requirements –SWF files load in level 1 of Flash Player –loadMovieNum() action will be added to each button –Action will execute after button is clicked –Files to load: Resources.swf and Calc.swf