Objects in runtime function

Hello,

Does making display objects in Runtime functions spawns only one object on request, or its gonna do infinite numbers of them?
like that :
[lua]local function spawn()
if number == 1 then
local image = display.newImage(…)
end
end

Runtime:addEventListener(“enterFrame”, spawn)[/lua]

thanks in advance [import]uid: 16142 topic_id: 16374 reply_id: 316374[/import]

sorry for trouble, figured it out myself
so, another question then: how can i spawn just one object without removing listener? [import]uid: 16142 topic_id: 16374 reply_id: 61074[/import]

Give this a try.

[code]

local currentImages = 0
local maxImages = 1

local function spawn()

if currentImages <= maxImages then
local image = display.newImage(…)
currentImages = currentImages + 1
end

end

Runtime:addEventListener(“enterFrame”, spawn)

[/code] [import]uid: 5833 topic_id: 16374 reply_id: 61077[/import]