programming behavioral experiments in flash session 2 of 3 building your first flash experiment

11
Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment January 30, 2009 – Jeff Galak (NYU)

Upload: russell-barron

Post on 31-Dec-2015

21 views

Category:

Documents


1 download

DESCRIPTION

Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment. January 30, 2009 – Jeff Galak (NYU). Agenda for the Week. Session 1: Thursday, January 29 th (2-4pm): Intro to Web Programming, PhP, and Flash Session 2: Friday, January 30 th (10-12pm): - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Programming Behavioral Experiments in Flash

Session 2 of 3 Building Your First Flash Experiment

January 30, 2009 – Jeff Galak (NYU)

Page 2: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 2

Agenda for the Week

• Session 1: Thursday, January 29th (2-4pm): Intro to Web Programming, PhP, and

Flash

• Session 2: Friday, January 30th (10-12pm): Building Your First Flash Experiment

• Session 3: Friday, January 30th (3-5pm): Advanced Topics if Flash(Sounds, Videos, and Real Time Ratings)

Page 3: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 3

Agenda for Today

• Working with Pictures

• Reaction Times

• Create a new experiment from “scratch”

Page 4: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 4

Two Ways To Get Pictures Into Your Program

1. “Hard Code” them• Drag an image file from a folder directly onto

the stage.• Note that Flash adds it to the library.

• File -> Import to Stage/Library

2. Use ActionScript

Page 5: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 5

Pictures and ActionScript

• Use the “empty movie clip” place holder

• Name it something: “imageLoader1”

• Save an image file in the same folder as the program

• In ActionScript, use the following code:

loadMovie(“img.jpg", "imageLoader1");

Name of image file. Can be variable or string.

Name of place holder. Can be variable or string.

Page 6: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 6

Reaction Times in Actionscript

• gettimer()• Starttime = gettimer()

– Put this somewhere in the main part of the frame

• Endtime = gettimer()– Put this wherever you exit the frame (e.g. when a

button is clicked)

• storedate(“reactiontime”,endtime-starttime);– Put this just below the endtime=gettimer() line

• Done!

Page 7: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 7

Creating a New Experiment: Steps

1. Duplicate existing experiment

2. Rename all the files to the new experiment name

3. Update “experiment”.php• Change experimentname• Set the right number of conditions

Page 8: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 8

Creating a New Experiment: Steps

4. Program your experiment• Update the preamble to reflect the correct

conditions• Do everything else• Test your program in Flash (use Trace when

needed)

5. Compile your experiment: Shift + F12

6. Create debriefing

Page 9: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 9

Creating a New Experiment: Steps

7. Server Stuff• Connect to your server via FileZilla• Create a directory with the same name as your

experiment• Upload everything• CHMOD the folder and files to 777

8. Test your program online 9. Check that the data file is created and looks

right10. CHMOD the data file to 777

Page 10: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 10

Homework

1. Install software!!

2. Try and upload the existing files to your webserver and see if everything works– Make sure to check permissions (CHMOD 777 works

well)…ask me for help

3. Take any simple questionnaire you have and try to turn it into a program (at least 2 conditions)– If you can’t get the web version to work just yet, try

and get it to work locally (e.g. with CTRL+ENTER)– If you don’t have a questionnaire, I will give you one

Page 11: Programming Behavioral Experiments in Flash Session 2 of 3 Building Your First Flash Experiment

Session 2 - 01/30/2009 11

Next Session

• Session 3: Friday, January 30th (3-5pm):

Advanced Topics if Flash(Sounds, Videos, and Real Time Ratings)