Problems on Device

I get a director while try to load this on my device, but it works fine on the simulator, thanks.

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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
 module(..., package.seeall)
 
 
new = function ( params )
        
        local ui = require ( "ui" )
        
        local localGroup = display.newGroup()
        
 
-- iBobblehead -------------------------------
----------------------------------------------
 
display.setStatusBar(display.HiddenStatusBar)
 
local physics = require "physics"
physics.start()
physics.setGravity(0, -1000)  -- 9.81 m/s*s in the positive x direction
physics.setDrawMode("hybrid")
 
local bgCounter = 0
local bodyCounter = 0
 
--Background Images 
 
bg0 = display.newImage( "importMenu-BG.png" )
localGroup:insert(bg0)
bg0.isVisible = true
 
bg1 = display.newImage( "bg1.png" )
localGroup:insert(bg1)
bg1.isVisible = false
 
bg2 = display.newImage( "bg2.png" )
localGroup:insert(bg2)
bg2.isVisible = false
 
bg3 = display.newImage( "bg3.png" )
localGroup:insert(bg3)
bg3.isVisible = false
 
bg4 = display.newImage( "bg4.png" )
localGroup:insert(bg4)
bg4.isVisible = false
 
 
 
 
--Body Images
 
body0 = display.newImage( "body0.png" )
localGroup:insert(body0)
body0.isVisible = true
 
body1 = display.newImage( "body1.png" )
localGroup:insert(body1)
body1.isVisible = false
 
body2 = display.newImage( "body2.png" )
localGroup:insert(body2)
body2.isVisible = false
 
body3 = display.newImage( "body3.png" )
localGroup:insert(body3)
body3.isVisible = false
 
body4 = display.newImage( "body4.png" )
localGroup:insert(body4)
body4.isVisible = false
 
body5 = display.newImage( "body5.png" )
localGroup:insert(body5)
body5.isVisible = false
 
 
local rectangle = display.newRect(147.5, 250, 25, 25)
physics.addBody(rectangle, "kinematic", {bounce = 1})
localGroup:insert(rectangle)
rectangle.isVisible = false
 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
local barUpBtn
local barDownBtn
local barBgBtn
local barBodyBtn
local barshareBtn
 
 
local barUp = function ( event )
        if event.phase == "release" then
                barUpBtn.isVisible = false
                barDownBtn.isVisible = true
                barBgBtn.isVisible = true
                barBodyBtn.isVisible = true
                barShareBtn.isVisible = true
        end
end
        
local barDown = function ( event )
        if event.phase == "release" then
                barUpBtn.isVisible = true
                barDownBtn.isVisible = false
                barDownBtn.isVisible = false
                barBgBtn.isVisible = false
                barBodyBtn.isVisible = false
                barShareBtn.isVisible = false
        end
end
 
local backgroundSelect = function ( event )
        if event.phase == "release" then
        
                if bgCounter == 0 then
                        bg0.isVisible = false
                        bg1.isVisible = true
                        bg2.isVisible = false
                        bg3.isVisible = false
                        bg4.isVisible = false
                        bgCounter = bgCounter + 1       
                
                
                 elseif bgCounter == 1 then
                        bg0.isVisible = false
                        bg1.isVisible = false
                        bg2.isVisible = true
                        bg3.isVisible = false
                        bg4.isVisible = false
                        bgCounter = bgCounter + 1
                
                elseif bgCounter == 2 then
                        bg0.isVisible = false
                        bg1.isVisible = false
                        bg2.isVisible = false
                        bg3.isVisible = true
                        bg4.isVisible = false
                        bgCounter = bgCounter + 1
                
                elseif bgCounter == 3 then
                        bg0.isVisible = false
                        bg1.isVisible = false
                        bg2.isVisible = false
                        bg3.isVisible = false
                        bg4.isVisible = true
                        bgCounter = 0
                end
                
        end
end
 
