Review of Previous Class Declaring variables var myVariableName:DataType = variableValue;

Slides:



Advertisements
Similar presentations
Adding User Interactions actionscript 3.0. Common event-handling tasks Writing code to respond to events Stopping code from responding to events Working.
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
AS3: Events & Listeners eventListeners in ActionScript 3.
Benchmark and Java Applet Test Scenario Presentation Outline Introduction to Benchmark Testing Procedure to create the test Benchmark Playback Results.
The Web Warrior Guide to Web Design Technologies
Add Sound Effects to a Presentation Add sound effects to a presentation Course contents Overview: This sounds easy Lesson 1: Play a sound file Lesson.
1 Flash Actionscript Event Handling. 2 Event Handling Right now we know all about variables lets go back to our text input/output example: Suppose we.
Flash Workshop Flash Workshop :: Agenda  Introductions  Look at a few Flash Examples  Flash Web Sites  Flash Web Applications  Flash Games.
1 Flash Actionscript Adding Interactive Actions Variables.
Kapi’olani Community College Art 258 Interface Programming II In-class Presentation Week 5A.
1 Flash Actionscript Actionscript and Objects. 2 Actionscript and Objects ActionScript is what's known as an object-oriented programming language. Object-oriented.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
Utah State Button Symbols, Bitmaps, Actionscripting.
Scripts  Director’s scripting language is called Lingo  Lingo can be used to offer your users navigational control of the order of the scenes of your.
Events (Listeners/Handlers: Mouse, keyboard, timer) Flash ActionScript 3.0 Introduction to Thomas Lövgren, Flash developer
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Adding Automated Functionality to Office Applications.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
INTRODUCTION TO HTML5 Drag and Drop in HTML5. Browsers Support  Currently, most of the major HTML5 desktop web browsers support the new HTML5 drag-and-drop.
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Programming & Scratch. Programming Learning to program is ultimately about learning to think logically and to approach problems methodically. The building.
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
Add sound effects to a presentation Play a sound file In this lesson, you’ll learn how to insert a sound file of your own or a sound effect from the clip.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
Getting a handle on ActionScript A basic primer for non-programmers.
Lab 6: event & input intro User Interface Lab: GUI Lab Oct. 2 nd, 2013.
More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Diagnostic Pathfinder for Instructors. Diagnostic Pathfinder Local File vs. Database Normal operations Expert operations Admin operations.
Scratch Programming Lesson 4 Question asking and answering.
IMS 3253: Subroutines 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Procedures Subroutines Parameters –By Value.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
XP Tutorial 8 Adding Interactivity with ActionScript.
1 CS161 Introduction to Computer Science Topic #9.
Object Oriented Programming.  Interface  Event Handling.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming – Home and reload buttons for the webbrowser, Applets.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Event Handling Tonga Institute of Higher Education.
SCRIPT PROGRAMMING WITH FLASH Introductory Level 1.
Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return.
Lesson 8: The OOP concepts of Polymorphism and Interfaces.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
1 Event Driven Programs Rick Mercer. 2 So what happens next?  You can layout a real pretty GUI  You can click on buttons, enter text into a text field,
CISC 110 Day 6 Introduction to Events. Outline Event-Driven Programming Event Classes Hierarchy –Event Class –Mouse Events –Keyboard Events Registering.
Intro to ActionScript CIS 126 Greg Shorts. What Is ActionScript? ActionScript is the scripting language Flash uses to control its movies and the objects.
Using Workflow With Dataforms Tim Borntreger, Director of Client Services.
PowerPoint Basics Tutorial 2: A Slide Show In this tutorial you’re going to create a presentation from scratch. You will have to keep this presentation.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
PaintPictureBoxDemo Refers to the PaintPictureBoxDemo Visual Basic Program Included With The Lecture.
Using Custom Submission Questions and Questionnaires in Editorial Manager™ Created by J. Strusz (9/21/2010)
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Programming & Scratch.
ActionScript Basics 2016 (2.0 – 3.0)
Introduction to Events
Interface Programming 2 Week 1
Fonts, TabControl, ListBox
Programming in JavaScript
Programming in JavaScript
Hints on Chapter 5.
Tonga Institute of Higher Education
Presentation transcript:

