03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

duration (Sound.duration property)<br />

public duration : Number [read-only]<br />

The duration of a sound, in milliseconds.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

The following example loads a sound <strong>and</strong> displays the duration of the sound file in the<br />

Output panel. Add the following <strong>ActionScript</strong> to your FLA or AS file.<br />

var my_sound:Sound = new Sound();<br />

my_sound.onLoad = function(success:Boolean) {<br />

var totalSeconds:Number = this.duration/1000;<br />

trace(this.duration+" ms ("+Math.round(totalSeconds)+" seconds)");<br />

var minutes:Number = Math.floor(totalSeconds/60);<br />

var seconds = Math.floor(totalSeconds)%60;<br />

if (seconds

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!