local bodySelect = function ( event )
        if event.phase == "release" then
        
                if bodyCounter == 0 then
                        body0.isVisible = false
                        body1.isVisible = true
                        body2.isVisible = false
                        body3.isVisible = false
                        body4.isVisible = false
                        body5.isVisible = false
                        bodyCounter = bodyCounter + 1   
                
                
                 elseif bodyCounter == 1 then
                        body0.isVisible = false
                        body1.isVisible = false
                        body2.isVisible = true
                        body3.isVisible = false
                        body4.isVisible = false
                        body5.isVisible = false
                        bodyCounter = bodyCounter + 1   
                        
                elseif bodyCounter == 2 then
                        body0.isVisible = false
                        body1.isVisible = false
                        body2.isVisible = false
                        body3.isVisible = true
                        body4.isVisible = false
                        body5.isVisible = false
                        bodyCounter = bodyCounter + 1   
                
                elseif bodyCounter == 3 then
                        body0.isVisible = false
                        body1.isVisible = false
                        body2.isVisible = false
                        body3.isVisible = false
                        body4.isVisible = true
                        body5.isVisible = false
                        bodyCounter = bodyCounter + 1   
                        
                elseif bodyCounter == 4 then
                        body0.isVisible = false
                        body1.isVisible = false
                        body2.isVisible = false
                        body3.isVisible = false
                        body4.isVisible = false
                        body5.isVisible = true
                        bodyCounter = bodyCounter + 1   
                        
                elseif bodyCounter == 5 then
                        body0.isVisible = true
                        body1.isVisible = false
                        body2.isVisible = false
                        body3.isVisible = false
                        body4.isVisible = false
                        body5.isVisible = false
                        bodyCounter = 0
                end
                
        end
end
 
 
barUpBtn = ui.newButton{
                                        default = "bar-downBtn.png",
                                        over = "bar-downBtn.png",
                                        onEvent = barUp,
                                        id = "barUpBtn"
        }
barUpBtn.x = 297
barUpBtn.y = 460
localGroup:insert(barUpBtn)
 
barDownBtn = ui.newButton{
                                        default = "bar-upBtn.png",
                                        over = "bar-upBtn.png",
                                        onEvent = barDown,
                                        id = "barDownBtn"
        }
barDownBtn.x = 297
barDownBtn.y = 460
localGroup:insert(barUpBtn)
barDownBtn.isVisible = false
 
barBgBtn = ui.newButton{
                                        default = "bar-bgBtn.png",
                                        over = "bar-bgBtn.png",
                                        onEvent = backgroundSelect,
                                        id = "barBgBtn"
        }
barBgBtn.x = 45
barBgBtn.y = 460
localGroup:insert(barBgBtn)
barBgBtn.isVisible = false
 
barBodyBtn = ui.newButton{
                                        default = "bar-bodyBtn.png",
                                        over = "bar-bodyBtn.png",
                                        --onEvent = bodySelect,
                                        id = "barBodyBtn"
        }
barBodyBtn.x = 134
barBodyBtn.y = 460
localGroup:insert(barBodyBtn)
barBodyBtn.isVisible = false
 
barShareBtn = ui.newButton{
                                        default = "bar-shareBtn.png",
                                        over = "bar-shareBtn.png",
                                        --onEvent = shareBobble,
                                        id = "barShareBtn"
        }
barShareBtn.x = 223
barShareBtn.y = 460
localGroup:insert(barShareBtn)
barShareBtn.isVisible = false
 
 
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
 
local loadPhoto = function(event)
   photo = event.target
   print( "photo w,h = " .. photo.width .. "," .. photo.height )
   photo.x = 120
   photo.y = display.contentHeight/2
   photo:scale(.3,.3)
   photo:rotate(220)
   squareShape = { -40,-70, 40,-70, 40,70, -40,70, }
   physics.addBody(photo,"dynamic", {bounce = 1, shape=squareShape})
   localGroup:insert(photo)
   local neck = physics.newJoint( "pivot", photo, rectangle, 160, 200 )
   localGroup:insert(neck)
   
   local mask = graphics.newMask( "mask.png" )
   photo:setMask( mask )
   photo.maskScaleX, photo.maskScaleY = 2,2
   localGroup:insert( mask )
   
end
media.show( media.PhotoLibrary, loadPhoto )
 
 
 
 
 
return localGroup
        
end
<code>

I get a director while try to load this on my device

What does that mean?

Director errors (if that is the case) should go in the director sub forum.

If you want 304 lines of code reviewed however, you can use this; http://www.anscamobile.com/corona/support/

Peach :)

Have you checked how much texture memory you are using? You can use a print statement in the simulator to get this.

Since you are loading several background images, you may be exceeding the texture memory that your device allows.

views:1450 update:2011/10/25 9:10:48
corona forums © 2003-2011