I’m having some issues using display.save on a android device. What I’m trying to do is load something and as soon as it’s load save it. Here is some example code here:-
testGroup = display.newGroup()
rect = display.newRect(0,0,100,100)
testGroup:insert(rect)
display.save(testGroup, "test.jpg", system.DocumentsDirectory)
image = display.newImage("test.jpg", system.DocumentsDirectory)
image.x = 200
image.y = 200
When I use this in the simulator, it works and displays the two white rects. When I put it on the android device the first one shows, but the second one doesn’t appear at all. I tried a test where I put the image display on a delay like this:-
testGroup = display.newGroup()
rect = display.newRect(0,0,100,100)
testGroup:insert(rect)
function doSave()
display.save(testGroup, "test.jpg", system.DocumentsDirectory)
image = display.newImage("test.jpg", system.DocumentsDirectory)
image.x = 200
image.y = 200
end
timer.performWithDelay(300, doSave)
Which does work, but obviously isn’t idea as it’s going to be much slower and will be wasting a fair bit of time. Can anyone suggest away around this without having to use a delay? Or am I possibly doing something wrong that I have missed?
Considering I get the same results using the result example I’m not 100% sure though
local myObject1 = display.newRect( 50, 50, 100, 150 ) -- Create a rectangle object
local myObject2 = display.newCircle( 100, 300, 50 ) -- Create a circle object
local g = display.newGroup()
g:insert(myObject1)
g:insert(myObject2)
local baseDir = system.DocumentsDirectory
display.save( g, "entireGroup.jpg", baseDir )
image = display.newImage("entireGroup.jpg", baseDir)
image.x = 0
image.y = 0
[import]uid: 133056 topic_id: 31240 reply_id: 331240[/import]