displayGroups inside displayGroups

I'm struggling with how to check if a displayGroup exists inside another displayGroup.

In my work-in-progress I have envelopes moving along a conveyor belt. I'd like it so that the user can then touch and drag a new conveyor belt for the envelope to move on (similar to the line drawing examples just that in this case I'm using a an image inside a masked display group).

I've worked out how to insert displayGroups into a table (note: the following doesn't include masking):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local mainGroup = {}
for i=1, 3 do
  mainGroup[i] = display.newGroup()
  mainGroup[i].name = ("group"..i)
  display.newImage(mainGroup[i], "conveyor.png")
end
 
 for i=1, #mainGroup do
  local tester = mainGroup[i]
  if (tester.name == "group1") then
    print "Exists"
  else
    print "Nope"
  end
end
views:2190 update:2011/9/26 15:43:22
corona forums © 2003-2011