# Random Sparkles/Bubbles That Follow Path

**URL:** https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788
**Category:** flash
**Created:** [June 9, 2008, 9:17pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788 "2008-06-09T21:17:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![toddgihring](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@toddgihring](https://forum.kirupa.com/u/toddgihring)
#### Post date: [June 9, 2008, 9:17pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/1 "2008-06-09T21:17:03Z")

</div>

Hi,

I am trying to get a presentation finished where my boss want to have random sparkles/bubbles loosly follow a path in a circular motion. The idea is “Information into Funnel - Out - and Re-Fed into Funnel”

I’ve tried duplicating movies on a motion, but they all start and stop at the same time, or the sparkles move at the same rate.

I’ve found some very helpful code on this site, and have included my attempts to use this forums code, without much success.

My attemps can be viewed or downloaded through the following links:  
all Links: [http://tgihring.weebly.com/random-bubbles.html](http://tgihring.weebly.com/random-bubbles.html)

The Rough Layout that this fits into:  
SFW: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/cglc\_organ\_wireframe\_example\_scene\_1.swf](http://tgihring.weebly.com/uploads/6/9/6/1/696114/cglc_organ_wireframe_example_scene_1.swf)  
FLA: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/cglc\_organ\_wireframe\_example.fla](http://tgihring.weebly.com/uploads/6/9/6/1/696114/cglc_organ_wireframe_example.fla)

An example of what the sparkles should kindof look like:  
SWF: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/snow3\_scene\_1.swf](http://tgihring.weebly.com/uploads/6/9/6/1/696114/snow3_scene_1.swf)  
FLA: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/snow3.fla](http://tgihring.weebly.com/uploads/6/9/6/1/696114/snow3.fla)

Another Code Example (random speed):  
SWF: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/bublles\_scene\_1.swf](http://tgihring.weebly.com/uploads/6/9/6/1/696114/bublles_scene_1.swf)  
FLA: [http://tgihring.weebly.com/uploads/6/9/6/1/696114/bublles.fla](http://tgihring.weebly.com/uploads/6/9/6/1/696114/bublles.fla)

Any help would be greatly appriciated.  
Thanks

---

<div class="post-metadata">

### Author: ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)
#### Post date: [June 10, 2008, 9:44am UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/2 "2008-06-10T09:44:43Z")

</div>

the links don’t work

I get tierd of “hey my boss is paying me to do something can you do it for me?”

NO;P

I can’t begin to think how to do random speed random positioning around a circle

---

<div class="post-metadata">

### Author: ![toddgihring](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@toddgihring](https://forum.kirupa.com/u/toddgihring)
#### Post date: [June 10, 2008, 2:35pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/3 "2008-06-10T14:35:35Z")

</div>

Sorry,

I thought that most of us have jobs actionscripting, and that we come together in this community to help each other out with our specific problems. If you are not employed creating Flash projects, I am sorry, and I do understand your frustration.

The links do work BTW.

---

<div class="post-metadata">

### Author: ![neilmmm](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@neilmmm](https://forum.kirupa.com/u/neilmmm)
#### Post date: [June 10, 2008, 8:02pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/4 "2008-06-10T20:02:27Z")

</div>

perhaps something like this will get you started

it needs a bit of a wobble to the movement and could do with some switches

it works by hitTesting a guide with an alpha of 0

see fla

```auto
var bubbleSpeed:Number;
var directionNum:Number;
function moveBubble() {
 if (this.directionNum == 0) {
  this._y -= this.bubbleSpeed;
 }
 if (this.directionNum == 1) {
  this._x -= this.bubbleSpeed;
 }
 if (this.directionNum == 2) {
  this._y += this.bubbleSpeed;
 }
 if (this.directionNum == 3) {
  this._x += this.bubbleSpeed;
 }
 if (guide_mc.hitTest(this._x, this._y, true)) {
  if (this.directionNum == 0) {
   this._y += this.bubbleSpeed;
  }
  if (this.directionNum == 1) {
   this._x += this.bubbleSpeed;
  }
  if (this.directionNum == 2) {
   this._y -= this.bubbleSpeed;
  }
  if (this.directionNum == 3) {
   this._x -= this.bubbleSpeed;
  }
  this.directionNum++;
  if (this.directionNum == 4) {
   this.directionNum = 0;
  }
 }
}
for (i=0; i<30; i++) {
 var b:MovieClip = this.attachMovie("bubble_mc", "bubble_mc"+i, this.getNextHighestDepth());
 b.bubbleSpeed = (Math.random()*6)+0.5;
 b.directionNum = Math.floor(Math.random()*4);
 b._alpha = (Math.random()*80)+20;
 b._xscale = b._yscale=(Math.floor(Math.random()*50))+50;
 b._x = (Math.floor(Math.random()*220))+120;
 b._y = (Math.floor(Math.random()*220))+120;
 b.onEnterFrame = moveBubble;
}

```

---

<div class="post-metadata">

### Author: ![toddgihring](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@toddgihring](https://forum.kirupa.com/u/toddgihring)
#### Post date: [June 11, 2008, 2:27pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/5 "2008-06-11T14:27:06Z")

</div>

That is PERFECT!!!

Thanks so much. I’ll post a link when i finish the project at the end of this week.

---

<div class="post-metadata">

### Author: ![neilmmm](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@neilmmm](https://forum.kirupa.com/u/neilmmm)
#### Post date: [June 11, 2008, 9:23pm UTC](https://forum.kirupa.com/t/random-sparkles-bubbles-that-follow-path/262788/6 "2008-06-11T21:23:39Z")

</div>

yw
