Lingo Dictionary > L-N > member (sprite property)

 

member (sprite property)

Syntax

sprite(whichSprite).member
the member of sprite whichSprite

Description

Sprite property; specifies a sprite's cast member and cast.

The member sprite property differs from the memberNum sprite property, which specifies only the sprite's number to identify its location in the cast but doesn't specify the cast itself. The member sprite property also differs from mouseMember and the obsolete castNum sprite properties, neither of which specifies the sprite's cast.

When assigning a sprite's member property, use one of the following formats:

Specify the full member and cast description (sprite(x).member = member(A, B) .

Specify the cast member name (sprite(x).member = member ("MELODY ").

Specify the unique integer that includes all cast libraries and corresponds to the mouseMember function (sprite(x).member = 132) .

If you use only the cast member name, Director finds the first cast member that has that name in all current casts. If the name is duplicated in two casts, 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 without affecting the sprite's cast (set the memberNum of sprite x to 132).

You can determine the memberNum sprite property from the member sprite property by using the phrase the number of the member of sprite x. You can also retrieve other cast member properties by using phrases such as the name of the member of sprite x or the rect of the member of sprite x.

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 sprite 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. Although you can change all sprite properties through the type sprite property, 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 property can be tested and set.

Example

This statement assigns cast member 3 of cast number 4 to sprite 15:

sprite(15).member = member(3, 4) 

Example

The following handler uses the mouseMember function with the sprite.member property to find if the mouse is over a particular sprite:

on exitFrame
	MM = the mouseMember
	target = sprite(1).member
	if target = MM then put "above the hotspot"
	go the frame
end

See also

castLibNum, memberNum