Flash: ActionScript review & Controlling Sound Presentation by Mindy McAdams Edited for JOMC 187, UNC-Chapel Hill by Laura Ruel.

Slides:



Advertisements
Similar presentations
How to import and edit video clips in Windows Movie Maker
Advertisements

Windows Movie Maker Introduction to Video Editing Mindy McAdams.
Thomas Lövgren, Flash developer
Flash: Controlling Sound Presentation by Mindy McAdams.
Chapter 14 Sound. Sound  Sound can be used for narration, background soundtracks, rollover noises, and for sound effects to complement animations. 
Flash Week 5 Presentation by Mindy McAdams. Post-mortem: Flash 3 exercise Sliding panel functionality Use of big, beautiful pictures (vs. tiny pictures)
CIS 205—Web Design & Development Flash Chapter 3 Appendix B on Creating Animations.
Macromedia Flash MX 2004 – Design Professional and Interactivity WORKING WITH SYMBOLS.
Flash Workshop Flash Workshop :: Agenda  Introductions  Look at a few Flash Examples  Flash Web Sites  Flash Web Applications  Flash Games.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
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 Actionscript Adding Interactive Actions. 2 ActionScript 3.0 ActionScript is the language you use to add interactivity to Flash applications, whether.
Utah State Topics Sound  Timeline  ActionScript  Sound Design for Instruction Video.
Before you start, you should get all of your pictures together in one file. They should be in.jpg,.png,.tif or.gif format. Open your drive. Make a folder.
Microsoft ® Office PowerPoint ® 2003 Training Playing movies [Your company name] presents:
“But I don't want to be a “programmer!” ActionScript for journalists Presentation by Mindy McAdams Flashjournalism.com.
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.
© 2011 Delmar, Cengage Learning Chapter 8 Building Complex Animations.
Introduction to Flash FYS100 Creative Discovery in Digital Art Forms Spring 2007 Burg.
Flash MX II. Flash MX – Tweened Animation There are two methods for creating an animation sequence in Flash –Frame-by-frame animation –Tweened animation.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Button library Create a button Learn.
Chapter 11 Adding Sound and Video. Chapter 11 Lessons 1.Work with sound 2.Specify synchronization options 3.Modify sounds 4.Use ActionScript with sound.
Flash: Week 2 Presentation by Mindy McAdams. What Flash Does Well  Design control  Integration of media types  Interactivity  No scrolling necessary.
Copyright © 2003 Pearson Education, Inc. Chapter 5 – Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 3 "The games of a.
Creating Buttons – Lesson 71 Creating Buttons Lesson 7.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
More Tips on Flash CSC361/661 Digital Media Spring 2007 Burg.
Microsoft ® Office PowerPoint ® 2003 Training Playing sound [Your company name] presents:
Flash Flash. It’s components and usage. New generation of web- design  Definition Multimedia technology developed by Macromedia to allow much interactivity.
CSC 361/661 Digital Media Spring 2010 Professor Burg.
CIS—100 Chapter 11—Adding Sound Effects 1. Inserting Sound with the Insert Tab 2 1. Click the Insert tab and locate the Media Clips Tab. 2. Click the.
Workflow: Content (write) Acquisition (record) Produce (edit) Author (compress/export as mp3) Add meta data (ID3 tags) Distribute (ftp to moodle)
Inserting Music into PowerPoint Diane Newby, Ed.D.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Sound in Action Script "The games of a people reveal.
Datatypes, Variables, Constants Flash Class. What Does ActionScript Do? Automates Examples: – Tells animation what to do button is clicked – Turn off.
XP Tutorial 8 Adding Interactivity with ActionScript.
Variables, Scope, Images, Sound IM ActionScript.
ActionScript 3 Using Sound Related Classes by Martin Stanhope The University of Bolton.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 3 "The games of a people reveal.
Introduction to Flash CSC361/661 Digital Media Spring 2007 Burg.
Programming games Problems. Schedule Various examples. Homework: rps, bo (don't go back to do this), cannonball, Video or Audio should be complete. Now.
Macromedia Flash Design Professional And Interactivity WORKING WITH SYMBOLS.
Distributed Multimedia Programming Week - 6 ActionScripts Basics and Behaviors Working with Text.
Programming games Cannonball due. Drawing & printing example. Acquiring video or sound Homework: Catch up: complete projects (rps, Bo, cb). Start video.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
CIS 205—Web Design & Development Flash Chapter 3 Appendix on Using Buttons.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Sound and Video.
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.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Timeline Control REVIEW FOR LESSON When you encounter a problem, what’s the first thing you should do? A. If you get a compile error, go to the.
Intro to ActionScript CIS 126 Greg Shorts. What Is ActionScript? ActionScript is the scripting language Flash uses to control its movies and the objects.
Action Buttons Link to another place in your presentation Link to web pages, videos, etc. Interactivity – gives the viewer a choice of what happens next,
XP Tutorial 8 Adding Interactivity with ActionScript.
DM 11- Flash –Unit C and Interactivity WORKING WITH SYMBOLS.
Recording Your Script and Creating Your Podcast !!You are not finished until you have completed all steps on all of the slides up to and including Slide.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
CDM105 Session 12 Macromedia FLASH MX 2004 Part 5 : Sounds, publishing your movies, and the ‘Get URL’ action.
 Movieclip symbols are reusable pieces of flash animation  consisting usually of one or more graphic/button symbols  thus they are flash movies within.
Topic 02: Introduction to ActionScript 3.0
var variableName:datatype;
ActionScript Basics 2016 (2.0 – 3.0)
Adding Buttons, Actions, and Sounds
Interface Programming 2 Week 1
Presentation transcript:

Flash: ActionScript review & Controlling Sound Presentation by Mindy McAdams Edited for JOMC 187, UNC-Chapel Hill by Laura Ruel

ActionScript (so far) In the beginning…  stop();  play();  gotoAndStop( " someframelabel " );  gotoAndPlay( " otherframelabel " ); The script can be written on a button or on a frame

If script is on a button: on (release) { stuff here } Alternatively -- if a button has an instance name, you can put the script on the Timeline this way: rewind_btn.onRelease = function () { stuff here } ActionScript for buttons on (release) { stuff here } rewind_btn.onRelease = function () { stuff here }

If you need to make a movie clip stop playing (if the instance name is clouds_mc) from the main Timeline: Or if the movie clip needs to tell the main Timeline to stop playing: ActionScript & movie clips clouds_mc.stop(); this._parent.stop();

New, exciting ActionScript What is a variable?  A kind of container for data  Each variable has a name (static)  Each variable has a value (dynamic) Examples of variables (name, left; and value, right):  var n = 27;  var myColor = " orange " ;

ActionScript 2.0 variables AS 2.0 likes script to be as specific as possible. Examples of the initial declaration of variables in AS 2.0:  var n = 27;  var myColor = " orange " ;

ActionScript 2.0 variables In AS2, the you can be even more specific and “tell Flash” the type of variable you are declaring: Examples of the initial declaration of variables in AS 2.0, including “strict data typing”:  var n:Number = 27;  var myColor:String = " orange " ;

ActionScript variables We always should formally declare variables:  var n = 27;  var myColor = " orange " ;

ActionScript variables How does a variable work?  var n = 27;  n = n + 1;  if (n == 28) { stuff here } Another example:  var myColor = " orange " ;  if (myColor != " blue " ) { stuff here }

ActionScript operators == “is equivalent to” !=“is NOT equivalent to” >“is greater than” <“is less than” >=“is greater than or equal to” <=“is less than or equal to”

Variables in Lesson 8 (Sound) var cooltune = new Sound(); Here the variable is cooltune – and we are declaring it for the first time Only the first time you use cooltune in a movie – do not write var after the first appearance of the variable

Variables in Sound Lesson A variable name can be any word (except the “reserved words”; ie, the ones that turn blue when typing your script. (See next slide for list.) It’s common to use letters such as w, and z as names of variables. Avoid using “x” and “y” as they can be used in other contexts for coordinates. It’s also common to use “camel case” in the name -- e.g. mySound, theMusic, etc.

Variables in Sound Lesson Reserved words Syntactic keywords Future reserved words

Variables in Sound Lesson After we have declared a variable (with var), we can use it to do things -- rather like an instance name cooltune.start(0, 0); cooltune.stop(); These are the basics of audio in Flash (We’ll get back to this shortly)

Bringing sound into the FLA The only script difference between the two methods for the Sound object concerns how you associate your audio file with your variable: x.attachSound("crossroads"); … or … x.loadSound("rainforest.mp3", true); cooltune.attachSound("crossroads"); cooltune.loadSound("rainforest.mp3", true);

External MP3 files (loadSound) To load an external audio file, the file MUST BE in the MP3 file format Also, the file must have a sampling rate of one of these three values (on pp. 216 – 217):  kHz (doesn’t sound great)  kHz (usually best choice)  44.1 kHz (CD quality; big file size) Otherwise, you will have distorted sound

Starting and stopping sound To stop a Sound object represented by the variable name x: x.stop(); (Exactly like stopping a movie clip) To play a Sound object (from the beginning): x.start(0, 0); Script can be on a button or on a frame cooltune.stop(); cooltune.start(0, 0);

Options for starting sound This will start the sound from the beginning AND play it only once:  - This will start the sound from the beginning and loop it 100 times:  - This will start the sound 20 seconds after the beginning and play it only once: cooltune.start(0, 0); cooltune.start(0, 100); cooltune.start(20, 0);

Pausing sound Before you pause an audio file, you must determine how much has already played Then you will be able to start it (later) from the same point This property is called position var p; p = Math.floor(x.position/1000);

Pausing sound (2) Say the sound file had already played for 5.2 seconds (5,200 milliseconds) This script will get the number 5,200 and divide it by 1,000: Then it will round down the result to a whole number (not a decimal) Result: p = 5 p = Math.floor(cooltune.position/1000);

Pausing sound (3) If you have the value of p, you can use that value to restart the audio file at the correct point after it has been paused:  P  x If the value of p were 5, then the audio would immediately start playing from the point 5 seconds into the file. p = Math.floor(cooltune.position/1000); x.start(p, 0);

Adjusting the volume If all you need to do is mute the audio (while it continues to play):  - If you then need to return the audio to the maximum volume:  - The volume range is exactly 0 to 100 cooltune.setVolume(0); cooltune.setVolume(100);

ActionScript basics From the beginning…  stop();  play();  gotoAndStop( " someframelabel " );  gotoAndPlay( " otherframelabel " ); You will use these in almost every Flash movie.

ActionScript for audio (basics) From Sound Lesson (“tunes” can be any name):  var tunes = new Sound();  tunes.attachSound();  tunes.loadSound();  tunes.start(0, 0);  tunes.stop(); You will use these to control sound in any Flash movie that requires it

ActionScript/audio (advanced) From Lesson 8 (“tunes” and “p”can be any names):  var tunes = new Sound();  var p = 0;  p = Math.floor(x.position/1000);  tunes.start(p, 0);  tunes.setVolume(0);  tunes.setVolume(100); You will use these to control sound in conjunction with buttons in the Flash movie