I am starting with storyboard and I have a back button i need to put on one of the files.
This file is treated as a scene but has no function new()
How would I put a back button inside of this file?Thanks.
[code]
– VIDEO GALLERY
– by John Polacek @ 2011
– Version: 1.0
– Git: https://github.com/johnpolacek/Video-Gallery
– Blog: http://johnpolacek.com
– Twitter: @johnpolacek
– Background Width/Height/Alignment
local backgroundWidth = 640
local backgroundHeight = 1136
local backgroundAlignment = “center”
– Scroll Nav spacing/margins
local spacing = 50
local leftMargin = 50
local topMargin = 300
local scrollbarY = 680
– Load content
local content = require(“content”)
–import the scrollNav class
local scrollNav = require(“scrollNav”)
display.setStatusBar(display.HiddenStatusBar)
function new()
local localGroup = display.newGroup()
local babybutton = display.newImage (“Icon.png”, true)
babybutton.x = 92
babybutton.y = 293
localGroup:insert(babybutton)
local function gobaby (event)
if event.phase == “ended” then
director:changeScene (“baby”)
end
end
babybutton:addEventListener(“touch”, gobaby)
return localGroup
end
– Touch event listener for background image
– Background
local background = display.newImageRect(“background.png”, backgroundWidth, backgroundHeight)
– Center background image
background.x = backgroundWidth / 2
– Align background
local topMarginAdjust = 0
if (backgroundAlignment == “bottom”) then
topMarginAdjust = -(backgroundHeight - display.viewableContentHeight)
elseif (backgroundAlignment == “top”) then
topMarginAdjust = backgroundHeight - display.viewableContentHeight
end
background.y = (backgroundHeight / 2) + topMarginAdjust -((backgroundHeight - display.viewableContentHeight)/2)
– Setup a scrollable content group
local scrollNav = scrollNav.new({left=0, right=0, tm=topMargin, lm=leftMargin, sp=spacing})
– Iterate through content and add to scrollNav
for index, value in ipairs(content) do
local thumb = display.newImage(content[index].thumb)
scrollNav:insertButton(thumb, content[index].asset)
end
[/code] [import]uid: 88495 topic_id: 34875 reply_id: 334875[/import]