Ex astris scientia

ActionScript

vanish()

by Phil on Jul.01, 2007, under ActionScript, Praxissemester

ActionScript code snipe

In den letzten paar Wochen habe ich recht viel mit ActionScript gemacht. Da ich irgendwie versucht habe alles schön Objektorientiert zu coden — man ist ja jung und voller Ideale — ist es mir das nervige aufräumen von MovieClips unangenehm aufgestoßen. Da die Funktion removeMovieClip() keinen Rückgabewert liefert, konnte ich kein gescheites Errorhandling durchführen. Die Lösung, naja zumindest für meine Zwecke, ist die folgene nette kleine Funktion:

MovieClip.prototype.vanish = function():Boolean {
	this.removeMovieClip();
		if(this._target != undefined){
			return false;
		} else {
			return true;
		}
	}

Ob es jetzt gut oder schlecht ist sei dahin gestellt, aber es funktioniert. leider geht _root.vanish() nicht. :D

1 Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...