Show different pictures/videos when an image is selected in the selector

PennController for IBEX Forums Support Show different pictures/videos when an image is selected in the selector

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8188
    yzhu130
    Participant

    Hi,

    I got stuck on figuring out how to display different images/videos given what’s selected. Right now I have a canvas with the images and a selector that looks like this:

    newSelector("answer")
                .add(getImage("pic1"),getImage("pic2"))
                .shuffle()
                .keys("F","J")
                .frame("solid 5px purple")
                .log()
                .once()
                .wait()

    And I want to display only row.gif1 if pic1 is selected and only row.gif2 if pic2 is selected (with the previous canvas removed). What’s the easiest way to do it? Ideally I want to be able to add multiple things when something is selected and those things run serially just like in a normal trial.

    I’m not sure if this is clear. Thank you in advance!

    #8191
    Jeremy
    Keymaster

    Hi,

    Use .test.selected:

    newSelector("answer")
      .add(getImage("pic1"),getImage("pic2"))
      .shuffle()
      .keys("F","J")
      .frame("solid 5px purple")
      .log()
      .once()
      .wait()
      .test.selected( getImage("pic1") )
      .success( newImage(row.gif1).print() ) 
      .failure( newImage(row.gif2).print() )
    ,
    getCanvas("myCanvas").remove()
    

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.