-- Lingo syntax _movie.sendAllSprites(stringEventMessage{,args}) // JavaScript syntax _movie.sendAllSprites(stringEventMessage{,args});
Movie method; sends a designated message to all sprites, not just the sprite that was involved in the event. As with any other message, the message is sent to every script attached to the sprite, unless the stopEvent() method is used.
For best results, send the message only to those sprites that will properly handle the message through the sendSprite() method. No error will occur if the message is sent to all the sprites, but performance may decrease. There may also be problems if different sprites have the same handler in a behavior, so avoid conflicts by using unique names for messages that will be broadcast.
After the message has been passed to all behaviors, the event follows the regular message hierarchy: cast member script, frame script, then movie script.
When you use the sendAllSprites() method, be sure to do the following:
stringEventMessage with the message.
args with any arguments to be sent with the message.
If no sprite has an attached behavior containing the given handler, sendAllSprites() returns FALSE.
stringEventMessage Required. A string that specifies the message to send to all sprites.
args Optional. An argument or arguments to send with the message.
This handler sends the custom message allSpritesShouldBumpCounter and the argument 2 to all sprites when the user clicks the mouse:
-- Lingo syntax
on mouseDown me
_movie.sendAllSprites(#allspritesShouldBumpCounter, 2)
end
// JavaScript syntax
function mouseDown() {
_movie.sendAllSprites("allspritesShouldBumpCounter", 2);
}
Movie, sendSprite(), stopEvent()
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/director/mx2004/release_update_en/07_me386.htm