Review of Previous Class Declaring variables var myVariableName:DataType = variableValue;

Functions function myFunctionName() { //instructions go here }

Functions that accept parameter values function myFunctionName(param:DataType) { trace(param); }

Functions that return values function myFunctionName():ReturnDataType { return someValue; }

Example function that accepts paramters and returns a value function generate(minRange:Number, maxRange:Number):uint { return Math.floor(Math.random() * (maxRange - minRange) + minRange); } var num:uint = generate(5, 10); trace(num); //generates random number between 5 and 10

Embedding fonts into textboxes When you set a textbox to a dynamic type so it can have an instance name for dynamic text, you must also embed the fonts. Demonstrate refresher of creating dynamic textbox.

ActionScript 3’s Event Listener Model ActionScript 3 is driven by the event listener model to notify the Flash Virtual Machine of whenever an important event occurs. Certain types of objects have the ability to broadcast when some event takes place so subsequent instructions may be executed when that exact event takes place. Assigning event listeners to listen to event broadcasts is optional.

ActionScript 3’s Event Listener Model Event Scenario: You’re driving somewhere. As long as your car doesn’t break down, you have no reason to call CAA for any road support or towing services. In the event that your car breaks down, you have to do two things for them to successfully help you: - first, you have to call a CAA operator and notify them that your car broke down. - then, you have to give instructions to the CAA operator of where it broke down so they can find you.

Events are different actions an object can be doing.

Event Model Syntax First, we have to assign an event listener to listen to an object that might or might not broadcast an event if you want to listen for something. myButton.addEventListener(); Then, we have to tell the event listener what to specifically listen for. We’re not just going to respond to any random event that might occur. myButton.addEventListener(“mouseClick”); Event listener types are string values;

Event Model Syntax Each individual event listener can listen to just one event at a time. You can have multiple event listeners assigned to one object to listen for multiple types of events. myButton.addEventListener(“mouseClick”); myButton.addEventListener(“rollOver”); myButton.addEventListener(“rollOut”);

Event Model Syntax There’s no point in listening if we don’t do anything with that information we listened for. So we assign some instructions to execute when we successfully hear about that event occurring. myButton.addEventListener(“mouseClick”, celebrate); “Celebrate” is the custom name of a function that contains a set of instructions to execute. Since you specified the name, you are also responsible for creating that function with the instructions to execute.

Event Model Syntax myButton.addEventListener(“mouseClick”, celebrate); function celebrate(e:MouseEvent) { trace(“Yay! Mouse was clicked”); } The e:MouseEvent is a mandatory MouseEvent datatype parameter. Every event listener sends an event data type to your function which is expected to accept it. That event contains a set of information that you can choose to look at and use. Most people don’t.

Event Model Syntax myButton.addEventListener(“mouseClick”, celebrate); function celebrate(e:MouseEvent) { trace(e); } If you trace out the MouseEvent data type that was automatically accepted from the event listener, it will actually display a set of information that was sent to your function by the event listener. Using this information is optional.

Removing listeners At some time in our lives, there may come a time when we no longer want to hear the nagging sounds of our spouse’s complains notifying us of every little event that occurs in the house. So we simply remove the listener from an object to stop listening to it. Note that we also have to specify what event state to stop listening for and the function that it should stop sending instructions to. myButton.removeEventListener(“mouseClick”, celebrate);

Who broadcasts events? Button object MovieClip object Sound object Timer object Stage object Keyboard object Just to name a few. Endless possibilities really. Everyone broadcasts events. We’ll cover a few of those object types in future classes. Whenever something happens in Flash either by user action or some automated action, an event listener is the only way to know when something is happening so you can respond to it appropriately. Like secret spies, they are your awareness notifiers.

Demonstrate Button Event Listener example in Flash