Sure, here you go 
[code]module(…, package.seeall)
function new()
local localGroup = display.newGroup()
– Function –
local function onTouch( event )
local t = event.target
local phase = event.phase
if “began” == phase then
– Make target the top-most object
local parent = t.parent
parent:insert( t )
display.getCurrentStage():setFocus( t )
– Spurious events can be sent to the target, e.g. the user presses
– elsewhere on the screen and then moves the finger over the target.
– To prevent this, we add this flag. Only when it’s true will “move”
– events be sent to the target.
t.isFocus = true
– Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y
elseif t.isFocus then
if “moved” == phase then
– Make object move (we subtract t.x0,t.y0 so that moves are
– relative to initial grab point, rather than object “snapping”).
t.x = event.x - t.x0
t.y = event.y - t.y0
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false
end
end
– Important to return true. This tells the system that the event
– should not be propagated to listeners of any objects underneath.
return true
end
local function physicsStart (event)
if “began” == event.phase then
physics.start()
transparentball:removeEventListener( “touch”, onTouch )
end
end
– Handler that gets notified when the alert closes
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
– Go to next level
director:changeScene(“level02”)
elseif 2 == i then
– Quit level if “Quit” (the 2nd button) was clicked
director:changeScene(“menu”)
end
end
end
local function winCondition(event)
– if transparentball.currentFrame == 3 then
if event.other.myName == “portal” then
physics.pause()
– Show alert with two buttons
local alert = native.showAlert( “Well Done!”, “Continue to the next level!”, { “Next Level”, “Quit” }, onComplete )
end
– end
end
transparentball:addEventListener(“collision”, winCondition)
startbutton:addEventListener(“touch”, physicsStart)
transparentball.myName = “transparentball”
yellow.myName = “yellow”
portal.myName = “portal”
localGroup:insert(background1)
localGroup:insert(instruction)
localGroup:insert(ground)
localGroup:insert(transparentball)
localGroup:insert(portal)
localGroup:insert(orange)
localGroup:insert(yellow)
localGroup:insert(btn1)
localGroup:insert(startbutton)
myNameTable {}
myNameTable[1] = transparentball.myName = “transparentball”
myNameTable[2] = yellow.myName = “yellow”
myNameTable[3] = portal.myName = “portal”
functionTable = {}
functionTable[1] = onTouch,
functionTable[2] = physicsStart,
functionTable[3] = onComplete,
functionTable[4] = winCondition
localGroupTable = {}
localGroupTable[1] = localGroup:insert(background1)
localGroupTable[2] = localGroup:insert(instruction)
localGroupTable[3] = localGroup:insert(ground)
localGroupTable[4] = localGroup:insert(transparentball)
localGroupTable[5] = localGroup:insert(portal)
localGroupTable[6] = localGroup:insert(orange)
localGroupTable[7] = localGroup:insert(yellow)
localGroupTable[8] = localGroup:insert(btn1)
localGroupTable[9] = localGroup:insert(startbutton)[/code]
I know I need to create my functions before I include them in the tables however is the same true for my localGroupTable and myNameTable? [import]uid: 90223 topic_id: 16906 reply_id: 63758[/import]