Zweimal klicken bei Stop/Play-Button

knallbernd

Erfahrenes Mitglied
Ich hätt' mal 'ne Frage...
Und zwar hab' ich einen Stop/Play-Button der beim draufklicken einfach das Symbol ändert (liegt in einem MC).


Code:
stop();
  
  this.onPress = function() {
  	if (_root.isplaying) {
  		_root.stop();
  		this.gotoAndStop(2);
  	} else {
  		_root.play();
  		this.gotoAndStop(1);
  	}
  	_root.isplaying = !_root.isplaying;
  }

Der Code liegt nicht im Button, sondern in der Timeline des MC's (dieser liegt in der Hauptzeitleiste), in dem der Button liegt (in dieser Timeline springt er dann zwischen 1 und 2 hin- und -her).


das Problem ist, dass man oft zweimal draufklicken muss dass er stoppt.
Irgendjemand eine Idee warum das so ist?
 
Hast du das Skript in beide Bilder der MC-Timeline gelegt? wenn nicht, dann kanns ja nicht gehen.
 

Anhänge

  • switch.zip
    4,6 KB · Aufrufe: 42
Code:
stop();
_parent.playing = true;
this.onPress = function() {
	if (_parent.playing) {
		_parent.stop();
		this.gotoAndStop(2);
	} else {
		_parent.play();
		this.gotoAndStop(1);
	}
	_parent.playing = !_parent.playing;
}

... nicht die sauberste Lösung aber es funktioniert.
 

Neue Beiträge

Zurück