Hi all!
I'm having a issue with the Gideros Scene Manager.
Everytime I click the button that has the listener for changing scenes, it doesn't use the transition that I put down, it just transitions regulary.
Here are my files:
main.lua
sceneManager = SceneManager.new({
["loadmain"] = loadmain,
["login"] = login,
["mainmenu"] = mainmenu,
["createEvent"] = createEvent,
["Party"] = Party,
["Vacation"] = Vacation,
["Other"] = Other,
["ViewEdit"] = ViewEdit,
["Settings"] = Settings,
["Help"] = Help,
["FAQ"] = FAQ,
["About"] = About,
})
stage:addChild(sceneManager)
sceneManager:changeScene("mainmenu") |
mainmenu.lua
mainmenu = gideros.class(Sprite)
function mainmenu:init()
--Background Image
local background = Bitmap.new(Texture.new("Images/test.png"))
stage:addChild(background)
--Create Event Button
local createBtn = Bitmap.new(Texture.new("Images/btn1.png"))
local createBtn_over = Bitmap.new(Texture.new("Images/btn1_over.png"))
--The Actual Button and Listener
local button1 = Button.new(createBtn, createBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("createEvent", 1, SceneManager.flipWithFade)
end)
--Add Button To Scene
button1:setPosition(70, 200)
stage:addChild(button1)
-------------------------------------------------------------------------------
--Create Event Button
local viewBtn = Bitmap.new(Texture.new("Images/btn2.png"))
local viewBtn_over = Bitmap.new(Texture.new("Images/btn2_over.png"))
--The Actual Button and Listener
local button2 = Button.new(viewBtn, viewBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("ViewEdit")
end)
--Add Button To Scene
button2:setPosition(70, 450)
stage:addChild(button2)
-------------------------------------------------------------------------------
--Create Event Button
local settingsBtn = Bitmap.new(Texture.new("Images/btn3.png"))
local settingsBtn_over = Bitmap.new(Texture.new("Images/btn3_over.png"))
--The Actual Button and Listener
local button3 = Button.new(settingsBtn, settingsBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("Settings")
end)
--Add Button To Scene
button3:setPosition(70, 700)
stage:addChild(button3)
-------------------------------------------------------------------------------
end |
createEvent.lua
createEvent = gideros.class(Sprite)
function createEvent:init()
--Background Image
local background = Bitmap.new(Texture.new("Images/test.png"))
stage:addChild(background)
end |
I really need help with this, or my app won't work
Thanks in Advance!
-Landon
Comments
It's hard to run your code without images and all other files, so if you could post a project, we might be able to help you
In your mainmenu.lua you set up and add 3 buttons to the stage but each time you addEventListener you are adding it to button1 only. Maybe this is where your problem lies.
I very nearly didn't post this reply as I didn't know where to put it as you have the same post 3 (THREE) times. This community is usually very helpful but asking the same question in 3 different posts is not the usual way to get your question answered.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Thanks for the response! Thanks for the help and I will change it when I get home.
Also, sorry about asking the same question THREE times, I didn't mean too. I thought that my Question wasn't entered it so I guess I submitted it THREE times.
Sorry again, and next time I will only click the button once.
Lead Coder and Designer
In fact, I make really heavy use of print statements to try to follow the route my code is taking when things don't go right
Thanks for the responses!
@ar2rsawseen here is my project file for you to check out!
Thanks, (don't steal my idea! )
-Landon
Lead Coder and Designer
Is it not a Gideros project and I don't even know if it would run in Gideros.
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
@ar2rsawseen I attached the wrong file. I still have my CoranaSDK project because it has some things I still need. Also, @Scouser, I like the alternative name for CoronaSDK, "beer SDK"!! )
I've attached the correct file this time
Thanks again!
-Landon
Lead Coder and Designer
Likes: ljp1203
as @petec said change all stage:addChild(whatever) code to self:addChild(whatever)
except stage:addChild(sceneManager) in main.lua
and the transitions work
cheers
evs
Thanks All for the great responses!
@petec Thanks so much for the help. I didn't know just a couple letters could change how a whole app is working. Thanks again!
-Landon
Lead Coder and Designer