How to use custom property as a handler?

Hello

I have some groups objects in my game, each with a custom property

1
2
3
4
for _,arg in ipairs( arguments ) do
      local mygroup = display.newGroup();
      mygroup.id = arg.id       
end

Could you please explain what you mean by handler?

In my apps I'm adding all display objects to an app.sprites table, then grab a single sprite via selector functions like the following (but I don't know if this is related to what you're asking):

1
2
3
4
5
6
7
8
9
10
11
12
function appGetSpriteById(desiredId)
    local desiredSprite = nil
    if desiredId ~= nil then
        for id, sprite in pairs(app.sprites) do
            if desiredId == sprite.id then
                desiredSprite = sprite
                break
            end
        end
    end
    return desiredSprite
end
views:1598 update:2011/9/29 9:22:17
corona forums © 2003-2011