Getting hotspots to interact with Lingo

1. Select the QTVR sprite on the score and then select New Behavior from
the Behavior drop down menu in the score

Selecting the QTVR sprite on the score

2. Delete any existing script and type the following (the text can be
copy and pasted into the Behavior script window):


property p_currentSprite

--The BeginSprite handler is called when the QTVR sprite first appears
-- on stage. It determines the channel that the sprite is residing in and
-- then sets up the handler - HotSpotCallback - to be called when a user
-- clicks on a hotspot


on
BeginSprite me
set p_currentSprite = the SpriteNum of me
set the triggerCallback of sprite p_currentSprite = #HotSpotCallback
end
-- The HotSpotCallback handler simply alerts the ID of the hotspot
-- clicked on


on HotSpotCallback me, theHotSpotID
alert "The ID of the HotSpot clicked on is " & theHotSpotID
end
<
--The EndSprite handler is called when the playback head enters a frame -- where the QTVR sprite is absent. It clears the triggerCallback
-- property

on EndSprite me
set the triggerCallback of sprite p_currentSprite = 0
end

What happened to VRTriggerCallback?
In Director 6.5, the VRTriggerCallback property fulfilled the same function as triggerCallback does in 7.0

VRTriggerCallback in Director 7.0 still works in the same way [undocumented]



3. Close the script window, rewind and run the Director movie. Click on
a hotspot in the QTVR movie

The results of clicking on a hotspot

The HotSpotCallback handler can be easily changed to include
specific testing for individual hot spots. This can be achieved through
the use of if...then or case statements


on HotSpotCallback me, theHotSpotID
if theHotSpotID =100 then
  alert "That's right!"
else
  alert "Sorry, try again"
end if
end



< Importing QTVR movies into Director : Taking control of QTVR movies within Director >
1