View comments | RSS feed

number (Member)

Usage

-- Lingo syntax
memberObjRef.number

// JavaScript syntax
memberObjRef.number;

Description

Member property; indicates the cast library number of a specified cast member. Read-only.

The value of this property is a unique identifier for the cast member that is a single integer describing its location in and position in the cast library.

Example

This statement assigns the cast number of the cast member Power Switch to the variable whichCastMember:

-- Lingo syntax
whichCastMember = member("Power Switch").number

// JavaScript syntax
var whichCastMember = member("Power Switch").number;

This statement assigns the cast member Red Balloon to sprite 1:

-- Lingo syntax
sprite(1).member = member("Red Balloon").number

// JavaScript syntax
sprite(1).member = member("Red Balloon").number;

This verifies that a cast member actually exists before trying to switch the cast member in the sprite:

-- Lingo syntax
property spriteNum

on mouseUp me
   if (member("Mike's face").number > 0) then
      sprite(spriteNum).member = "Mike's face"
   end if
end

// JavaScript syntax
function mouseUp() {
   if (member("Mike's face").number > 0) {
      sprite(this.spriteNum).member = "Mike's face"
   }
}

See also

castLib(), Member


Comments


No screen name said on May 17, 2004 at 2:02 PM :
The examples of how to test for the existance of a member will give an error since the member doesn't exist. This is the old way to test. The new way (in lingo) would be:

on mouseUp me
if not(voidp(member("Mike's face"))) then
sprite(spriteNum).member = "Mike's face"
end if
end

 

RSS feed | 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_pr434.htm