Hi,
Maybe I am approaching this from the C* side of things.
I am trying to check if an object exists or not and then remove it to replace it with a new object.
CASE A:
if not theItem == nill then
theItem:removeSelf
end
CASE B:
if theItem == nill then
theItem:removeSelf
end
In either case the code between the if is not executed, so I take it that you cannot check for nil, so I tried
print(theItem.numChildren)
this prints nil so I take it that it works only for groups
then, I tried to tag them using myName, but I cannot compare a nil value either
What I am really trying to do in objective-C is
[theItem setImage:[UIImage imageNamed:@“somepic.png”]];
so as not to find an equivalent, I am approaching it as
theItem:removeSelf()
theItem = display.addNewImage(“somepic.png”)
coz, if I do not remove theItem, I get another element, so are the variable not a pointer or a reference to the object? How can I ensure that the variable points to only 1 object and after I remove it, I can check with nil that it has been removed?
cheers,
Jayant C Varma [import]uid: 3826 topic_id: 3440 reply_id: 303440[/import]