Getting the position of an object in a group

Is there a way to find in which position an object is located in a group?

For example, I would like to find the position of object named “canvas” into group “menuGroup”

tx! [import]uid: 4883 topic_id: 18282 reply_id: 318282[/import]

print(menuGroup[1].x, " ", menuGroup[1].y)

You need to know which object insert first or second …
[import]uid: 86417 topic_id: 18282 reply_id: 70055[/import]

Sorry if I was not clear. I need to know the position of object “canvas” in the “menuGroup” table… [import]uid: 4883 topic_id: 18282 reply_id: 70074[/import]

object.x and object.y is the x/y position of “object” in its parent group. [import]uid: 52430 topic_id: 18282 reply_id: 70115[/import]

I believe d3mac123 is asking this:

menuGroup[x] = canvas

where x = is the number d3mac123 is looking for.

If groups acted just like tables it might be as simple as using table.indexOf(menuGroup,canvas), but it isn’t (right?).

So maybe try this:

  
canvas.name = "canvas" --create a way to identifiy canvas within group, here via .name  
  
local p = 0 --variable to hold position information  
  
for i = 1,menuGroup.numChildren do  
 if menuGroup[i].name == "canvas" then  
 p = i  
 end  
end  
  

“p” should then hold the index value of canvas within menuGroup

ref: http://developer.anscamobile.com/content/display-objects#Groups [import]uid: 64596 topic_id: 18282 reply_id: 70116[/import]