[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 583: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 639: sizeof(): Parameter must be an array or an object that implements Countable
Flash Tutorials bei TUTORIALS4FLASH.DE •Transparenz Movieclips & Buttons per Actionscript steuern
Seite 1 von 1

Transparenz Movieclips & Buttons per Actionscript steuern

Verfasst: Mi 13. Aug 2008, 16:39
von enbe
Hier mal ein Skript, daß ich bei http://www.proto.layer51.com/d.aspx?f=1211 ausgegraben habe, mit dem man sehr schön den Alphakanal (Transparenz) von Movieclips und Buttons langsam ein- und ausfaden kann. Die Geschwindigkeit kann im Skript angepasst werden.

So sieht es dann aus: (Mauszeiger auf das Viereck ziehen :idea: )

alpha_fade_per_actionscript.swf [1.42KiB |30417 mal betrachtet ]

Der Code hier kommt auf ein Keyframe auf der Hauptzeitleiste:

Code: Alles auswählen

// das hier ist der code für den alphatween, der code um das viereck transparent zu faden liegt auf dem viereck selbst...

MovieClip.prototype.alpha = function(vel, to) {
	this.vel = vel;
	this.to = to;
	this.alpha_init = this._alpha;
	this.onEnterFrame = function() {
		updateAfterEvent();
		if (this.to != undefined && this.vel != undefined) {
			if (this.to>this.alpha_init) {
				if (this._alpha<=100) {
					this._alpha += this.vel;
				} else {
					this.onEnterFrame = null;
				}
			} else {
				if (this._alpha>this.to) {
					this._alpha -= this.vel;
				} else {
					this.onEnterFrame = null;
				}
			}
		} else {
		}
	};
};
Hier ein Beispielcode, den man auf einen Button legen kann

Code: Alles auswählen

on (rollOver){
	alpha (10,50);
}
on (rollOut){
	alpha (10,100);
}

// Erklärung:
// 10 ist die geschwindigkeit des alpha tweens - weniger ist meh... ehmm langsamer.
// 50 bzw. 100 ist der wert der transparenz (0 = 0% = total transparent)
:butterung