Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 11-10-2004, 15:12   #1 (permalink)
flashkonsole
 
Benutzerbild von Flashkonsole
 
Registriert seit: Sep 2003
Ort: Berlin
Beiträge: 59
probleme mit loadsound

Folgendes Problem:
Klasse: Game, methode: SoundTimer und playSound.
Die Methode SoundTimer wird aus der Klasse aufgerufen und funktioniert auch einwandfrei....und ruft dann, je nach der Länge von dem sound ein Interval auf welches die Methode playSound aufruft.
Dies funktioniert auch einwandfrei....aber nur im FlashPlayer - nicht online.

ich habe auch schon versucht die if-schleifen in die onSoundComplete funtion zu stecken, aber das hat noch weniger funktioniert also sprich nicht mal im Flashplayer.

Hat jemand ne Idee wie man das lösen könnte?
Ab wann kann ich denn sound.duration abfragen? erst nach vollständigem laden oder schon vorher?

ich checks nisch ...


Code:

Game.prototype.soundTimer = function(element){

//element == Audiopfad
//Soundelement abspielen
_root.mysound.loadSound(element,true);

_root.mysound.onSoundComplete = function(){
_root.stopanzeige = 1;
}


//Intervall für die Wiederholung je nach Länge der Sounds an sich

if(_root.mysound.duration >= 15000 && _root.mysound.duration < 20000){
soundtime = setInterval(this, "playSound", 32000, element);
}
if(_root.mysound.duration >= 10000 && _root.mysound.duration < 15000){
soundtime = setInterval(this, "playSound", 21000, element);
}
if(_root.mysound.duration >= 5000 && _root.mysound.duration < 10000){
soundtime = setInterval(this, "playSound", 16000, element);
}
if(_root.mysound.duration > 0 && _root.mysound.duration < 5000){
soundtime = setInterval(this, "playSound", 13000, element);
}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sound abspielen
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Game.prototype.playSound = function(element){

stopAllSounds();

_root.mysound.loadSound(element,true);
_root.mysound.start(0,1);

_root.mysound.onSoundComplete = function(){
_root.soundEnde = 1;
_root.stopanzeige = 1;
_root.anzeigeEnde = 1;
//_root.led._alpha = 100;
//_root.led2._alpha = 0;
}

};

gruß Bernte
Flashkonsole ist offline   Mit Zitat antworten
Alt 11-10-2004, 15:25   #2 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

ja meines erachtens ist die duration erst nach vollständigem laden ermittelbar.

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two ist offline   Mit Zitat antworten
Alt 11-10-2004, 16:59   #3 (permalink)
flashkonsole
 
Benutzerbild von Flashkonsole
 
Registriert seit: Sep 2003
Ort: Berlin
Beiträge: 59
und nun ????

wenns in der onSoundcomplete funktion auch nicht geht?
Flashkonsole ist offline   Mit Zitat antworten
Alt 12-10-2004, 09:04   #4 (permalink)
The Man Who Wasn't There
 
Benutzerbild von fraggle two
 
Registriert seit: Jul 2003
Ort: BÄRLIN
Beiträge: 1.156
hi,

hab gerade ein wenig in der hilfe(F1) gestöbert...

da wird auch mit der duration gearbeitet wärend der sound geladen wird...

sollte also doch funktionieren.

aber ich hab nen anderen fehler in deine interval-funktion gesehen:
ActionScript:
  1. //ist
  2. soundtime = setInterval(this, "playSound", 32000, element);
  3.  
  4. //soll
  5. soundtime = setInterval(playSound, 32000, element);

der funktionsname darf nicht in anführungsstriche!
und was sollte das this sein?

gruß
mike
__________________
Dot-Realities
Mike Broders
Berlin

ICQ:105925103

Dot-Realities v4.0 under construction!
fraggle two ist offline   Mit Zitat antworten
Alt 12-10-2004, 14:27   #5 (permalink)
flashkonsole
 
Benutzerbild von Flashkonsole
 
Registriert seit: Sep 2003
Ort: Berlin
Beiträge: 59
Fehler behoben...

es liegt nicht an den Anführungsstrichen.
Die sind pflicht wenn man intervalle in Classen definiert....
aber da war trotzdem der Fehler .... die Sooundclasse liegt auf root und ich habe den aufruf in meiner eiugenen klasse mit this geschrieben.....
habe es so gelöst wenns dich interessiert.

Game.prototype.soundTimer = function(element){

//Gleich zu Beginn der Zeit einmal Spielen
stopAllSounds();
//Soundelement abspielen
_root.mysound = new Sound();

_root.mysound.onLoad = function(success){

if(success){
//hier ist duration verfügbar
trace("sound wird geladen");
trace(this);
trace(element);
trace(_root.mysound.duration);
var laenge = _root.mysound.duration;
trace("laenge: " + laenge);

if(_root.mysound.duration >= 15000 && _root.mysound.duration < 20000){
soundtime = setInterval(_root.myGame, "playSound", 32000, element);
}
if(_root.mysound.duration >= 10000 && _root.mysound.duration < 15000){
soundtime = setInterval(_root.myGame, "playSound", 21000, element);
}
if(_root.mysound.duration >= 5000 && _root.mysound.duration < 10000){
soundtime = setInterval(_root.myGame, "playSound", 16000, element);
}
if(_root.mysound.duration > 0 && _root.mysound.duration < 5000){
soundtime = setInterval(_root.myGame, "playSound", 13000, element);
}

}
else{
trace("FEHLER BEIM LADEN");
}
}
_root.mysound.loadSound(element,true);
//eqaulizer abspielen
_root.quest.ant1.tippfl.equal.play();
_root.quest.ant2.tippfl.equal.play();
_root.quest.ant3.tippfl.equal.play();
_root.quest.ant4.tippfl.equal.play();
//eqaulizer anhalten
_root.mysound.onSoundComplete = function(){
_root.stopanzeige = 1;
}


};

trotzdem Danke für die Mühe.....
Flashkonsole ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 02:48 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele