How to change of scene by sliding the screen to the right or left as required?
Please help
How to change of scene by sliding the screen to the right or left as required?
Please help
Here is a page in the docs that describes the API to transition between composer scenes. http://docs.coronalabs.com/daily/api/library/composer/gotoScene.html
Hello, this is a transition effect.
But I need to do that when the user slide the finger across the screen, you change the scene according to the movement of the finger. How could implement this function?.
Thanks.
Ah yes, I see. In that case, I think what you need is a handy little library recently released by RoamingGamer.
Here is a video he released before he had released the code: https://www.youtube.com/watch?v=dZ8wfx2t4sQ
And here is the code: https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2016/01/composerSwipeNavigation
or as a zip: http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/01/composerSwipeNavigation.zip
Here is a link to the forum topic where he announced the library: https://forums.coronalabs.com/topic/60980-composer-swipe-navigation-free-mini-module/
Also, FYI, RoamingGamer’s code (linked to above) contains several files. The only file you need is composerExt.lua. Just copy it into the root of your project. To see how to use this code, refer to his main.lua. The rest of the code in the project is just for the demo/sample.
hello thanks for the help.
Try to implement it in my code by copying the composerext. in the root and the main code, but it does not work.
In that code using composer, unlike me who use storyboard, if you had a solution I’d appreciate it
Thanks
Oh! Storyboard. I have never actually worked with the storyboard api before since they have phased it out and replaced it with the composer api. If you can, I’d recommend migrating to the composer api since it’s the new and preferred way to do scene transitions. Otherwise, hopefully someone else on this forum can help you.
Ok, thanks. I will try to migrante to composer. Thanks
local composer = require( "composer" ) local scene = composer.newScene() composer.recycleOnSceneChange = true local function boton\_aceptar (event) if event.phase == "ended" then composer.gotoScene( "scenes.chica", {effect="fade", time=200, params = {resume=false}} ) end end local function boton\_cancelar (event) if event.phase == "ended" then native.requestExit() end end timer.performWithDelay(1000,boton\_cancelar) function scene:create( event ) local sceneGroup = self.view --creamos listeners, empezamos timers, transiciones, etc.. En otras palabras, empezamos el movimiento y interacción local aviso = display.newText("AVISO", display.contentWidth/1.89, display.contentHeight/13, native.systemFont, 36); --local aviso = display.newText("AVISO", 170, 20, native.systemFont, 36); aviso:setTextColor(255,0,0); local cancelar = display.newImage("imagenes/cancelar.png",163, 445); cancelar.xScale = 0.7; cancelar.yScale = 0.7; cancelar:addEventListener ("touch", boton\_cancelar) local aceptar = display.newImage("imagenes/aceptar.png",163, 385); aceptar.xScale = 1.4; aceptar.yScale = 1.4; --Creamos un listener para cuando le damos al botón de start aceptar:addEventListener ("touch", boton\_aceptar) -- Create a swiper on this page ONLY local swiper = composer.createSwipe( sceneGroup, {alwaysTo = "front"} ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willEnter( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didEnter( event ) local sceneGroup = self.view composer.enableSwipe( true ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willExit( event ) local sceneGroup = self.view composer.enableSwipe( false ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didExit( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:destroy( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- -- FUNCTION/CALLBACK DEFINITIONS -- ---------------------------------------------------------------------- --------------------------------------------------------------------------------- -- Scene Dispatch Events, Etc. - Generally Do Not Touch Below This Line --------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willEnter( event ) elseif( willDid == "did" ) then self:didEnter( event ) end end function scene:hide( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willExit( event ) elseif( willDid == "did" ) then self:didExit( event ) end end scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene
Hello again, I trying to migrate to composer, but I have a problem, when I “touch” the button aceptar, don’t change to scene to ‘chica’
local function boton\_aceptar (event) if event.phase == "ended" then composer.gotoScene( "scenes.chica", {effect="fade", time=200, params = {resume=false}} ) end end
Please help.
Thanks
Kevin,
Looks like no one has replied to your request for help. If you are still in need of help, may I suggest that you rename the topic from “Hi! I need help” to something more meaningful like “Composer scene not transitioning on button click”? You might even consider just creating a new topic so that it’s at the top of the Recent Topics list.
Here is a page in the docs that describes the API to transition between composer scenes. http://docs.coronalabs.com/daily/api/library/composer/gotoScene.html
Hello, this is a transition effect.
But I need to do that when the user slide the finger across the screen, you change the scene according to the movement of the finger. How could implement this function?.
Thanks.
Ah yes, I see. In that case, I think what you need is a handy little library recently released by RoamingGamer.
Here is a video he released before he had released the code: https://www.youtube.com/watch?v=dZ8wfx2t4sQ
And here is the code: https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2016/01/composerSwipeNavigation
or as a zip: http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2016/01/composerSwipeNavigation.zip
Here is a link to the forum topic where he announced the library: https://forums.coronalabs.com/topic/60980-composer-swipe-navigation-free-mini-module/
Also, FYI, RoamingGamer’s code (linked to above) contains several files. The only file you need is composerExt.lua. Just copy it into the root of your project. To see how to use this code, refer to his main.lua. The rest of the code in the project is just for the demo/sample.
hello thanks for the help.
Try to implement it in my code by copying the composerext. in the root and the main code, but it does not work.
In that code using composer, unlike me who use storyboard, if you had a solution I’d appreciate it
Thanks
Oh! Storyboard. I have never actually worked with the storyboard api before since they have phased it out and replaced it with the composer api. If you can, I’d recommend migrating to the composer api since it’s the new and preferred way to do scene transitions. Otherwise, hopefully someone else on this forum can help you.
Ok, thanks. I will try to migrante to composer. Thanks
local composer = require( "composer" ) local scene = composer.newScene() composer.recycleOnSceneChange = true local function boton\_aceptar (event) if event.phase == "ended" then composer.gotoScene( "scenes.chica", {effect="fade", time=200, params = {resume=false}} ) end end local function boton\_cancelar (event) if event.phase == "ended" then native.requestExit() end end timer.performWithDelay(1000,boton\_cancelar) function scene:create( event ) local sceneGroup = self.view --creamos listeners, empezamos timers, transiciones, etc.. En otras palabras, empezamos el movimiento y interacción local aviso = display.newText("AVISO", display.contentWidth/1.89, display.contentHeight/13, native.systemFont, 36); --local aviso = display.newText("AVISO", 170, 20, native.systemFont, 36); aviso:setTextColor(255,0,0); local cancelar = display.newImage("imagenes/cancelar.png",163, 445); cancelar.xScale = 0.7; cancelar.yScale = 0.7; cancelar:addEventListener ("touch", boton\_cancelar) local aceptar = display.newImage("imagenes/aceptar.png",163, 385); aceptar.xScale = 1.4; aceptar.yScale = 1.4; --Creamos un listener para cuando le damos al botón de start aceptar:addEventListener ("touch", boton\_aceptar) -- Create a swiper on this page ONLY local swiper = composer.createSwipe( sceneGroup, {alwaysTo = "front"} ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willEnter( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didEnter( event ) local sceneGroup = self.view composer.enableSwipe( true ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:willExit( event ) local sceneGroup = self.view composer.enableSwipe( false ) end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:didExit( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- ---------------------------------------------------------------------- function scene:destroy( event ) local sceneGroup = self.view end ---------------------------------------------------------------------- -- FUNCTION/CALLBACK DEFINITIONS -- ---------------------------------------------------------------------- --------------------------------------------------------------------------------- -- Scene Dispatch Events, Etc. - Generally Do Not Touch Below This Line --------------------------------------------------------------------------------- function scene:show( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willEnter( event ) elseif( willDid == "did" ) then self:didEnter( event ) end end function scene:hide( event ) local sceneGroup = self.view local willDid = event.phase if( willDid == "will" ) then self:willExit( event ) elseif( willDid == "did" ) then self:didExit( event ) end end scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene
Hello again, I trying to migrate to composer, but I have a problem, when I “touch” the button aceptar, don’t change to scene to ‘chica’
local function boton\_aceptar (event) if event.phase == "ended" then composer.gotoScene( "scenes.chica", {effect="fade", time=200, params = {resume=false}} ) end end
Please help.
Thanks
Kevin,
Looks like no one has replied to your request for help. If you are still in need of help, may I suggest that you rename the topic from “Hi! I need help” to something more meaningful like “Composer scene not transitioning on button click”? You might even consider just creating a new topic so that it’s at the top of the Recent Topics list.