Mal ein kleines Sound OOP für den selbst gebauten MP3 Player
|
ActionScript-Quelltext
|
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
|
soundfile = new Object();
// Konstruktor
soundfile = function (file, daten) {
soundfile.className = soundfile;
soundfile.urlfile = "http://mydomain/player/musik/" add file;
soundfile.daten = daten;
};
soundfile.prototype.abspielen = function() {
soundfile.musikstueck = new Sound();
soundfile.musikstueck.loadSound(soundfile.urlfile, false);
soundfile.totals = getBytesTotal(soundfile.musikstueck);
soundfile.musikstueck.onLoad = function() {
if ((soundfile.spielt == 0)||(soundfile.spielt == undefined)) {
soundfile.musikstueck.start(soundfile.playerstatus, 1);
soundfile.spielt = 1;
soundfile.playerstatus = 0;
} else {
stopAllSounds();
soundfile.spielt = 0;
}
};
};
soundfile.prototype.pausieren = function () {
s = getTimer();
soundfile.playerstatus = (s/1000);
soundfile.musikstueck.stop();
soundfile.spielt = 0;
};
soundfile.prototype.anhalten = function () {
soundfile.musikstueck.stop();
soundfile.spielt = 0;
};
|
Der aufruf zum Abspielen
|
ActionScript-Quelltext
|
1
2
|
meinSound = new soundfile("mene.mp3", "gruppe");
meinSound.abspielen();
|
Stoppen
|
ActionScript-Quelltext
|
1
|
meinSound.anhalten();
|
Pause Taste
|
ActionScript-Quelltext
|
1
|
meinSound.pausieren();
|
mfg Jürgen