1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| program test_mp3;
// Lecture d'un fichier audio au format MP3
uses
Flash8, Sound;
{$FRAME_WIDTH 360}
{$FRAME_HEIGHT 240}
{$BACKGROUND $ffffff}
type
TEditBox=class(TextField)
procedure onKeyDown;
end;
var
f: TextFormat;
e: TEditBox;
t: TextField;
s: Sound;
procedure TEditBox.onKeyDown;
begin
if Key.getAscii=13 then s.Start(0,1) else s.Stop;
end;
begin
f:=TextFormat.Create('Tahoma',12);
f.color:=$111111;
f.bold:=True;
e:=TEditBox.Create(nil,'input',0,0,0,360,240);
e.type:='input';
Key.addListener(e);
t:=TextField.Create(nil,'output',1,0,0,360,240);
t.text:='J.-S. Bach Cantate Ich habe genug BWV 82'+#13+
'Dietrich Fischer-Dieskau'+#13+#13+
'Appuyez sur '+"Entrée"+' pour commencer la lecture,'+#13+
'sur n''importe quelle autre touche pour l''interrompre.';
t.setTextFormat(0,Length(t.text),f);
s:=Sound.Create(_root);
s.loadSound('abschied.mp3',false);
end. |
Partager