Afternoon,
I have a question about orientation, actually probably more then one.
First question: How can you tell what orientation the device is currently at?
Second Question: I want my stages to “disassemble” and “reassemble” whenever a person changes their orientation. So right now I have an orientation listener (code to come) that gets rid of everything on the stage and calls the function to display it all again. However, this doesn’t seem to work (pretty sure I have some infinite recursion going on but I am unable to figure out why)
[lua]
local function levelFour()
local fourGroup = display.newGroup()
– some code that displays what I want to display
local function change(event)
fourGroup:removeSelf()
fourGroup = nil
levelFour()
end
Runtime:addEventListener(“orientation”, change)
end
[/lua]
What am I missing here? The stages themselves are fairly simple ( they are pretty much just buttons and a few other things ) so the amount of time it takes to build the stage is generally < 1 second on a device, so I figured destroying the stage and rebuilding it would be simpler than just moving everything.