Question with onEnterFrame

I’m using a script for a graphic equalizer that initiates the equalizer with the onEnterFrame event handler.

The problem with this is that it plays the equalizer at the framerate of my movie witch is pretty high so the clip plays WAY to fast.

I’ve tried replacing this by turning the actions into a function and using setInterval to have it play every tenth of second or so. It looks great now but it is eating up my processer and was wondering if there was another way to approach this?

Any ideas???


here is my code if needed…

barboty=new Array(); //holds bottom of each line's _y registration point
randheight=new Array(); //holds randomly generated height of line
toppery=new Array(); //holds _y registration point of topper 
decfraction=new Array(); //holds the fraction of random height of line that will be used to decrement the line's height 
numbars=20; //defines number of lines
maxheight=8; //defines max height of line
minheight=1; //defines min height of line
gap=2; //defines distance between top of line and topper
topperdrop=.075; //defines value to decrement _y value of topper
numsteps=5; //defines number of steps to decrement height of line
// this function sets values for the heights of each line in the equalizer
function initbars() {
   for (i=1;i<_root.numbars+1;i+=1) { 
	  // set initial line height and position of topper
// this function will get executed at the playing frame rate of the movie, even if the movie is stopped 
//_root.onEnterFrame = function() { 
  //function barsMove () {
   function a () {
  for (j=1;j<_root.numbars+1;j+=1) { //set height of each line for each j in numbars
	if (_root.randheight[j]<=_root.minheight) { // if the line height is less than the min, then:
												// set line height to the min then redo the line heights etc
	  _root.initbars(); // the entire function initbars could be placed here if you like rather than being called.
	} else { //if not too short, decrement height of lines and position of topper
var barInt = setInterval (a, 100);