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.

Slides:



Advertisements
Similar presentations
Chapter 14 Sound. Sound  Sound can be used for narration, background soundtracks, rollover noises, and for sound effects to complement animations. 
Advertisements

 2004 Prentice Hall, Inc. All rights reserved. Chapter 18 – Macromedia Flash MX 2004: Building an Interactive Game Outline 18.1 Introduction 18.2 Object-Oriented.
Macromedia Flash MX 2004 – Design Professional and Interactivity WORKING WITH SYMBOLS.
1 Flash Actionscript Animation. 2 Introduction to Sprites We will now look at implementing Sprites in Flash. We should know enough after this to create.
Work with symbols and instances Work with Libraries Create buttons Assign actions to buttons Unit Lessons.
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.
Chapter 11 Adding Media and Interactivity. Flash is a software program that allows you to create low-bandwidth, high-quality animations and interactive.
Chapter 3 Working with Symbols and Interactivity.
XP Tutorial 5 Buttons, Behaviors, and Sounds. XP New Perspectives on Macromedia Flash MX Buttons Interactive means that the user has some level.
1 Flash Basics by Dr SC Li. 2 File Types  In general, Flash 5.0 generates 3 types of files:  ???.fla  Flash ’ s working file  ???.swf  Flash movie.
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.
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.
Tutorial 5 Making a Document Interactive. XP Objectives Explore the different button states Add a button from the Buttons library Edit a button instance.
Flash Lesson 1 Simple Animation. Get Acquainted With The Software.
Creating Special Effects
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.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
© 2012 Adobe Systems Incorporated. All Rights Reserved. Copyright 2012 Adobe Systems Incorporated. All rights reserved. ® INTRODUCTION TO FLASH ANIMATION.
® Copyright 2008 Adobe Systems Incorporated. All rights reserved. ® ® 1 INTRODUCTION TO ADOBE FLASH CS3.
® Copyright 2010 Adobe Systems Incorporated. All rights reserved. ® ® 1 INTRODUCTION TO ADOBE FLASH PROFESSIONAL CS5.
Working with Symbols and Interactivity
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 8 "The games of a people reveal.
Copyright © 2003 Pearson Education, Inc. Chapter 5 – Slide 1 by Michael Kay The Web Wizard’s Guide to Flash.
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.
© 2010 Delmar, Cengage Learning Chapter 3: Working with Symbols and Interactivity.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 8 "The games of a.
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 2 "The games of a.
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.
Adobe Flash CS3 Revealed Chapter 3 - WORKING WITH SYMBOLS AND INTERACTIVITY.
Introduction to Flash MX 2004: Action Scripting Lloyd Rieber.
Microsoft ® Office PowerPoint ® 2003 Training Playing sound [Your company name] presents:
CSC 361/661 Digital Media Spring 2010 Professor Burg.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script "The games of a people reveal.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 INTRODUCTION TO ADOBE FLASH CS3.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
5-1 OBJ Copyright 2003, Paradigm Publishing Inc. Adding Sound, Video, and Basic Interactivity with Buttons Macromedia Flash Design & Application.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 6 "The games of a people reveal.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
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.
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.
Macromedia Flash 8 Revealed WORKING WITH SYMBOLS AND INTERACTIVITY.
Macromedia Flash Design Professional And Interactivity WORKING WITH SYMBOLS.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Tutorial 3 Creating Animations. XP Objectives Learn the different elements of animation Create frames and layers Organize frames and layers using the.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 6 "The games of a.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Action Script 12 "The games of a people.
Flash: ActionScript review & Controlling Sound Presentation by Mindy McAdams Edited for JOMC 187, UNC-Chapel Hill by Laura Ruel.
Photo Story. How to use Photo Story Photo Story 3 can be located in the Accessories folder on school computers. You will need to have your pictures already.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Sound and Video.
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 12 "The games of.
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,
DM 11- Flash –Unit C and Interactivity WORKING WITH SYMBOLS.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 5 "The games of a people reveal.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
Using Audacity Let’s get Started Open Audacity. Getting started…
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script "The games of a people.
Macromedia Flash MX Design Professional And Interactivity WORKING WITH SYMBOLS.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 11 "The games of a people reveal.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Scratch for Interactivity
Adding Buttons, Actions, and Sounds
Unit Lessons Work with actions
Working with Symbols and Interactivity
Presentation transcript:

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 a great deal about them.“ Marshall McLuhan

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Controlling sound Enhance animation and interactivity Engaging more user’s senses Establish the mood of the movie Use narration to accompany the story Give audible feedback to interactions Flash supports.WAV,.MP3,.AIF Sound class controls sound Start Stop Adjust sound volume Stereo effect

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Controlling sound sound object mySound=new Sound(); mySound.attachSound(“sound_name”); mySound.start ( seconds offset, loops); Seconds offsetnumber that determines how many seconds into the sound it should begin playing (from the beginning 0, or from a later point) Loopshow many times sound will play No parametersFlash playes sound once from the start

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Controlling sound mySound.start ( 0, 5); Plays sound from the beginning 5 times mySound = new Sound(); mySound.attachSound("guitar"); startButton_btn.onRelease = function() { mySound.start(0,5); } stopButton_btn.onRelease = function() { mySound.stop(); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds Flash allows to attach many sounds to the same sound object Start function will play the most current sound attached Volume control setVolume() Racing game- control the volume of the car engine sound as the cars pass by Pan control - control of the output through the left or right speaker setPan() Pong game – control the left and right hit wall sounds from the appropriate sides

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds setVolume(percentage of the full volume from 0 to 100) 100- maximum volume 0- silence setPan(number from -100 to 100) -100left speaker 100right speaker 0plays sound from both speakers equally

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds – 02soundobject_pan_volume.fla Open 02soundobject_pan_volume.fla from the Pickup folder

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds – 02soundobject_pan_volume.fla Drag the instances of the volume, left, right, both buttons on the stage and name them: volUp_btn volDown_btn leftSpeaker_btn rightSpeaker_btn bothSpeakers_btn

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds volUp_btn.onRelease = function() { mySound.setVolume(100); } volDown_btn.onRelease = function() { mySound.setVolume(20); } leftSpeaker_btn.onRelease = function() { mySound.setPan(-100); } rightSpeaker_btn.onRelease = function() { mySound.setPan(100); } bothSpeakers_btn.onRelease = function() { mySound.setPan(0); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds independently 03modify2sounds.fla Create separate sound objects with parameters that target specific movie clips Sound objects will be applied to different movie clips so that setVolume () and setPan () could control the sounds separately

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Modifying sounds independently 03modify2sounds.fla clip1= _root.createEmptyMovieClip("clip1", 1); clip2 = _root.createEmptyMovieClip("clip2", 2); mySound1 = new Sound(clip1); mySound2 = new Sound(clip2); mySound1.attachSound("music1"); mySound2.attachSound("music2"); start1Button_btn.onRelease = function() { mySound1.start(0, 1); } start2Button_btn.onRelease = function() { mySound2.start(0, 1); } leftButton_btn.onRelease = function() { mySound1.setPan(-100); } rightButton_btn.onRelease = function() { mySound2.setPan(100); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Transforming sounds 04soundtransform.fla More precise sound control Switch left / right speakers and stereo / mono dynamically setTransform () allows to set percentage of how much of the lefr /right channel will play through left / right speakers Properties of the sound transform object ll% value -how much of the left input plays in the left speaker lr% value -how much of the right input plays in the left speaker rr% value -how much of the right input plays in the right speaker rl% value -how much of the left input plays in the right speaker

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Transforming sounds 04soundtransform.fla mySound = new Sound(); mySound.attachSound("conversation"); startButton_btn.onRelease = function() { mySound.start(0, 5); } transformButton_btn.onRelease = function() { mySoundTransform = new Object(); mySoundTransform.ll = 0; mySoundTransform.lr = 100; mySoundTransform.rl = 100; mySoundTransform.rr = 0; mySound.setTransform(mySoundTransform); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Transforming sounds 04soundtransform.fla When we click Transform button Flash creates a generic object with properties (mySoundTrasnform.ll, mySoundTrasnform.lr, …) to hold the sound transformation information. This information then used by the setTransfrom () to change the distribution in the left and right speakers.

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla Sets desired volume level or speaker control draggable movie clip acting as a sliding controller The position of the movie clip is correlated with volume parameter of the setVolume () slider_mc movie clip groove_mc movie clip Groove_mc will limit the motion of the draggable slider_mc

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla slider_mc.onPress = function() { this.startDrag(false, _root.groove_mc._x, _root.groove_mc._y - 100, _root.groove_mc._x, _root.groove_mc._y); } slider_mc.onRelease = function() { stopDrag(); }

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla slider_mc.onPress = function() { this.startDrag(false, _root.groove_mc._x, _root.groove_mc._y - 100, _root.groove_mc._x, _root.groove_mc._y); } When user presses the slider_mc, startDrag () lets the user drag the specified movie clip and limits the position of the clip according to parameters

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla.startDrag([lock, [left, top, right, bottom]]) Lock A Boolean value specifying whether the draggable movie clip is locked to the center of the mouse position ( true ), or locked to the point where the user first clicked on the movie clip ( false ) left, top, right, bottom Values relative to the coordinates of the movie clip's parent that specify a constraint rectangle for the movie clip.

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla slider_mc.onRelease = function() { stopDrag(); } stopDrag() stops dragging setVolume(100) setVolume(0)

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla setVolume(100) setVolume(0) Correlates the y position of the slider_mc with the setVolume() globalToLocal()converts the coordinates of the slider to coordinates relative to the groove

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla slider_mc.onMouseMove = function() { myPoint = new Object(); myPoint.x = this._x; myPoint.y = this._y; _root.groove_mc.globalToLocal(myPoint); } The current x position of the slider is assigned to myPoint.x onMouseMove provides a good way to trigger volume change based on the slider position The global coordinates of myPoint are changed to local coordinates of the groove movie clip

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla Link slider position to volume setting myMusic_sound.setVolume(-myPoint.y); updateAfterEvent(); } Groove movie clip is 100 pixels tall Hence its local coordinates range from -100 to 0 To change this range to positive value negative sign(-) is used The result is a range from 100 at tope and 0 at bottom That can be used as the setVolume parameter

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Dynamic sound control 05dynamicsound.fla Create sound object and play button myMusic_sound= new Sound(); myMusic_sound.attachSound("music"); startButton_btn.onRelease = function() { myMusic_sound.start(0, 10); } Test the movie When you drag the slider up and down it dynamically changes the volume

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 External sounds 06externalsound.fla Internal sounds (from the library) increase the.swf file size loadSound () allows playing external sounds that can be kept outside flash movie Allows change the sound file easily Smaller flash file size mySound = new Sound(); mySound.loadSound("kennedy.mp3", true); loadSound("kennedy.mp3", true); Kennedy.mp3 name of the external sound file True streaming (true) or event (false) sound

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 External sounds 06externalsound.fla Streaming sounds start play as soon as enough data downloads one stream per sound object long passages of music narration Event sounds must be downloaded completely before they can play require start() command to plav short sounds sound effects

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Sound properties 07soundproperty.fla mySound = new Sound(); mySound.loadSound("kennedy.mp3", true); _root.onEnterFrame = function() { image_mc._alpha = (mySound.position / mySound.duration) * 100; image_mc._xscale = 50 + ((mySound.position / mySound.duration) * 50); image_mc._yscale = 50 + ((mySound.position / mySound.duration) * 50); } Positionmeasures the numbers of milliseconds a sound has been playing Durationtotal number of milliseconds in the sound

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Sound properties 07soundproperty.fla Modifies the image according to the sound length As the sound plays, the image slowly reveals itself When the sound ends the image is completely revealed _root.onEnterFrame = function() { image_mc._alpha = (mySound.position / mySound.duration) * 100; image_mc._xscale = 50 + ((mySound.position / mySound.duration) * 50); image_mc._yscale = 50 + ((mySound.position / mySound.duration) * 50); } (Position / duration) * 100 gives the percentage of sound that has downloaded Increases the alpha of the movie clip as the sound plays so that the movie clip begins transparent and ends opaque

AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Detect sound event 07soundproperty.fla onSoundComplete()detects the end of the sound mySound.onSoundComplete = function() { image_mc.attachMovie("end", "ending_mc", 1); } When sound ends a movie clip “end” is attached to the image_mc movie clip. The registration point of the attached movie clip was modified in advance so that it appears in correct position.