1 / 25

IMD 2002

IMD 2002. Week 06 – Media Management Part 2. Agenda. Assignment 1 Marks Extra Resources Audio Management + Mini Assignment Break Video and Input Management + Mini Assignment Break 2 nd Assignment Assigned Final Project Assigned. Assignment #1 Marks.

azize
Télécharger la présentation

IMD 2002

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Jon Keon | Winter 2012 IMD 2002 Week 06 – Media Management Part 2

  2. Jon Keon | Winter 2012 Agenda • Assignment 1 Marks • Extra Resources • Audio Management + Mini Assignment • Break • Video and Input Management + Mini Assignment • Break • 2nd Assignment Assigned • Final Project Assigned

  3. Jon Keon | Winter 2012 Assignment #1 Marks • All of your marks are up on Blackboard now and you should have gotten an email from me with your mark sheet. • Double check to make sure they match. (They should)

  4. Jon Keon | Winter 2012 Extra Resources • AS3 Cookbook • http://shop.oreilly.com/product/9780596526955.do • Tutorials • Flash and Math • http://www.flashandmath.com/ • Compilation of Tutorials • http://tutorials.as3.ca/ • Collection of very good tutorials • http://gotoandlearn.com/ • More obscure but good tutorials • http://www.senocular.com/flash/tutorials/ • Excellent Forums and Tutorials • http://www.kirupa.com/ • Defacto place to ask for help • http://stackoverflow.com/questions/tagged/actionscript-3

  5. Jon Keon | Winter 2012 Audio Management • Ways to interact with Audio. • Embedded Audio on the timeline of a MovieClip • Streaming MP3’s • Sound Objects • Audio in Video via NetStream

  6. Jon Keon | Winter 2012 Audio Management • Embedded Audio • This is when you drag an audio clip onto the timeline in Flash CS5.5 • The audio will then play along with the animation in the timeline. • This is very useful for ensuring that audio is perfectly synched with the animations. • However this also can bloat your file size so it’s a bit of a tradeoff. • You can apply a sound transform. • To play and stop, simply play or stop the movieclip it’s attached to.

  7. Jon Keon | Winter 2012 Audio Management • Streaming MP3’s • Flash (currently) can only stream MP3s. • Streaming allows you to play sound without having to download the entire sound file first. • MP3’s have some unfortunate encoding issues that insert a tiny bit of silence at the end of the MP3 file. This causes looping MP3 files to not work always as nicely as you want.

  8. Jon Keon | Winter 2012 Audio Management • Sound Objects • The most common method of Audio management in AS3. • Used for short clips of dialogue or sound effects. • Must have the whole file in the app domain to use.

  9. Jon Keon | Winter 2012 Audio Management • NetStream Audio • For synchronization reasons Audio is embedded with Video (naturally). • We’ll see more of this with the NetStream object when playing Video.

  10. Jon Keon | Winter 2012 Audio Management • BONUS: For those Audio inclined. • ByteArrays that get interpreted as Audio Data. • This is very low level access and useful when doing things like affecting the Pitch/Tone/etc. • Audio Tool • http://www.audiotool.com/ • Is a fully featured mixing board and synthesizer all made in AS3. • If you’re interested in diving into this, start here: • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html#extract()

  11. Jon Keon | Winter 2012 AS3 Classes for Audio • Sound • SoundTransform • SoundChannel • Audio is a bit weird in that the functionality is split between Sound and SoundChannel. • When you play a sound it returns a sound channel that the sound is being played on. To stop it, you must stop the channel, not the Sound. • Sound itself is more of a specialized loader but you can tell it to play. • Sound Transform modifies the sound in terms of volume and left/right panning.

  12. Jon Keon | Winter 2012 Mini Assignment #1 • Using the following pages for reference complete these tasks: • Use a random MP3 or WAV file off the internet. • By pressing different buttons, get it to Play, Stop and Mute. • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/SoundChannel.html • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/SoundTransform.html

  13. Jon Keon | Winter 2012 Video Management • Video Management in Flash is done through the use of NetStream and Video objects. • The Video object sits on the actual display list like a Sprite or MovieClip and allows video data to actually be displayed. • The NetStream object manages the connection between Flash and your source video.

  14. Jon Keon | Winter 2012 Video Management • Video types you can play: • FLV – Old school. • H.264 .mov, .mp4 – New(ish) school. • Highly recommend you use H.264 for all your video needs. It’s a very good and very common format. • You can also handle the raw bytes if you really want to. But that requires an extremely fast internet connection or for you to write a custom decoder that runs fast enough to display video at your target framerate.

  15. Jon Keon | Winter 2012 Video Management • Video can become a very complex subject depending on how far you want to dive in. • You can attach webcams, attach microphones, use GPU accelerated video, broadcast through Peer 2 Peer networks, utilize DRM… • Fortunately 99% of the time, people just want to click play and see some nice moving pictures.

  16. Jon Keon | Winter 2012 Video Management • Similar to Audio, all the actions you generally wish to perform (Play, Stop, Rewind, FastForward, etc) are done on the NetStream object. • Again the Video object is just the visual container to display the video data.

  17. Jon Keon | Winter 2012 Input Management • We’ve already looked at how to handle input from the Mouse. • But sometimes (especially for games) we want to handle keyboard input as well. • Keyboard Input is slightly trickier that Mouse Input due to Focus. • Events travel through the object we have focus on first and then bubble up to the stage.

  18. Jon Keon | Winter 2012 Input Management • Example: • If we have a button that we click on to send a message to a friend. And we also want to save some time and have it so that when the user presses the ‘Enter’ key it also sends the message, the natural thing to do would be to attach a keyboard listener to the button. • However this won’t work as chances are we are going to be typing in a text box to display our message and so that Text Box is what has focus. Not our button. We have to click on the button to give the button focus and well… that kind of defeats the purpose.

  19. Jon Keon | Winter 2012 Input Management • While there may be cases where you do what keyboard events on specific objects, it’s usually best just to add them to the stage. • This way you’re guaranteed to get a global listener on all keyboard events. • (Unless you’ve added them to something else and stopped propagation – Advanced)

  20. Jon Keon | Winter 2012 Input Management • Unfortunately it’s not as easy as just listening for when the ‘Enter’ key is pressed. • There are two KeyboardEvents you’ll want to listen to. • KeyboardEvent.KEY_DOWN • KeyboardEvent.KEY_UP • When you receive this event you will get the keycode corresponding to which key was pressed. • It’s up to you to decide how to manage this and ultimately get the behavior you desire.

  21. Jon Keon | Winter 2012 Input Management • Example: • If you want the user to press a key and release it, the you will need to store that the KEY_DOWN was received for that particular key and then wait for the KEY_UP on the same key to launch your function. • If you want continuous behavior as long as the key is down, fire your function just while the KEY_DOWN for your specific key is true.

  22. Jon Keon | Winter 2012 Input Management • Best Practice (but also some involved work) • Store the values of the keys that are pressed in a dictionary. • This allows for easy queries like isKeyDown(‘ENTER’)? • Which can just simply return __dictionary[‘ENTER’] which will be true or false. • This is how you can handle multiple input like CTRL-A or Up Arrow and Left Arrow at the same time.

  23. Jon Keon | Winter 2012 Mini Assignment #2 • Using the following resources, load and play a video that you find online. If you press the Spacebar, the video should pause, if you press it again it should play. • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Video.html • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetConnection.html • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/KeyboardEvent.html

  24. Jon Keon | Winter 2012 Assignment #2 • Info

  25. Jon Keon | Winter 2012 Final Project • Info • Good References: • http://www.thefwa.com/

More Related