Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virt - that music display script... 1

Status
Not open for further replies.

wangbar

Programmer
Jul 23, 2001
1,906
GB
Sorry 'bout taking so long to send it but been REALLY busy...

Here's the set up - you need five tiny movieClips as your display (instance names "bar1" through "bar5") and a button that toggles between "music=true" and "music=false" - that's it, turn the whole thing, bars and button, into a clip and attach this:

onClipEvent (load) {
function randomise (value) {
return Math.floor(Math.random()*value)+1;
}
function live (mc) {
// go
clip = mc;
clip._y += randomise(9)-5;
if (clip._y>lower) {
clip._y = lower+1;
} else if (clip._y<upper) {
clip._y = upper-1;
}
}
function die (mc) {
// stop
clip = mc;
clip._y += (lower-clip._y)/10;
}
// variables
lower = this.bar1._y;
upper = this.bar1._y-20;
music = true;
// set up graphic
for (i=1; i<6; i++) {
this[&quot;bar&quot;+i]._y = -randomise(50);
}
}
onClipEvent (enterFrame) {
if (music) {
for (i=1; i<6; i++) {
mc = this[&quot;bar&quot;+i];
live(mc);
}
} else if (bar1 != lower) {
for (i=1; i<6; i++) {
mc = this[&quot;bar&quot;+i];
die(mc);
}
}
}


If it doesn't work let me know and I'll cut up the .fla.
 
your the man bro, thanks.....
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top