-- Lingo syntaxspriteObjRef.member // JavaScript syntaxspriteObjRef.member;
Sprite property; specifies a sprite's cast member and cast library. Read/write.
The member Sprite property differs from the spriteNum Sprite property, which specifies only the sprite's number to identify its location in the cast library but doesn't specify the cast library itself. The member property also differs from the Mouse object's mouseMember property, which does not specify a sprite's cast library.
When assigning a sprite's member property, use one of the following formats:
spriteObjRef.member = member(intMemberNum {, castLibraryNameOrNum})).
spriteObjRef.member = member("stringMemberName").
mouseMember property (spriteObjRef.member = 132) .
If you use only the cast member name, Director finds the first cast member that has that name in all current cast libraries. If the name is duplicated in two cast libraries, only the first name is used.
To specify a cast member by number when there are multiple casts, use the memberNum Sprite property, which changes the member's position in its cast library without affecting the sprite's cast library (spriteObjRef.memberNum = 10).
The cast member assigned to a sprite channel is only one of that sprite's properties; other properties vary by the type of media element in that channel in the Score. For example, if you replace a bitmap with an unfilled shape by setting the member Sprite property, the shape sprite's lineSize property doesn't automatically change, and you probably won't see the shape.
Similar sprite property mismatches can occur if you change the member of a field sprite to a video. It's generally more useful and predictable to replace cast members with similar cast members. For example, replace bitmap sprites with bitmap cast members.
This statement assigns cast member 3 of cast number 4 to sprite 15:
-- Lingo syntax sprite(15).member = member(3, 4) // JavaScript syntax sprite(15).member = member(3, 4);
The following handler uses the mouseMember function with the sprite.member property to find if the mouse is over a particular sprite:
-- Lingo syntax
on exitFrame
mm = _mouse.mouseMember
target = sprite(1).member
if (target = mm) then
put("Above the hotspot.")
_movie.go(_movie.frame)
end if
end
// JavaScript syntax
function exitFrame() {
var mm = _mouse.mouseMember;
var target = sprite(1).member;
if (target = mm) {
put("Above the hotspot.");
_movie.go(_movie.frame);
}
}
lineSize, mouseMember, Sprite, spriteNum
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/director/mx2004/release_en/09_pr374.htm