Lingo Dictionary > L-N > memberNum

 

memberNum

Syntax

sprite(whichSprite).memberNum
the memberNum of sprite whichSprite

Description

Sprite property; identifies the position of the cast member (but doesn't identify the castLib) associated with the specified sprite whichSprite. Its value is the cast member number only; the cast member's cast is not specified.

The memberNum property is useful for switching cast members assigned to a sprite so long as the cast members are within the same cast. To switch among cast members in different casts, use the member sprite property. For the value set by Lingo to last beyond the current sprite, the sprite must be a puppet.

This property also is useful for exchanging cast members when a sprite is clicked to simulate the reversed image that appears when a standard button is clicked. You can also make some action in the movie depend on which cast member is assigned to a sprite.

When you set this property within a script while the playback head is not moving, be sure to use the updateStage command to redraw the Stage.

This property can be tested and set.

Example

The following statement switches the cast member assigned to sprite 3 to cast member number 35 in the same cast:

sprite(3).memberNum = 35

Example

This statement assigns the cast member Narrator to sprite 10 by setting memberNum sprite property to Narrator's cast number. Narrator is in the same cast as the sprite's current cast member.

sprite(10).memberNum = member("Narrator").number

Example

This handler swaps bitmaps when a button is clicked or rolled off. It assumes that the artwork for the Down button immediately follows the artwork for the Up button in the same cast.

on mouseDown
	upButton = sprite(the clickOn).memberNum
	downButton = upButton + 1
	repeat while the stillDown
		if rollover(the clickOn) then 
			sprite(the clickOn).memberNum = downButton
		else 
			sprite(the clickOn).memberNum = upButton
		end if
		updateStage
	end repeat
	if rollover (the clickOn) then put "The button was activated"
end

See also

castLib, member (sprite property), number (cast member property), member (keyword)