Hello
I have 2 questions;
- If I have a simple function being called by a “tap” eventlistener such as below:
function myTapListener1( event )
print( "object tapped = "…tostring(event.target) )
print(currentscore)
–now kick off another Function
end
But then after that functions complete, I want to execute another function , how do I do it? For example, I have another function triggered when I tap an object which kicks off startGame function:
GO:addEventListener( “tap”, startGame )
Essentially I want it to start everytime function myTapListener1 ends.
- How do I get the string value from one object in grouped objects, say I have:
num1 = display.newText( RandNum, x, y, native.systemFont, 50 )
num2 = display.newText( RandNum, x, y, native.systemFont, 50 )
num3 = display.newText( RandNum, x, y, native.systemFont, 50 )
Then add it to a group:
numGroup:insert(num1)
numGroup:insert(num2)
numGroup:insert(num3)
From here if I click num1 for example and want the value from num1 which is part of numGroup, I have tried
print(numGroup) but no luck. Also tried numGroup.text.
Obviously print(num1) shows me the value.
Although using an event listener does work for all the objects within the group
numGroup:addEventListener( “tap”, counter)
It just doesn’t get the value from within it, even if I do tonumber(numGroup)
Thanks in advance!