Wandering/floating MC's

Hey everyone… first time posting here, hope you all could help…

i’ve got 5 MC buttons i’ve made that are controlled by actions on frame 1 on the main timeline… they work perfectly… so no problems there,

thing is, i’d like to have them wobble / float within a certain area, and cannot really animate them by hand to do this, because the MC that makes up the button needs to be played out for the rollover/rollout… and the main stage timeline needs to be kept as need as possible…

anyway… i’ve found this site that has exactly what i’m looking for, but don’t know how to apply it to just one movieclip at a time…


in that example, flash spawns a bunch of instances of the particle out of the library…there’s code below…

all i’d like to do is use whatever code is making those particles hover and float in place, but i can’t seem to figure out how to attach it to each of my 5 MC buttons on stage…

any help would be greatly appreciated…

Thanks in advance!


pNumber =20;

// X  position:
var cx = 150; 
// y position:
var cy = 0; 
//x direction spread:
xspread =300;
// y direction spread:
yspread =300;
//scale number:
pscale =160;
//blendmode setup,you can change it to "hardlight"
pblend ="add";
//set loop
for (var i = 0; i<pNumber; i++) { 
    //attach the Movieclip from library with link ID "partical" 
    var mc = this.attachMovie("partical", "p"+i, i); 
    with (mc) { 
        _x = cx+Math.random()*xspread; 
        _y = cy+Math.random()*yspread; 
        _xscale = _yscale = pscale * Math.random()*5+10; 
    //blendMode setup 
    mc.blendMode = pblend; 
    mc.cacheAsBitmap = true; 
    mc.tx = random(360); 
    mc.ty = random(360); 
    mc.xtempo = Math.random()/8; 
    mc.ytempo = Math.random()/8; 
    mc.xd = Math.random()*10+1; 
    mc.yd = Math.random()*10+1; 
    mc.x0 = mc._x; 
    mc.y0 = mc._y; 
    mc.onEnterFrame = function() { 
        this.tx += this.xtempo; 
        this.ty += this.ytempo; 
        this._x = this.x0+Math.sin(this.tx)*this.xd; 
        this._y = this.y0+Math.cos(this.ty)*this.yd;