_niels
Threadersteller
Dabei seit: 10.07.2002
Ort: Berlin
Alter: 44
Geschlecht:
|
Verfasst Mi 23.04.2003 08:57
Titel [CODE] - [F5/MX proto] - pause/resume mit child objects |
|
|
Hallo @ All
Das ganze hab ich gestern bereits im FF gepostet, desshalb hier mit Kurztext.
Ich hab das hier für ein CD-Rom Projekt gebraucht bei dem ich massiv viele verschachtelte Clips hatte die "minianimationen" enthielten. Das ganze Projekt sollte pausierbar sein. Ist für die Usability ja auch sehr praktisch. Das hier ist dann bei rausgekommen.
Viel Spass und Grüße aus Freiburg
hth
Niels
[BESCHREIBUNG]
Eigentlich sehr easy: Clip samt Childs mit Clip.pause(); anhalten und mit Clip.resume(); wieder anfahren. Das sollte eigentlich reichen. Hoffe ich hehe.
[ANMERKUNG]
Es sollte eigentlich sowohl unter F5 als auch unter MX gehen. Grobe Tests liefen gut durch. Da ich aus Zeitgründen noch nicht so wirklich tief in die "neuen MX Strukturen" geschaut habe will ichs aber nicht versprechen.
So. Ende des Romans.
Code: |
MovieClip.prototype._isPlaying = true;
MovieClip.prototype._isPaused = false;
//überschreiben der play methode
MovieClip.prototype.play2 = MovieClip.prototype.play;
MovieClip.prototype.play = function(){
if(!this._isPaused) this.play2();
this._isPlaying = true;
}
//überschreiben der stop methode
MovieClip.prototype.stop2 = MovieClip.prototype.stop;
MovieClip.prototype.stop = function(){
this.stop2();
this._isPlaying = false;
}
//überschreiben der gotoAndPlay methode
MovieClip.prototype.gotoAndPlay2 = MovieClip.prototype.gotoAndPlay;
MovieClip.prototype.gotoAndPlay = function(frame){
if(!this._isPaused) this.gotoAndPlay2(frame);
else this.gotoAndStop2(frame);
this._isPlaying = true;
}
//überschreiben der gotoAndStop methode
MovieClip.prototype.gotoAndStop2 = MovieClip.prototype.gotoAndStop;
MovieClip.prototype.gotoAndStop = function(frame){
this.gotoAndStop2(frame);
this._isPlaying = false;
}
//neue MC methoden: pause und resume
MovieClip.prototype.pause = function(){
this._isPaused = true;
this.stop2();
for(child in this) {
if(typeof(this[child]) == movieclip) {
if(this[child] != this) this[child].pause();
//debugg bzw. info output. Falls gewüscht auskommentieren
//else trace(this[child]);
}
}
}
MovieClip.prototype.resume = function(){
if(this._isPaused){
this._isPaused = false;
if(this._isPlaying) this.play2();
for(child in this) {
if(typeof(this[child]) == movieclip) {
if(this[child] != this) this[child].resume();
}
}
}
}
|
Zuletzt bearbeitet von _niels am Mi 23.04.2003 09:01, insgesamt 2-mal bearbeitet
|
|