Problem with flipping / mirroring

Hi! Programming is very new to me. I have been learning the basics and just ran into a problem that I’m unable to solve. I’m trying to flip a character horizontally according to where the user taps. Here is my newbie code:

[code]
local character = display.newImage( “character.png”, 50, 600 )

local TouchBackground = function (event)

if event.x < character.x and character.xScale == 1 then
character:scale(-1, 1); – flip character
end

if event.x > character.x and character.xScale == -1 then
character:scale(1, 1); – flip flip character
end

end

Runtime:addEventListener( “touch”, TouchBackground )

[code]

At the moment my code flips the character only once. Any ideas what the problem is? Any help is appreciated. [import]uid: 13507 topic_id: 5155 reply_id: 305155[/import]

just use the same command with the same parameters…ie…

character:scale(-1, 1); – flip character

character:scale(-1, 1); – flip character back [import]uid: 10332 topic_id: 5155 reply_id: 17090[/import]

Great! Thank you for helping! [import]uid: 13507 topic_id: 5155 reply_id: 17094[/import]