Animations sometimes play, sometimes do not

I’ve got some animations that will sometimes play and other times will not play but I don’t get any errors.  I can’t figure out why and would appreciate any help please.  This is on the Corona Simulator on a mac.

My animation code is like this:


local temp_table = {}

local function pet_testpet_anim (i)

    --I initialize some other data in this function 

    local function pet_testpet_anim1 ()

        if reverse == 0 then

            reverse = 1

            transitionStash.test_shake = transition.to (pet[i].body, {rotation = -10, time = 200})

        else

            reverse = 0

            transitionStash.test_shake = transition.to (pet[i].body, {rotation = 10, time = 200})

        end

    end

    temp_table.otherdata = “otherdata”

    temp_table.animation1 = pet_testpet_anim1 

end

for i=1, 4 do

    pet_testpet_anim(i)

    pet[i].otherdata  = temp_table.otherdata

    pet[i].anim1 = timer.performWithDelay(250, temp_table.animation1, 0)

end


Can anyone help me solve this?

Thanks in advance,

Sincerely,

Duke