slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
July 23 rd and 24 th , 2009– Jeff Galak (CMU) PowerPoint Presentation
Download Presentation
July 23 rd and 24 th , 2009– Jeff Galak (CMU)

Loading in 2 Seconds...

play fullscreen
1 / 18
nitara

July 23 rd and 24 th , 2009– Jeff Galak (CMU) - PowerPoint PPT Presentation

107 Views
Download Presentation
July 23 rd and 24 th , 2009– Jeff Galak (CMU)
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. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Programming Behavioral Experiments in FlashAdvanced Topics if Flash (Sounds, Videos, and Real Time Ratings) July 23rd and 24th, 2009– Jeff Galak (CMU)

  2. Agenda for Today • How to play sounds • How to collect real time ratings • How to play videos • How to convert videos to Flash format • How to “rip” videos from YouTube Flash Workshop - Intro to Web Programming, PhP, and Flash

  3. Working with Sound Files • Import sound file to library • File->Import->Import to Library • Within the library, create a “linkage” • Right click on sound file -> Linkage • Check “Export for Actionscipt” • Give your file a name • Ok • Now your file is ready to be accessed via ActionScript Flash Workshop - Intro to Web Programming, PhP, and Flash

  4. Sound File + Actionscript • Define a “sound variable” • var currentsound:Sound = new Sound (); • Created a variable called “currentsound” • Attach a sound file to the new variable • currentsound.attachSound("sample"); • Attached the sound file “sample” to “currentsound” • Play the file • currentsound.start(0,1); • Plays the sound file associated with “currentsound” • The first argument “0” tells it to start at the begninning of the song • The second argument “1” tells is the number of times to play the sound (once, in this case) Flash Workshop - Intro to Web Programming, PhP, and Flash

  5. Other Things to Remember with Sound Files • You can stop your sound file with the stop() command: • currentsound.stop(); • You can change the volume with the volume command (0 to 100): • currentsound.setVolume(50); • You can have the program do something (e.g. go to the next frame) when the sound is done playing: currentsound.onSoundComplete = function() { nextFrame(); } Flash Workshop - Intro to Web Programming, PhP, and Flash

  6. Collecting In-Experience (Online) Ratings • Two ways to do this: • Stop people every X seconds and collect a measure • Have a slider-scale that continuously records a value • We will focus on the latter. Flash Workshop - Intro to Web Programming, PhP, and Flash

  7. Online Scale Set up (With a Song) Scale Flash Workshop - Intro to Web Programming, PhP, and Flash

  8. Online Scale Code Code for song Code for slider scale Tells flash to run the function “collectdata” every 3 seconds When this function is run, it simply stores the value of the scale Flash Workshop - Intro to Web Programming, PhP, and Flash

  9. Things to Remember with Online Scales • You can change the frequency of the data collection by changing the number in the myTimer line. Time is in milliseconds. • Make sure to add the clearInterval command when you leave the frame • In this case, when the sound stops playing Flash Workshop - Intro to Web Programming, PhP, and Flash

  10. Working with Videos • Videos need to be in .flv (flash video) format. • You can convert them using flash. • File -> Import -> Import Video • This takes a long time but works well. • You can use 3rd party software for conversion • Allok Video to FLV Converter • http://www.alloksoft.com/flv_converter.htm • Works much faster, but sometimes the converted file doesn’t work. No clue why. Flash Workshop - Intro to Web Programming, PhP, and Flash

  11. Ripping Video from YouTube • http://www.savevid.com/ • Simply copy+paste the URL from youtube into the box on savevid.com • Make sure the file extension is .flv • Done. Flash Workshop - Intro to Web Programming, PhP, and Flash

  12. Editing FLV Files • Adobe Air + RichFLV • Adobe Air: http://www.adobe.com/products/air/ • RichFLV: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1355018 • Install Air first. • RichFLV lets you edit FLV files quickly. Flash Workshop - Intro to Web Programming, PhP, and Flash

  13. Flash and Videos • Create a video placeholder with the “my_video” object in the library. • Name it something: my_video • Make sure that the video file is somewhere on the web (even while testing). Flash Workshop - Intro to Web Programming, PhP, and Flash

  14. Actionscript and Videos This is the only line you really care about This block of code is optional. It allows you to skip the video by hitting CTRL+A Flash Workshop - Intro to Web Programming, PhP, and Flash

  15. What About Online Measures and Videos? Just add the scale and the myTimer code: myTimer = setInterval(collectdata,3000); iteration=1; function collectdata() //function that stores the data { ratio=Math.round(((Slider.dragger._x-(Slider.dragger._width/2))/(Slider.line._width))*sliderMaximum); storedata("soundrating_"+iteration,ratio); iteration++; } Flash Workshop - Intro to Web Programming, PhP, and Flash

  16. Dynamic Feedback • Text is easy (we saw this in the first program) • Graphs and figure are more difficult • Basic bar chart implementation… • Place a “barchart” object on the stage. • Double click on it • Click on the only frame to open the actionscript Flash Workshop - Intro to Web Programming, PhP, and Flash

  17. Dynamic Feedback – Bar Chart chart_values = [20,-7, 3, 5]; chart_group_names = ["Test 1", "Test 2", "Test 3", "Test 4”]; chart_height = 300; chart_width = 500; chart_data_values = true; chart_x_axis_lables = true; chart_x_axis_name = "Groups"; chart_y_axis_name = "Values"; Flash Workshop - Intro to Web Programming, PhP, and Flash

  18. That’s It! • Go forth and collect data! • Spread the gospel of Flash. • And most importantly, have a great weekend. Flash Workshop - Intro to Web Programming, PhP, and Flash