UpdateLock

From Director Online Wiki
Jump to: navigation, search

If you set the updateLock to TRUE you can jump to a different frame without refreshing the screen. The user will continue to see the image of the frame that the playback head has just left. You can then use a Score Recording sequence to alter the score at the new frame, without letting the user see the changes as they occur. You can also simply extract information about the new frame.

Event Handlers

Even though the Stage will not update, many event handlers will be triggered. If your aim is simply to extract information, the process may be slowed down considerably by these events. Here is a behavior that you can attach to all sprites in a target frame, to prevent unwanted triggering of these events:

on beginSprite(me)
  if the updateLock then
    vSprite = sprite(me.spriteNum)
    vBehaviors = vSprite.scriptInstanceList
    vBehaviors.deleteAll() 
    stopEvent
  end if    
end

This behavior should be placed before all other behaviors on all sprites. Here's a demonstration of how the handler works.

Shortcomings

Download the source movie for Mac or Windows, then open the movie in Director. Now move the red QuickDraw shape sprite at the marker "Test" from channel 5 to channel 1. If you now run the movie, you will get a red flash whether you set the updateLock to TRUE or not.

If you step through the code line by line in the debugger, you will see that sprite 1 (the go"Test") button is momentarily replaced by the red shape sprite.

In other words, the updateLock may not behave as you expect it to.