Hi,
I am learning corona to make ebooks and I am trying to learn composer to do it. I got stuck right out of the gate and I can’t seem to find anything out there.
this is main.lua
local composer = require( “composer” )
–composer.Gesture = require(“dmc_gesture”)
–composer.MultiTouch = require(“dmc_multiTouch”)
–system.activate(“multitouch”)
display.setStatusBar( display.HiddenStatusBar )
composer.gotoScene( “scenetemplate”)
and this is my scenetemplate.lua ( which I am using as my scene for test)
local composer = require( “composer” )
local scene = composer.newScene()
– All code outside of the listener functions will only be executed ONCE unless “composer.removeScene()” is called.
– local forward references should go here
– “scene:create()”
function scene:create( event )
local sceneGroup = self.view
– Initialize the scene here.
– Example: add display objects to “sceneGroup”, add touch listeners, etc.
local background = display.newImageRect( “background.png”, 2048, 1536 )
background.x = 1022
background.y = 766
sceneGroup:insert(background)
local drawer_merged = display.newImageRect( “drawer_merged.png”, 606, 911 )
drawer_merged.x = 2254
drawer_merged.y = 766
sceneGroup:insert(drawer_merged)
end
– “scene:show()”
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
transition.to( drawer_merged, { time=1000, x=1796, transition=easing.outBounce} )
elseif ( phase == “did” ) then
– Called when the scene is now on screen.
– Insert code here to make the scene come alive.
– Example: start timers, begin animation, play audio, etc.
end
end
– “scene:hide()”
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Called when the scene is on screen (but is about to go off screen).
– Insert code here to “pause” the scene.
– Example: stop timers, stop animation, stop audio, etc.
elseif ( phase == “did” ) then
– Called immediately after scene goes off screen.
end
end
– “scene:destroy()”
function scene:destroy( event )
local sceneGroup = self.view
– Called prior to the removal of scene’s view (“sceneGroup”).
– Insert code here to clean up the scene.
– Example: remove display objects, save state, etc.
end
– Listener setup
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
return scene
The objects draw to the screen but the animation will not run. What I am doing wrong here.