top of script window
correlation meter code snippet | show it | return |
on activateSlider
  global sliderLeft, sliderWidth
  
  -- script for slider movement and corresponding display
  
  repeat while the stillDown
    
    -- constrain vertical movement to sprite 5 
    set newH = constrainH( 5, the mouseH )
    set the locH of sprite 6 to newH
    
    -- update cast name for data plots; cast numbers 1 - 21
    -- represent the range from r= -1.00 to r = +1.00 by
    -- increments of 0.1
    set the castNum of sprite 3 to 1 + 20 * ( newH - sliderLeft) / sliderWidth
    
    -- use cast names for display
    put the name of cast (the castNum of sprite 3) into field "R"
    updateStage
  end repeat

end activateSlider
This slider handler is called by a mousedown on the graphics representing the control. Globals keep the coordinates of the slider's left position and the width of the allowed slide area. The different graphs are stored as different cast members, placed in order from cast member 1 to 21, representing R values of -1.0 to +1.0.

lingo era = v4-5 Not so great to keep a tight repeat loop, could do without globals but this was a tiny app. Use of stillDown, castNum is old Lingo