Move on button touch - just cant get it working

I am really finding the API on corona to be making the simple things hard.

I am simply trying to move an image along the X axis if i am pressing a button. It just will not work. I don’t know why such a simple thing is so hard to achieve in corona. I have been programming for 6 years in C and lua and i just cannot understand why doing something so simple has to be so cryptic with corona’s api.

So here is what I am doing… seems perfectly valid…

  
local ui = require("ui")  
local movieclip = require("movieclip")  
local physics = require( "physics" )  
physics.start()  
display.setStatusBar(display.HiddenStatusBar)  
  
-- # Load Images #  
local backGroundWorkshop = display.newImage( "images/Background.png" )  
  
local ground = display.newImage( "images/ground.png" )  
ground.x = 0; ground.y = 320; ground.myName = "ground"  
physics.addBody( ground, "static", { friction=0.5, bounce=0.0 } )  
  
test = movieclip.newAnim{ "images/test.png", "images/test2.png" }  
  
test.x = 50; test.y = 280; test.walking = false;  
  
local button1Press = function( event )  
 --t:setText( "Button 1 pressed" )  
 test.walking = true  
end  
  
if test.walking == true then  
 test.x = test.x + 1  
end  
  
local button1Release = function( event )  
 test.walking = false  
 --t:setText( "Button 1 released" )  
end  
local buttonHandler = function( event )  
 --t:setText( "id = " .. event.id .. ", phase = " .. event.phase )  
end  
-- This button has individual press and release functions  
-- (The label font defaults to native.systemFontBold if no font is specified)  
  
local button1 = ui.newButton{  
 default = "images/ButtonRight.png",  
 over = "images/ButtonRight.png",  
 onPress = button1Press,  
 onRelease = button1Release,  
 text = "",  
 emboss = true  
}  
  
button1.x = 160; button1.y = 160  
  

Help would be appreciated. [import]uid: 6981 topic_id: 2607 reply_id: 302607[/import]

Never mind solved my problem on my own. Had to add an event listener

Sorry if i seem bitter, it’s just frustrating waiting so long for a reply. Thanks anyway

Caio [import]uid: 6981 topic_id: 2607 reply_id: 7420[/import]

Zack, don’t overestimate Corona community. It’s still very small.
Expect feedback to your posts after some hours, depending on the topic. Mainly at about US afternoon/evening hours.

[import]uid: 7356 topic_id: 2607 reply_id: 7423[/import]