How to to do Slide View?

Hey people I need help with using slide view for my game what I'm trying to do is have levels slide from like a slide view. So my problem is how would I do slide view on this code I have for my level select

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
module(..., package.seeall)
 
function new()
        local localGroup = display.newGroup()
        
        require "ui"
local ui = require("ui")
local slideView = require("slideView")
                 
backgroundMusic = audio.loadStream("My Song.m4a")
 
backgroundMusicChannel = audio.play( backgroundMusic, { channel=20, loops=-1, fadein=10000 }  )  -- play the background music on channel 1, loop infinitely, and fadein over 5 seconds 
  -- play the laser on any available channel
                        
        local bk = display.newImage("bk.png")
        bk.x = 240
        bk.y = 160
        localGroup:insert(bk)
        
        local text = display.newText("Level Select", 170, 10,"Times New Roman", 30)
        localGroup:insert(text)
        
        
        
                back = ui.newButton{
default = "arrow1.png",
over = "arrow3.png",
x = 30,
y = 30,
onEvent = onback,
}
 
                forward = ui.newButton{
default = "arrow4.png",
over = "arrow5.png",
x = 450,
y = 30,
onEvent = onforward,
}
        
local function checkForFile ()
        currentLevel = loadFile ("currentLevel.txt")
        if currentLevel == "empty" then
                currentLevel = 1
                saveFile("currentLevel.txt", currentLevel)
        end
end
checkForFile()
 
--Table for levels
local level = {}
 
--Table for level text
local levelText = {}
 
--Function for open levels
local function goLevel (event)
 
        director:changeScene(event.target.scene)
end
 
local startX = 45
 
iconPos = {}
iconPos[1] = {x=70, y=100}
iconPos[2] = {x=140, y=100}
iconPos[3] = {x=210, y=100}
iconPos[4] = {x=280, y=100}
iconPos[5] = {x=350, y=100}
iconPos[6] = {x=420, y=100}
iconPos[7] = {x=70, y=160}
iconPos[8] = {x=140, y=160}
iconPos[9] = {x=210, y=160}
iconPos[10] = {x=280, y=160}
iconPos[11] = {x=350, y=160}
iconPos[12] = {x=420, y=160}
iconPos[13] = {x=70, y=220}
iconPos[14] = {x=140, y=220}
iconPos[15] = {x=210, y=220}
iconPos[16] = {x=280, y=220}
iconPos[17] = {x=350, y=220}
iconPos[18] = {x=420, y=220}
iconPos[19] = {x=70, y=280}
iconPos[20] = {x=140, y=280}
iconPos[21] = {x=210, y=280}
iconPos[22] = {x=280, y=280}
iconPos[23] = {x=350, y=280}
iconPos[24] = {x=420, y=280}
iconPos[25] = {x=520, y=100}
 
iconPos2 = {}
iconPos2[1] = {x=70, y=100}
iconPos2[2] = {x=140, y=100}
iconPos2[3] = {x=210, y=100}
iconPos2[4] = {x=280, y=100}
iconPos2[5] = {x=350, y=100}
iconPos2[6] = {x=420, y=100}
iconPos2[7] = {x=70, y=160}
iconPos2[8] = {x=140, y=160}
iconPos2[9] = {x=210, y=160}
iconPos2[10] = {x=280, y=160}
iconPos2[11] = {x=350, y=160}
iconPos2[12] = {x=420, y=160}
iconPos2[13] = {x=70, y=220}
iconPos2[14] = {x=140, y=220}
iconPos2[15] = {x=210, y=220}
iconPos2[16] = {x=280, y=220}
iconPos2[17] = {x=350, y=220}
iconPos2[18] = {x=420, y=220}
iconPos2[19] = {x=70, y=280}
iconPos2[20] = {x=140, y=280}
iconPos2[21] = {x=210, y=280}
iconPos2[22] = {x=280, y=280}
iconPos2[23] = {x=350, y=280}
iconPos2[24] = {x=420, y=280}
iconPos2[25] = {x=520, y=100}
 
--Load level icons accordingly
local function setupLevels()
        for i = 1, 25 do
                if tonumber(currentLevel) >= i then
                        level[i] = display.newImageRect("moon.png", 50, 50)
                        level[i].x, level[i].y = startX*i, 50
                        level[i].x, level[i].y = iconPos[i].x, iconPos[i].y
                        localGroup:insert( level[i] )
                        level[i].scene = "level"..i..""
                        level[i]:addEventListener("tap", goLevel)
                        levelText[i] = display.newText(""..i.."", startX*i-2, 45, "Arial", 20)
                        levelText[i]:setTextColor(0,0,0)
                        levelText[i].x, levelText[i].y = iconPos2[i].x, iconPos2[i].y
                        localGroup:insert( levelText[i] )
                elseif tonumber(currentLevel) < i then
                        level[i] = display.newImageRect("moonl.png", 50, 50)
                        level[i].x, level[i].y = startX*i, 50
                        level[i].x, level[i].y = iconPos[i].x, iconPos[i].y
                        localGroup:insert( level[i] )
                        levelText[i] = display.newText(""..i.."", startX*i-2, 45, "Arial", 20)
                        levelText[i]:setTextColor(255,255,255)
                        levelText[i].x, levelText[i].y = iconPos2[i].x, iconPos2[i].y
                        localGroup:insert( levelText[i] )
                end
        end
end
setupLevels()
        
                return localGroup
end 

Check this out. It helped me a lot when I was doing the same thing.

http://developer.anscamobile.com/code/easy-slider-springboard-levelselect-howto

views:1773 update:2012/2/9 11:37:26
corona forums © 2003-2011