Is there a way to nil or remove storyboard.stage objects?

Hi, is there a way to remove objects when using storyboard.stage? 

For example : 

[lua]local scoreText1 = display.newText( “Hello World!”, 100, 200, native.systemFont, 16 )

local display_stage = display.getCurrentStage()
display_stage:insert( storyboard.stage )
display_stage:insert( scoreText1 )

– load title screen
storyboard.gotoScene( “mainMenu”, “fade” )
[/lua]

When I get to mainMenu scene I dont want to show the scoreText1 object. But in the other scenes that I made I want to show scoreText1 object. Is there a way to remove the scoreText1 object when using storyboard.stage? 

Shirley 

Hi Shirley,

How about making a reference (pointer) to that display object within the stage object, and then when necessary, just hide/remove that object?

Brent

Thank you. 

hi Brent,

 

It will be nice if you can recommend me some resources that can guide me to learn how to make a reference (pointer).

 

 

Thank you for your time. 

 

Shirley 

Hello Brent, 

If I do reference pointer will it be free from memory? 

Thanks 

Shirley 

Hi Shirley,

Are you new to Lua? Have you started with some basic guides and tutorials? This should be the first step, so you understand how Lua handles memory, upvalues, local vs. global, etc.

Brent

Yes I am kind of new to lua. I did a couple of simple app with corona SDK. I am new to programming, so some of the programming idiom I don’t understand. So I am searching what does reference pointer means. 

I studied the basic guides and some tutorials that corona lab has on their website. 

Thank you for your time. 

Shirley 

Hi Shirley,

Basically, by “reference”, it just means some variable that is assigned to keep track of the display object. In your first code block, you assign the text object to the local variable “scoreText1” which is perfectly valid. In that way, “scoreText1” becomes the local reference to that display object.

In case you need to access variables between different scenes, one good method is outlined in this tutorial:

http://coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

Hope this helps,

Brent

Thank you very much this helps! 

Shirley 

Hi Shirley,

How about making a reference (pointer) to that display object within the stage object, and then when necessary, just hide/remove that object?

Brent

Thank you. 

hi Brent,

 

It will be nice if you can recommend me some resources that can guide me to learn how to make a reference (pointer).

 

 

Thank you for your time. 

 

Shirley 

Hello Brent, 

If I do reference pointer will it be free from memory? 

Thanks 

Shirley 

Hi Shirley,

Are you new to Lua? Have you started with some basic guides and tutorials? This should be the first step, so you understand how Lua handles memory, upvalues, local vs. global, etc.

Brent

Yes I am kind of new to lua. I did a couple of simple app with corona SDK. I am new to programming, so some of the programming idiom I don’t understand. So I am searching what does reference pointer means. 

I studied the basic guides and some tutorials that corona lab has on their website. 

Thank you for your time. 

Shirley 

Hi Shirley,

Basically, by “reference”, it just means some variable that is assigned to keep track of the display object. In your first code block, you assign the text object to the local variable “scoreText1” which is perfectly valid. In that way, “scoreText1” becomes the local reference to that display object.

In case you need to access variables between different scenes, one good method is outlined in this tutorial:

http://coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

Hope this helps,

Brent

Thank you very much this helps! 

Shirley