# Bubbles \[FMX\]

**URL:** <https://forum.kirupa.com/t/bubbles-fmx/14590>\
**Category:** flash\
**Created:** [February 28, 2003, 2:53am UTC](https://forum.kirupa.com/t/bubbles-fmx/14590 "2003-02-28T02:53:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madokan](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@Madokan](https://forum.kirupa.com/u/Madokan)\
**Post date:** [February 28, 2003, 2:53am UTC](https://forum.kirupa.com/t/bubbles-fmx/14590/1 "2003-02-28T02:53:03Z")

</div>

Hi Folks,

Looks like a place to be - great another fine flash-forum. Just some bubbles to play around!

```php

function setBubbles(obj, depth, xPos, yPos, maxNum, randHeight, randWidth, Height, Width) {
	this.createEmptyMovieClip(obj, depth);
	this[obj]._x = xPos;
	this[obj]._y = yPos;
	for (var i = 1; i <= maxNum; i++) {
		this[obj].attachMovie("blase", "blup" + i,depth + i);
		this[obj]["blup" + i].tempo = random(7) + 5;
		this[obj]["blup" + i].randVal = random(4);
		this[obj]["blup" + i].direction = -1;
		this[obj]["blup" + i].ZS = random(50) + 10;
		this[obj]["blup" + i]._xscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._yscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._y = random(randHeight);
		this[obj]["blup" + i]._x = random(randWidth);
		this[obj]["blup" + i].onEnterFrame = function() {
			this._y -= this.tempo;
			this._x -= this.randVal;
			this.randVal += this.direction;
			if (this._y <= 0) {
				this._y = Height;
				this.randVal = random(4);
				this.tempo = random(7) + 5;
				this.ZS = random(50) + 10;
			}
			if (this._x <= 0) {
				this._x = Width - this._width;
			}
			if (this._x >= Width) {
				this._x = 0 + this._width;
			}
			if (this.randVal < -3) {
				this.direction = +1;
			}
			if (this.randVal > 3) {
				this.direction = -1;
			}
		};
	}	
}

setBubbles("room", 1, 0, 0, 30, 400, 550, 400, 550);

```

Examples:  
[Aqualand](http://www.flashangel.de/mx/fsblasenv8mx.swf)  
[Three Rows](http://www.flashangel.de/mx/fsblasenv9mx.swf)

You need an mc with an linkage name!

Here a version with a flow parameter:

```php

function setBubbles(obj, depth, xPos, yPos, maxNum, randHeight, randWidth, Height, Width, Flow) {
	this.createEmptyMovieClip(obj, depth);
	this[obj]._x = xPos;
	this[obj]._y = yPos;
	for (var i = 1; i <= maxNum; i++) {
		this[obj].attachMovie("blase", "blup" + i,depth + i);
		this[obj]["blup" + i].tempo = random(7) + 5;
		this[obj]["blup" + i].randVal = random(4);
		this[obj]["blup" + i].direction = -1;
		this[obj]["blup" + i].ZS = random(50) + 10;
		this[obj]["blup" + i]._xscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._yscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._y = random(randHeight);
		this[obj]["blup" + i]._x = random(randWidth);
		this[obj]["blup" + i].onEnterFrame = function() {
			angle+=.635;
			this._y -= this.tempo;
			this._x -= this.randVal;
			 this.randVal=Math.sin(angle)*random(8)+Flow
			this.randVal += this.direction;
			if (this._y <= 0) {
				this._y = Height;				
				this.tempo = random(7) + 5;
				this.ZS = random(50) + 10;
			}
			if (this._x <= 0) {
				this._x = Width - this._width;
			}
			if (this._x >= Width) {
				this._x = 0 + this._width;
			}			
		};
	}	
}

setBubbles("room", 1, 0, 0, 30, 400, 550, 400, 550, -6);

```

yours  
Matze K.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 1, 2003, 2:59pm UTC](https://forum.kirupa.com/t/bubbles-fmx/14590/2 "2003-04-01T14:59:05Z")

</div>

nice bubbles, Madokan.

Do you have a step by step tutorial for making this?
