Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to remove displayObject completely?
Started by maso Mar 27 2010 12:21 PM

- - - - -
4 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

maso

[GLOBAL: userInfoPane.html]
maso
  • Observer

  • 17 posts
  • Guests


code:
	local tile = display.newImage("my_image.png")
	print(tile)     <---- return something like "table: 0x475c70"
	tile.parent:remove(tile)
	print(tile)      <-----same as above "table: 0x475c70"

I think the displayObject "tile" is not really removed.
How can I remove the displayObject completely ?
uid: 5376 topic_id: 686 reply_id: 300686


[TOPIC: post.html]
#2

smartmike

[GLOBAL: userInfoPane.html]
smartmike
  • Observer

  • 20 posts
  • Guests

tile = nil

That should set it up for garbage collection, I think...
uid: 5708 topic_id: 686 reply_id: 1372


[TOPIC: post.html]
#3

maso

[GLOBAL: userInfoPane.html]
maso
  • Observer

  • 17 posts
  • Guests

set object to nil or null

I have try it before, because it works for Flash Lite/ Flash , but not Corona. :(

It will got runtime error message in Corona terminal.

uid: 5376 topic_id: 686 reply_id: 1374


[TOPIC: post.html]
#4

carlos m. icaza

[GLOBAL: userInfoPane.html]
carlos m. icaza
  • Corona Geek

  • 2,992 posts
  • Alumni

once you set it to nil, don't reference it anymore.
meaning, don't do

print(tile) <-----

C
uid: 24 topic_id: 686 reply_id: 1378


[TOPIC: post.html]
#5

maso

[GLOBAL: userInfoPane.html]
maso
  • Observer

  • 17 posts
  • Guests

Thanks
uid: 5376 topic_id: 686 reply_id: 1385



[topic_controls]
[/topic_controls]