Accessibility

TechNote

How can I delay for a certain number of seconds, yet maintain interactivity?

There are a couple of ways to remain on a particular frame. You can use the Tempo Channel's "Wait for..." command, but this is mainly for presentations and does not accommodate interactivity. (It's also not available in Shockwave.)

You can use the Lingo "delay" command to halt the advance of the playback head, but this was also designed for presentations rather than interactive pieces.

The"pause" command was used in previous versions but also tends to just pause everything. The pause command was replaced by one-frame loops, but even with this it can be difficult to cleanly measure out a given number of seconds.

Locking the computer into a very long repeat loop would be the worst situation of all, because it prevents other user and system events from being processed. Repeat loops are designed for short, fast execution, not multi-second delays.
For more information on how to create a pause functionality see:

"How can I make a pause/continue button?" (TechNote 13509)

"Creating a pause/continue button in Director" (TechNote 14816)

This simple behavior can be of help. If you copy it into a new Behavior, and make sure that the linebreaks are still correct after traveling across the web, then you can drag this into any frame or sprite to allow a fully-interactive hold on a frame for your desired number of seconds.

   property spriteNum, myDelay, myStartTicks  on beginSprite me set myStartTicks to the ticks set myDelay to myDelay * 60 end  on exitFrame me if myStartTicks + myDelay > the ticks then go the frame end  on getPropertyDescriptionList me set c to "How many seconds to delay?" return [#myDelay: [#comment:c, #format: #float, #default: 3.0]] end  on getBehaviorDescription me set line1 to "This simple behavior will pause on a single frame for a given number of seconds. " set line2 to "Unlike some other approaches you'll retain full interactivity during this pause, so sprites can be dragged about, keys pressed, etc." return line1 & line2 end 


AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_12433

Products Affected: