Hi there,
I am new to the SDK I am having trouble getting a car image contained in a group to display to screen, when I move it to another group called garage. It displays on the screen when I first create the group in the createCar function below, but as I click on the car the buttonListener function is triggered and when the code reaches the line garage:insert(x) the car image is removed from the screen. Although, if I click in the space where the car was the listener still fires.
How can I get objects stored in the garage group to display to the screen
Please see my simplified code below:
[code]
local garage = display.newGroup()
local buttonListener = function( event )
print(“in listener”)
local x = event.target
garage:insert(x)
end
function createCar()
local group = display.newGroup()
local carOriginal = display.newImage(“car_blue.png”)
group:insert( carOriginal, true )
group.x = 100
group.y = 100
group:addEventListener( “tap”, buttonListener )
end
createCar()
[/code] [import]uid: 9512 topic_id: 2639 reply_id: 302639[/import]