Recipe 13.4 Getting Playback Time

13.4.1 Problem

You want to determine the time of the current playback position of a sound.

13.4.2 Solution

Use the position property. To get the total time of a sound, use the duration property.

13.4.3 Discussion

Flash offers a convenient way to access information about the playback time for a sound. All Sound objects have position and duration properties (both are read-only), which reflect the current playback position and the total duration of a sound. Both values are given in milliseconds.


The position property updates automatically during playback. You can get the percentage that corresponds to the current playback position by dividing position by duration and multiplying the result by 100:

trace(mySound_sound.position/mySound_sound.duration * 100);

    Part I: Local Recipes
    Part II: Remote Recipes