Hello,
I am having a very hard time turning this code from share your code (Slider) into a director file, I want to be able to press one of the menu images and go to another page. If you check out the link you will see what i mean. I basically need to turn all this code into a groupa so i can change screens, i just can’t figure out how to do it thought because there other groups. I hope you under stand what i am trying to do, if you don’t please ask i just really need help with this.
THANKS SO MUCH.
Link for slider:http://developer.anscamobile.com/code/slider-module-springboard-functionality-warning-shameless-promotion-inside
Slider code:
[code]
– const
– vars global
– vars local
local main_sprt = nil
local bck_shp = nil
local slider = nil
local slider_sprt = nil
– forward declerations
–##################################################################################################
– PUBLIC METHODS
–##################################################################################################
–##################################################################################################
– PRIVATE METHODS
–##################################################################################################
– init
local function init()
– statusBar
display.setStatusBar( display.HiddenStatusBar )
– main_sprt
main_sprt = display.newGroup()
– bck
bck_shp = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
main_sprt:insert( bck_shp )
bck_shp:setFillColor( 192, 192, 192 )
– slider
slider = require( “slider” )
slider:init()
slider_sprt = slider:getSprite()
main_sprt:insert( slider_sprt )
slider_sprt.x = 0.5 * ( display.contentWidth - 256 - 16 )
slider_sprt.y = 64
local slide_sprt = nil
local btn_sprt = nil
local textInfo_tbl = {}
local btnInfo_tbl = {}
– slide 1
textInfo_tbl = { “Slider”, “by Microsheep”, “microsheep.com” }
btnInfo_tbl = { “microsheep_logo_white_med” }
slide_sprt = renderSlide( 1, textInfo_tbl, btnInfo_tbl )
btn_sprt = renderSlideBtn( 1, 256 )
– slider
slider.addSlide( slide_sprt, btn_sprt )
– slide 2
textInfo_tbl = { “Slider”, “Swipe with your finger,”, “or tap on one of the buttons,”, “to move between slides” }
btnInfo_tbl = {}
slide_sprt = renderSlide( 2, textInfo_tbl, btnInfo_tbl )
btn_sprt = renderSlideBtn( 2, 256 )
– slider
slider.addSlide( slide_sprt, btn_sprt )
– slide 3
textInfo_tbl = { “Slider”, “Feel free to use Slider.”, “If you like it,”, “please download”, " and rate my game:", “Fingerless 3D” }
btnInfo_tbl = { “fingerless3D_icon_90x90” }
slide_sprt = renderSlide( 3, textInfo_tbl, btnInfo_tbl )
btn_sprt = renderSlideBtn( 3, 256 )
– slider
slider.addSlide( slide_sprt, btn_sprt )
end
– renderSlide
function renderSlide( slideIndex, textInfo_tbl, btnInfo_tbl )
– slide_sprt
local slide_sprt = display.newGroup()
– bck_sprt
local bck_sprt = display.newImage( “assets/slide_bck.png” )
slide_sprt:insert( bck_sprt )
– text
local this_txt = nil
for i=1, #textInfo_tbl do
if ( 1 == i or 6 == i ) then
this_txt = display.newText( textInfo_tbl[i], 0, 0, native.systemFontBold, 16 )
else
this_txt = display.newText( textInfo_tbl[i], 0, 0, native.systemFont, 16 )
end
slide_sprt:insert( this_txt )
this_txt:setTextColor( 64, 64, 64 )
this_txt.x = 0.5 * bck_sprt.contentWidth
this_txt.y = 0 + 32 * i
end
– btns
local this_btn = nil
for i=1, #btnInfo_tbl do
this_btn = display.newImage( “assets/” … btnInfo_tbl[i] … “.png” )
slide_sprt:insert( this_btn )
this_btn.x = 0.5 * bck_sprt.contentWidth
this_btn.y = 264
this_btn.id = 10 * slideIndex + i
this_btn:addEventListener( “tap”, tapCb)
end
return slide_sprt
end
– renderSlideBtn
function renderSlideBtn( btnIndex, slideWidth )
local numBtns = 3
– btn
local btn_sprt = display.newGroup()
btn_sprt.x = 12 + 0.5 * slideWidth + (btnIndex - 0.5 * numBtns - 1) * 64
btn_sprt.y = display.contentHeight - 144
btn_sprt.id = btnIndex
– on
local btnOn_sprt = display.newImage( “assets/btn_slide” … btnIndex … “.png” )
btn_sprt:insert(btnOn_sprt)
– off
local btnOff_sprt = display.newImage( “assets/btn_slide” … btnIndex … “_off.png” )
btn_sprt:insert(btnOff_sprt)
btnOff_sprt.isVisible = false
return btn_sprt
end
– tapCb
function tapCb( evt )
local btnId = evt.target.id
print( "btnId = " … btnId )
if ( 11 == btnId ) then
system.openURL( “http://www.microsheep.com” )
elseif ( 31 == btnId ) then
system.openURL( “http://itunes.apple.com/us/app/fingerless-3d/id413275480?mt=8” )
end
end
–##################################################################################################
– START
–##################################################################################################
init() [import]uid: 23689 topic_id: 17405 reply_id: 317405[/import]