-how do i get the label of my button to change when it is pressed
-i.e i want the label of the button (the current label is “move eye” ) to change to “move back” when the button has beened pressed; and then when the user presses the button again the label goes back to “move eye”;
and then when pressed again it becomes “move back” again and so on…
-also can i make it so that when the user clicks the button (which triggers an object transition event) the button cant be pressed again until either half the transition is over and the other buttons on the screen cant be pressed at all during the *‘whole’; the transition event is in 2 parts so when the button is clicked the image moves and the when the button is pressed again the image moves back
i.e the button is presses, the image moves (and while it is moving the user cant press any buttons while this is happening) and then the user can press the button again and the image moves back to its origin, after which the other buttons on the screen can be pressed.
*note: ‘whole’ transition meaning, the transition when the button is pressed 1st time and the object moves and then the button is pressed again and the object goes back to its origin
here is the code i have so far below:
sorry for being long winded but thats as short as i could think of writing it
answer ASAP plesae & thanks
[lua]local rightEyeCover = display.newImage( “eyecoverright.png”, left, top, isFullResolution )
rightEyeCover:translate( 620, -30)
rightEyeCoverMovement = 1
local function event1(event)
if rightEyeCoverMovement == 1 then
local function finishMove1()
rightEyeCoverMovement = 2
end
rightEyeCoverMovement = 3
transition.to(rightEyeCover, {time = 2000, x = -350, delta=true, transition=easing.outQuad, onComplete=finishMove1 })
end
if rightEyeCoverMovement == 2 then
local function finishMove2()
rightEyeCoverMovement = 1
end
rightEyeCoverMovement = 3
transition.to(rightEyeCover, {time = 2000, x = 350, delta=true, transition=easing.outQuad, onComplete=finishMove2 })
end
end
local button = widget.newButton{
label = “move eye”,
fontSize = 30,
width = 640,
height = 90,
left = 0,
top = 355,
onPress=event1
}
[/lua]
