|
|
|
Flash Scripte
Tipp: Diese Scripte sollten nur genutzt werden,
wenn man Erfahrung mit Flash hat!
Zum Erstellen der Flash Dateien muss lokal auf dem PC
Flash MX installiert sein!
Wand dynamisch zeichnen
/* Methode: drawRect
* Beschr.: Zeichnet ein Rechteck
* @param x. Linke obere X-Kante des Rechtecks
* @param y. Linke obere Y-Kante des Rechtecks
* @param breite. Breite des Rechtecks
* @param hoehe. Höhe des Rechtecks
* @param farbe. Farbe des Rechtecks (zB. 0xFF0000 für rot)
*/
MovieClip.prototype.drawRect = function(x, y, breite, hoehe, farbe)
{
with(this)
{
beginFill(farbe, 100);
lineStyle(1, 0x000000, 100);
moveTo(x, y); // obere linke Ecke
lineTo(x + breite, y); // obere rechte Ecke
lineTo(x + breite, y + hoehe); // untere rechte Ecke
lineTo(x, y + hoehe); // untere linke Ecke
lineTo(x, y); // obere linke Ecke
endFill();
}
};
/* Methode: drawWall
* Beschr.: Zeichnet eine Mauer
* Bemerkung: Ruft die Methode drawRect auf
* @param x, y, b, h, f; Analog zur Methode drawRect
* @param anzHor; Anzahl der horizontalen Steine
* @param anzVer; Anzahl der vertikalen Steine
* @param abstand; Abstand zwischen den Steinen
*/
MovieClip.prototype.drawWall = function(x, y, b, h, f, anzHor, anzVer, abstand)
{
for(var i = 0; i < anzVer; i++)
{
/* Einrückung einstellen. Bei geraden i keine Einrückung, da i * 0. */
var space = (i % 2) * b/2 + x;
for(var j = 0; j < anzHor; j++)
{
this.drawRect(space, y, b, h, f);
space = space + b + abstand;
}
y = y + h + abstand;
}
}; |
|
Einfacher Soundplayer
var soundAn = false;
on_mc._alpha = 30;
// Sound-Objekt erstellen.
var sound_obj = new Sound(this);
/* Der Verknüpfungsname, der dem Sound in der Bibliothek
zugeordnet wurde,
wird als Argument der Methode attachSound übergeben. */
sound_obj.attachSound("hobbit" );
//==================================
// Schaltflächen zum Starten und Stoppen des Sounds
//==================================
// Play
play_btn.onRelease = function()
{
// Wenn die Musik nicht schon läuft, spiel sie ab.
if (soundAn == false)
{
/* Methode start(para1, para2);
* para1: Ab welcher Stelle im Sound gestartet werden
soll (in sec)
* para2: Anzahl der Wiederholungen. */
sound_obj.start(7, 1);
soundAn = true;
// on- und off_mc anpassen
on_mc._alpha = 100;
off_mc._alpha = 30;
} // if
};
// Stop
stop_btn.onRelease = function()
{
// wenn die Musik läuft, mach sie aus
if (soundAn == true)
{
sound_obj.stop();
soundAn = false;
// on- und off_mc anpassen
on_mc._alpha = 30;
off_mc._alpha = 100;
} // if
}; |
|
Transparenter Übergang von 2 Bildern
mcB._alpha = 0; // mcB wird anfangs unsichtbar gemacht
var speed = 4; // Legt die Geschwindigkeit des Transparenz-Effektes fest
btn.onRelease = function()
{
this._parent.onEnterFrame = function()
{
mcA._alpha -= this.speed;
mcB._alpha += this.speed;
if(mcA._alpha <= 0 && mcB._alpha >= 100)
{
mcA._alpha = 0;
mcB._alpha = 100;
delete this.onEnterFrame;
}
};
}; |
|
... weitere folgen!
|
|
|
|
|
|
|
|
|
|
|
|