Field of Science

Web Experiment Tutorial: Chapter 9, Finishing Up

Several years ago, I wrote a tutorial for my previous lab on how to create Web-based experiments in Flash. I am currently posting that tutorial chapter by chapter.









9. Finishing Up


We still haven’t finished putting the experiment online. You will recall that clicking the link in Consent.html opened two files. It opened test_in_progress.html. It also opens test_popup.php and centers it in the middle of the screen.



















































































































The only thing to be interested in here is the first command:




$link = “VSTM.swf”.

Make sure this is set to the name of your file. Notice the extension .swf. This is the compiled form of a Flash file. We’ll make it momentarily. This is what will actually be displayed.

2. Making .swf files.

Each time you “test” a .fla file in Flash, it compiles the file into a .swf file in the same directory. However, it is best to go to File->Publish to create the .swf file. It will also create an .html file (which simply runs the .swf file) and and .swd file, which does something or other. You can use this VSTM.fla file, though hopefully that is identical to the one you made.

Take that .swf file and copy it into your VSTM directory on your website. Now you can browse to your index.html file and run your experiment directly. Everything should work.

3. The exit button

Add a button to the “finish” frame of your Flash file. Change the label to “Exit”. Add this code to the button:

on (click){
     getURL("javascript:updateParent('http://URL/VSTM/done.html'); javaScript:self.close()");
}

Change “URL” so that it matches the actual path. Now, when subjects finish the experiment, they can click on that button. It will close the window and change the test_in_progress.html browser window to done.html.

VSTM.fla incorporates this.

This does not work when you are testing your experiment from your hard drive. To see this work, you must be running the experiment through the Web.

4. Instructions and debriefing.

You will want to add some debriefing information. You can do this as part of done.html, or you can do it within VSTM.fla. An advantage of doing it within Flash is that you can modify the debriefing depending on the subject’s scores. For instance, you could calculate VSTM capacity in this experiment for this subject and display it in the debriefing.

You would also want to add instructions. This should be fairly straight-forward at this point. 




As usual, please leave any questions in the comments section.

No comments: