Lingo Dictionary > D-F > duration |  |

duration

Syntax

    member(whichCastMember).duration
    the duration of member whichCastMember

Description

Cast member property; determines the duration of the specified sound, Shockwave Audio (SWA), transition, or QuickTime cast members.

| When `whichCastMember` is a sound member or a streaming Shockwave Audio file, this property indicates the duration of the sound. For Shockwave Audio the `duration` property returns 0 unless the member has been preloaded with `preLoadBuffer()`, or until streaming has begun.
| When `whichCastMember` is a digital video cast member, this property indicates the digital video's duration. The value is in ticks.
| When `whichCastMember` is a transition cast member, this property indicates the transition's duration. The value for the transition is in milliseconds. During playback, this setting has the same effect as the Duration setting in the Frame Transition dialog box.

This property can be tested for all cast members that support it, but only set for transitions.

To see an example of `duration` used in a completed movie, see the QT and Flash movie in the Learning\Lingo Examples folder inside the Director application folder.

Example

If the SWA cast member Louie Prima has been preloaded, this statement displays the sound's duration in the field cast member Duration Displayer:

    on exitFrame
    	if member("Louie Prima").state = 2 then
    		member("Duration Displayer").text = member("Louie Prima").duration
    	end if
    end

Example

You can use a behavior on a digital video sprite to loop the playback head in the current frame until the movie is finished playing, allowing it to continue when the end is reached:

    property spriteNum

    on exitFrame me
    	myMember = sprite(spriteNum).member
    	myDuration = member(myMember).duration
    	myMovietime = sprite(spriteNum).movieTime
    	if myDuration > myMovietime then
    		go to the frame
    	else
    		go to the frame + 1
    	end if
    end

See also

`preLoadBuffer(), preLoadTime`