Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Using Screens
Started by werdinteractive Feb 19 2010 02:21 AM

- - - - -
3 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

werdinteractive

[GLOBAL: userInfoPane.html]
werdinteractive
  • Enthusiast

  • 76 posts
  • Corona SDK

I realize that this is a pretty basic question, but could someone help me out. I have some code working that has multiple screens that are stacked on top of one another, but cannot seem to remove them on a button press. I would be happy if I could get a button to delete the group that it is in. From there I could make it take out the complete screen.

--Here is a piece of my current code that has been simplified to illustrate what I am doing

-- The Buttons Function
local MainMenuReturnF = function()
Backbtn = OptionsGroup.Backbtn
Backbtn.parent:remove( Backbtn )
OptionsGroup.Backbtn = nil
end

-- The Button
Backbtn = ui.newButton{default="ButtonNormal.png", rollover="ButtonPressed.png", onRelease=MainMenuReturnF , x = 300, y = 240}
uid: 4871 topic_id: 522 reply_id: 300522


[TOPIC: post.html]
#2

carlos m. icaza

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

  • 2,992 posts
  • Alumni

you want to remove the screen or just move it out of the stacking order?

you can always set its visibility to false.

c
uid: 24 topic_id: 522 reply_id: 1020


[TOPIC: post.html]
#3

werdinteractive

[GLOBAL: userInfoPane.html]
werdinteractive
  • Enthusiast

  • 76 posts
  • Corona SDK

I currently have everything set up so that when I button is pressed the contents of the next screen are created and displayed above the current screen. I wanted to remove the previous screen so that I am not allowing the user to stack multiple screens on top of each other and was wanting to know what the most effective way of doing this would be. Simply hiding the unused screens seems like it would allow them to stack on top of one another and use up a great deal of memory if there where many graphical elements. Should I be creating everything at the beginning and use the buttons to hide and reveal these graphics or was my assumption about the need to remove them wrong?
uid: 4871 topic_id: 522 reply_id: 1040


[TOPIC: post.html]
#4

carlos m. icaza

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

  • 2,992 posts
  • Alumni

i have created all groups at once but there is a hit on startup if there are a lot of items.

then i did them on demand, when a user hits a button load the images into a group, and delete the the previous group.

one way to do so is by calling or creating a function like such

function removeScreen(screen)
screen.parent:remove(screen);
end
Hope this works

Carlos


uid: 24 topic_id: 522 reply_id: 1047



[topic_controls]
[/topic_controls]