03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Exemple<br />

L'exemple suivant associe le son logoff_id à my_sound. L'un <strong>de</strong>s sons <strong>de</strong> la bibliothèque<br />

comporte l'i<strong>de</strong>ntifiant <strong>de</strong> liaison logoff_id.<br />

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

my_sound.attachSound("logoff_id");<br />

my_sound.start();<br />

<strong>du</strong>ration (propriété Sound.<strong>du</strong>ration)<br />

public <strong>du</strong>ration : Number [lecture seule]<br />

Durée d'un son, en millisecon<strong>de</strong>s.<br />

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

Exemple<br />

L'exemple suivant charge un son et affiche la <strong>du</strong>rée <strong>du</strong> fichier audio dans le panneau <strong>de</strong> sortie.<br />

Ajoutez à votre fichier FLA ou AS le co<strong>de</strong> <strong>ActionScript</strong> suivant.<br />

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

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

var totalSeconds:Number = this.<strong>du</strong>ration/1000;<br />

trace(this.<strong>du</strong>ration+" 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!