How can I move an object with audio?

I need a little bit more help, please…

I am this close to make it work I just don’t get the

#values

please help me out

Thanks in advance

I don’t know what ‘h’ is from your original example, but you need to pass that in as I’ve been showing:

moveIndicator( h, song1 )

Thank you… I kept thinking and thinking…

I got it!!!

The problem was in two different names…

You put “values” inside the parenthesis, and also “values” and the loop for i – #values

and also inside the transition { + values[i] }

local function moveIndicator( h, values )    tempo = (totalTime/16) - (40)    for i = 1, #values do       transition.to( h, { x = display.contentCenterX + values[i], time = 0, delay = tempo \* i } )    end end

but when you call the function, you put song1 – ( h, song1 )

( h is just the rectangle to move )

local song1 = { -400, -300, -250, -128 -100, -86, -10, 10, 52, 85, 150, 200, 250, 328, 400, 500 } moveIndicator( h, song1 )

So song1 and values should be the same…

i change that to only 1 variable

values = { -400, -300, -250, -128 -100, -86, -10, 10, 52, 85, 150, 200, 250, 328, 400, 500 }     function moveIndicator( h, values )    tempo = (totalTime/16) - (40)    for i = 1, #values do       transition.to( h, { x = display.contentCenterX + values[i], time = 0, delay = tempo \* i } )    end end

moveIndicator( h, values )

And it works perfect…

I think you wanted me to say that all the information on the values table

was for the song1,

and another information for the song2 and so on

But i did not get it at first

Now thanks ti you it works really good

and I learn the “famous” “pass it to a function”

Thanks

roaminggamer