I have been using storyboard for quite some time now and i am confused what is the best method to insert objects into the scenes, which one is the correct way, if there is no correct way between the two, is there a better way to do it?
[lua]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local obj
function scene:createScene( event )
local group = self.view
obj = display.newCircle(100,100,100)
group:insert(obj)
end
function scene:enterScene( event )
local group = self.view
obj.x, obj.y = 200, 200
end
function scene:exitScene( event )
local group = self.view
obj:removeSelf()
obj = nil
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
return scene[/lua]
[lua]local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
function scene:createScene( event )
local group = self.view
local obj = display.newCircle(100,100,100)
group:insert(obj)
end
function scene:enterScene( event )
local group = self.view
local obj = group[1]
obj.x, obj.y = 200, 200
end
function scene:exitScene( event )
local group = self.view
local obj = group[1]
obj:removeSelf()
obj = nil
end
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
return scene[/lua] [import]uid: 114118 topic_id: 32690 reply_id: 332690[/import]