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.

Voir également<br />

onLoad (gestionnaire Sound.onLoad)<br />

onID3 (gestionnaire Sound.onID3)<br />

onID3 = function() {}<br />

Appelé dès que <strong>de</strong> nouvelles données ID3 sont disponibles pour un fichier MP3 que vous<br />

chargez à l'ai<strong>de</strong> <strong>de</strong> Sound.attachSound() ou Sound.loadSound(). Ce gestionnaire donne<br />

accès aux données ID3 sans interrogation. Si les balises ID3 1.0 et ID3 <strong>2.0</strong> existent dans un<br />

fichier, ce gestionnaire est appelé <strong>de</strong>ux fois.<br />

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

Exemple<br />

L'exemple suivant affiche les propriétés ID3 <strong>de</strong> song1.mp3 dans une occurrence <strong>du</strong><br />

composant DataGrid. Ajoutez à votre document un composant DataGrid sous le nom<br />

d'occurrence id3_dg et ajoutez le co<strong>de</strong> <strong>ActionScript</strong> suivant à votre fichier FLA ou AS :<br />

import mx.controls.gridclasses.DataGridColumn;<br />

var id3_dg:mx.controls.DataGrid;<br />

id3_dg.move(0, 0);<br />

id3_dg.setSize(Stage.width, Stage.height);<br />

var property_dgc:DataGridColumn = id3_dg.addColumn(new<br />

DataGridColumn("property"));<br />

property_dgc.width = 100;<br />

property_dgc.hea<strong>de</strong>rText = "ID3 Property";<br />

var value_dgc:DataGridColumn = id3_dg.addColumn(new<br />

DataGridColumn("value"));<br />

value_dgc.width = id3_dg._width-property_dgc.width;<br />

value_dgc.hea<strong>de</strong>rText = "ID3 Value";<br />

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

my_sound.onID3 = function() {<br />

trace("onID3 called at "+getTimer()+" ms.");<br />

for (var prop in this.id3) {<br />

id3_dg.addItem({property:prop, value:this.id3[prop]});<br />

}<br />

};<br />

my_sound.loadSound("song1.mp3", true);<br />

Voir également<br />

attachSound (métho<strong>de</strong> Sound.attachSound), id3 (Sound.id3, propriété),<br />

loadSound (métho<strong>de</strong> Sound.loadSound)<br />

Sound 1149

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

Saved successfully!

Ooh no, something went wrong!