DR Developer's Guide
DR Interfaces | DR Methods | DR Types and Misc API

IMoaDrSpriteCallback

Interface ID: IID_IMoaDrSpriteCallback
Pointer type: PIMoaDrSpriteCallback
Inheritance: IMoaUnknown
Header file: driservc.h

Description

The IMoaDrSpriteCallback interface is provided in Director by the class that implements IMoaMmSpriteCallback, which is provided through the sprite actor initialization method IMoaMmXSpriteActor::SetCallback(). To acquire IMoaDrSpriteCallback, the asset can call QueryInterface() on IMoaMmSpriteCallback.

This interface provides additional, Director-specific callback services to a media asset.

Methods

Acquiring IMoaDrMovie
GetMovie()
Sprite access
GetSpriteChanIndex()
Scripting support
SendSpriteMessage()

GetMovie()

Syntax
GetMovie(PIMoaDrMovie * ppIMoaDrMovie)
Parameters
ppIMoaDrMovie
Pointer to place to store the movie interface
Returns
MoaError
Description
Gets the movie interface for the movie in which the sprite is appearing. You are responsible for releasing this interface when you're done with it.

GetSpriteChanIndex()

Syntax
GetSpriteChanIndex(PMoaDrSpriteChanIndex pChanIndex)
Parameters
pChanIndex
Pointer to place to store the channel index
Returns
MoaError
Description
Gets the sprite channel number for the Director sprite associated with this sprite instance. Channel numbers are 1-based.

SendSpriteMessage()

Syntax
SendSpriteMessage(MoaMmSymbol handlerName, MoaLong nArgs, PMoaMmValue pArgs, PMoaMmValue pResult, MoaBool * pHandled)
Parameters
handlerName
Symbol indicating the handler to call
nArgs
Number of arguments passed to the handler
pArgs
Pointer to first element of array with the arguments
pResult
Pointer to place for the result of the call to be placed
pResult
Pointer to place where it will be indicated if the call was handled by the sprite
Returns
MoaError
Description
Sends a message along the standard message hierarchy starting with the sprite. The message proceeds along the path:

sprite --> cast member --> frame --> movie

until it is consumed by a script at some level. (If no such handler exists at a given level, the message proceeds to the next level. Alternatively, a Lingo script can intentionally pass a message to the next level using the pass Lingo command.

The caller supplies symbol for handler to call (name), the arguments (nArgs, pArgs), and a pointer to a MoaMmValue to receive a result, if any, from the handler call.

Upon return, pHandled is set to TRUE if the call was handled. If the message is not handled, it silently disappears and FALSE is returned in pHandled.

This method is ideal for implementing widget-type sprite Xtras. For example, if you're implementing a button Xtra, you could send a buttonClicked message whenever the button was clicked. Developers could then handle this message by putting an on buttonClicked handler in the sprite script for any object in the hierarchy: sprite, cast member, frame, movie). The Xtra could, of course, emit multiple messages, which would be needed to implement a multi-part widget such as a scrollbar.

Copyright © 1995-2008 Adobe Macromedia Software LLC, Inc.