Can key presses be used to control image presentation?
I would like to know whether there is any way to allow participants to use key presses within either MediaLab or DirectRT to control presentation of images in a sequential manner and then record which image is finally chosen. For example, to test people's susceptibility to the Muller-Lyer illusion, I would like to be able to present images of lines in a sequence like this: >-----<-------> then >------<------> then >-------<----->, where participants would be able to advance or go backward between the images by pressing a key (e.g., right and left arrow keys), and then record which image they choose as their final answer (the goal being to choose the drawing where the line segments between arrows appear equal). Ideally, I would like participants to be able to drag the middle arrowhead to the position they think equally subdivides the line, but I don't know how to program animations that participants can control, so I thought having them control presentation of still images might work instead. Any suggestions on how I can do this would be greatly appreciated!
Can and how would I use this Java script?
I found a free "photo slider" Java script (see below) that will allow participants to move backward and forward through a series of images by clicking on Back and Next buttons on the screen. Can I use this script somehow in a MediaLab questionnaire? I am not sure how to record which image the participant finally selects, but one inelegant way would be to put an identification number in my drawings and have participants type this number as their response. Please let me know if this would work, and if so, how I would incorporate the script into a MediaLab questionnaire that would allow participants to type their answer. Thanks!
<table border="0" cellpadding="0">
<caption><strong>Air Show Photos</strong></caption>
<tr>
<td width="100%"><img src="plane1.gif" width="300" height="240" name="photoslider"></td>
</tr>
<tr>
<td width="100%"><form method="POST" name="rotater">
<div align="center"><center><p><script language="JavaScript1.1">
var photos=new Array()
var which=0
/*Change the below variables to reference your own images. You may have as many images in the slider as you wish*/
photos[0]="plane1.gif"
photos[1]="plane2.gif"
photos[2]="plane3.gif"
photos[3]="plane4.gif"
photos[4]="plane5.gif"
function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which]
}
}
function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
}
else window.status='End of gallery'
}
</script><input type="button" value="<<Back" name="B2"
onClick="backward()"> <input type="button" value="Next>>" name="B1"
onClick="forward()"><br>
<a href="#" onClick="which=1;backward();return false"><small>Start Over</small></a></p>
</center></div>
</form>
</td>
</tr>
</table>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="<A href="http://javascriptkit.com">JavaScript">http://javascriptkit.com">JavaScript
Kit</a></font></p>
Tracking final answer in image viewer
Yes, that's it! I would just like to be able to track the final answer. Thanks very much.