Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-08-2004, 16:24   #1 (permalink)
Sightgiver
 
Benutzerbild von Arator
 
Registriert seit: Aug 2001
Beiträge: 368
Bubbles oder Schnee

Hi!

Weil ich es grad gebaut hab dachte ich ich poste es. Vielleicht braucht ja jemand auch mal sowas.

Kann man für Schnee, Luftblasen und ähnliches verwenden.

Man braucht nur einen MC mit dem Namen go (verlinkt) in der Library.

Code:
_root.i = 1;
_root.onEnterFrame = function() {
	varianz = random(50);
	_root.attachMovie("go", "go"+_root.i, _root.i);
	_root["go"+_root.i]._x = random(350);
	_root["go"+_root.i]._y = 150;
	_root["go"+_root.i]._xscale = 30+varianz;
	_root["go"+_root.i]._yscale = 30+varianz;
	_root["go"+_root.i].speed = 2 + random (2);
	_root["go"+_root.i].onEnterFrame = function() {
		this._y = this._y-this.speed;
		//Damit es nicht ganz gerade runter/rauf fliegt wird es ab und zu leicht versetzt
		xmove = random(7);
		if (xmove == 1) {
			this._x++;
		} else if (xmove == 2) {
			this._x--;
		}
		if (this._y<-0) {
			this.stop();
			removeMovieClip(this);
		}
	};
	_root.i++;
};
Wenn das alles langsamer und nicht so oft kommen soll, müßte man noch einen Timer einbauen, damit das attachen nicht so oft geschieht.

Gruß
Arator
__________________
The issue is not whether you are paranoid. The issue is whether you are paranoid enough.

Geändert von Arator (16-08-2004 um 16:28 Uhr)
Arator ist offline   Mit Zitat antworten
Alt 16-08-2004, 16:33   #2 (permalink)
Sightgiver
 
Benutzerbild von Arator
 
Registriert seit: Aug 2001
Beiträge: 368
Mit Timer

Code:
_root.i = 1;
_root.timer = 0;
_root.onEnterFrame = function() {
	varianz = random(50);
	if (_root.timer == 0) {
		_root.attachMovie("go", "go"+_root.i, _root.i);
		_root["go"+_root.i]._x = random(350);
		_root["go"+_root.i]._y = 150;
		_root["go"+_root.i]._xscale = 30+varianz;
		_root["go"+_root.i]._yscale = 30+varianz;
		_root["go"+_root.i].speed = 2+random(2);
		_root["go"+_root.i].onEnterFrame = function() {
			this._y = this._y-this.speed;
			//Damit es nicht ganz gerade runter/rauf fliegt wird es ab und zu leicht versetzt
			xmove = random(7);
			if (xmove == 1) {
				this._x++;
			} else if (xmove == 2) {
				this._x--;
			}
			if (this._y<-0) {
				this.stop();
				removeMovieClip(this);
			}
		};
		_root.i++;
	}
	//Nur alle 10 Frames attachen
	if (_root.timer<10) {
		_root.timer++;
	} else {
		_root.timer = 0;
	}
};
__________________
The issue is not whether you are paranoid. The issue is whether you are paranoid enough.
Arator ist offline   Mit Zitat antworten
Alt 16-08-2004, 20:08   #3 (permalink)
muh
 
Benutzerbild von Janoscharlipp
 
Registriert seit: Apr 2002
Ort: Freiburg / Stuttgart
Beiträge: 4.338
ich würde den MC zwischenspeichern, dann geht es schneller.
ActionScript:
  1. onEnterFrame....
  2. var mc = _root["go"+_root.i];
  3. mc._x = ...;
Janoscharlipp ist offline   Mit Zitat antworten
Alt 16-08-2004, 20:11   #4 (permalink)
lernwillig
 
Benutzerbild von 23012
 
Registriert seit: Jan 2002
Ort: auf dem Land
Beiträge: 1.327
Cool! Wenn mal jemand Schneeflocken braucht. Vielleicht
kann man auch Schneetreiben von rechts nach links veranstalten,
wenn man das Prinzip etwas abwandelt. Oder die Größe/Farbe
variieren?
Gruss
23012
__________________
[TUTORIAL] Nahtlose Muster erstellen in Photoshop
23012 ist offline   Mit Zitat antworten
Alt 16-08-2004, 20:21   #5 (permalink)
Neuer User
 
Benutzerbild von reion
 
Registriert seit: Apr 2004
Ort: St. Florian
Beiträge: 459
http://www.flashtalk.at/tutorial/detail.php?tut=93
schneeflocken


http://www.flashtalk.at/tutorial/detail.php?tut=95
bubbles


__________________
www.reion.tk
---
*nastyBasty, *nonverbla, *miii, *specs2, *kikuchiro, *Tom(2), *Tarantoga, *Prist0r, *heidlbeer, *silentx, *socratez, *isildur, *mmgraphics, *tackle_zone, *raschu, *-+FleshMen 08+-, *guz3l, *Flashyrobin, *teddy86+, *Jasper99, *Don Krawallo, *pLan58+, Sly-Design+, *obscur+, *mxpro-filer+; P |SL, e621, destroy90210, Karsten572, simon ventura, tasovi, salami04, Mulitreiber, dat brot, boyi, rosco, gaspode, dirkgently, Sash^noob; / *X-Production, mika97, derBauer1234, strolchi04 \
reion ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 23:37 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele