You want to determine the time of the current playback position of a sound.
Use the position property. To get the total time of a sound, use the duration property.
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.
trace(mySound_sound.position); trace(mySound_sound.duration);
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);
|