Play action only once

Hi I’m very new to Corona and come from a design background. I’m using a program called Kwisher, which I’m extremely happy with. I’ve run into a problem.

I need to run an action only once as I want an animation to start when dragging an object, the problem is the action keeps sending the command to start as I drag the object and this keeps making the animation go back to the start position and therefore only looks like it’s playing when the drag has stopped.

This is my code, could someone tell me please the correct code to send the ‘play action’ just once

Thank you very much in advance.

Daren

 
       – Actions (functions)
       function act_playbrain(event)
           path_brn2()
           path_brn()
           path_brn4()
           path_brn6()
           path_brn7()
           path_brn8()
           path_brn9()
           path_brn10()
       end

 
      --End Actions (functions)

 
       – Drag objects
       MultiTouch.activate( hook, “move”, “single” , { xBounds = { 20, 1400}, yBounds = { 500, 600} } )
       local function hookDrag (event )
          local t = event.target
          if event.phase == “moved” then  
               act_playbrain()  
          elseif event.phase == “ended” then  
          end  
          return true
       end
       hook:addEventListener( MultiTouch.MULTITOUCH_EVENT, hookDrag )

[lua]

local dragging = false

function act_playbrain(event)

           path_brn2()

           path_brn()

           path_brn4()

           path_brn6()

           path_brn7()

           path_brn8()

           path_brn9()

           path_brn10()

end

      --End Actions (functions)

       – Drag objects

MultiTouch.activate( hook, “move”, “single” , { xBounds = { 20, 1400}, yBounds = { 500, 600} } )

local function hookDrag (event )

    local t = event.target

    if event.phase == “moved” and dragging == false then

        dragging = true

        act_playbrain()

    elseif event.phase == “ended” then

        dragging = false

    end

    return true

end

hook:addEventListener( MultiTouch.MULTITOUCH_EVENT, hookDrag )

[/lua]

Wow, Nick, Otter studios

Thank you so much I’ve spent nearly two days trying to figure this out! that worked stratight away.

I’m an illustrator / designer and I admit code does n’t come easy (lots of flash and AS2 but AS3 went up a level I struggled with)

Anyway, I feel that the help given to me seems a bit one sided so anyone needing design / character design help post and I’ll help if I can. (I’ll check the forums daily)

Again Nick Thank you

Daren

[lua]

local dragging = false

function act_playbrain(event)

           path_brn2()

           path_brn()

           path_brn4()

           path_brn6()

           path_brn7()

           path_brn8()

           path_brn9()

           path_brn10()

end

      --End Actions (functions)

       – Drag objects

MultiTouch.activate( hook, “move”, “single” , { xBounds = { 20, 1400}, yBounds = { 500, 600} } )

local function hookDrag (event )

    local t = event.target

    if event.phase == “moved” and dragging == false then

        dragging = true

        act_playbrain()

    elseif event.phase == “ended” then

        dragging = false

    end

    return true

end

hook:addEventListener( MultiTouch.MULTITOUCH_EVENT, hookDrag )

[/lua]

Wow, Nick, Otter studios

Thank you so much I’ve spent nearly two days trying to figure this out! that worked stratight away.

I’m an illustrator / designer and I admit code does n’t come easy (lots of flash and AS2 but AS3 went up a level I struggled with)

Anyway, I feel that the help given to me seems a bit one sided so anyone needing design / character design help post and I’ll help if I can. (I’ll check the forums daily)

Again Nick Thank you

Daren