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.

activityLevel (propriété Microphone.activityLevel)<br />

public activityLevel : Number [lecture seule]<br />

Une valeur numérique spécifiant le volume sonore détecté par le microphone. Les valeurs sont<br />

comprises entre 0 (aucun son n'est détecté) et 100 (un son <strong>de</strong> gran<strong>de</strong> intensité est détecté). La<br />

valeur <strong>de</strong> cette propriété peut vous ai<strong>de</strong>r à déterminer une valeur appropriée à transmettre à la<br />

métho<strong>de</strong> Microphone.setSilenceLevel().<br />

Si le microphone est disponible mais n'est pas encore utilisé car Microphone.get() n'a pas<br />

été appelé, cette propriété est définie sur -1.<br />

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

Exemple<br />

L'exemple suivant affiche le niveau d'activité <strong>du</strong> microphone actuel dans une occurrence<br />

ProgressBar intitulée activityLevel_pb.<br />

var activityLevel_pb:mx.controls.ProgressBar;<br />

activityLevel_pb.mo<strong>de</strong> = "manual";<br />

activityLevel_pb.label = "Activity Level: %3%%";<br />

activityLevel_pb.setStyle("themeColor", "0xFF0000");<br />

this.createEmptyMovieClip("sound_mc", this.getNextHighestDepth());<br />

var active_mic:Microphone = Microphone.get();<br />

sound_mc.attachAudio(active_mic);<br />

this.onEnterFrame = function() {<br />

activityLevel_pb.setProgress(active_mic.activityLevel, 100);<br />

};<br />

active_mic.onActivity = function(active:Boolean) {<br />

if (active) {<br />

var haloTheme_str:String = "haloGreen";<br />

} else {<br />

var haloTheme_str:String = "0xFF0000";<br />

}<br />

activityLevel_pb.setStyle("themeColor", haloTheme_str);<br />

};<br />

La métho<strong>de</strong> MovieClip.getNextHighestDepth() utilisée dans cet exemple nécessite Flash<br />

Player 7 ou une version ultérieure. Si votre fichier SWF inclut un composant <strong>de</strong> la version 2,<br />

utilisez la classe DepthManager <strong>de</strong>s composants <strong>de</strong> la version 2 à la place <strong>de</strong> la métho<strong>de</strong><br />

MovieClip.getNextHighestDepth().<br />

Voir également<br />

obtenir (métho<strong>de</strong> Microphone.get), setSilenceLevel (métho<strong>de</strong><br />

Microphone.setSilenceLevel), setGain (métho<strong>de</strong> Microphone.setGain)<br />

Microphone 811

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

Saved successfully!

Ooh no, something went wrong!