Realize the visuals before fire listeners in Object:create() lime-object.lua ?

In lime-object.lua in Object:create(), the object and property listeners are fired before the actual display-objects are created, which results in the fact that the handlers cannot work with the actual object.sprite. The original code reads:

[lua]— Creates the visual debug representation of the Object.
function Object:create()

self.map:fireObjectListener(self)

for key, value in pairs(self.properties) do
self.map:firePropertyListener(self.properties[key], “object”, self)
end

– If an object has a GID then it is one of the new TileObjects brought into Tiled version 0.6.0
if self:hasProperty(“gid”) then

end
end[/lua]

By changing the order around and first realizing the visuals, the handlers have access to the sprites and such, like:

[lua]— Creates the visual debug representation of the Object.
function Object:create()

– If an object has a GID then it is one of the new TileObjects brought into Tiled version 0.6.0
if self:hasProperty(“gid”) then

end

self.map:fireObjectListener(self)

for key, value in pairs(self.properties) do
self.map:firePropertyListener(self.properties[key], “object”, self)
end

end[/lua]

Hope the snippets are clear. The … indicates code that I discarded for the snippet for clarity.

I had to do this to make my tile-object button work - hopefully I didn’t break anything in the process.

-FrankS.
[import]uid: 8093 topic_id: 6802 reply_id: 306802[/import]

Whoops, silly mistake there by me. Sorry about the issues that caused and thanks for the fix! [import]uid: 5833 topic_id: 6802 reply_id: 23753[/import]