display.save() saves everything and not just display group?

I thought display.save() would only save the group in the parameter, but it does not seem to be the case, or I’m doing something wrong.

I want to save only the screen display, without the navigation buttons. So I have
local localGroup = display.newGroup()
local pixGroup = display.newGroup()

Then I insert the navigation buttons directly into localGroup, but I insert the background and other images into pixGroup, then pixGroup into localGroup, to keep them separate.
pixGroup:insert(bg)
localGroup:insert(pixGroup)

When I do the save, I got everything including the navigation buttons
display.save( pixGroup, fileN, baseDir )

Am I doing something wrong?

Thanks
fly [import]uid: 108015 topic_id: 26211 reply_id: 326211[/import]

Are you inserting pixGroup into localgroup or vice versa? If you are then that is the problem [import]uid: 84637 topic_id: 26211 reply_id: 106572[/import]

Hi Danny,

Yes, I inserted pixGroup into localGroup for display, but my save statement is only for pixGroup
display.save( pixGroup, fileN, baseDir )

Why wouldn’t just save pixGroup? [import]uid: 108015 topic_id: 26211 reply_id: 106670[/import]

Hey Fly,

I am not sure if I misunderstood or not but testing this;
[lua]local myObject1 = display.newRect( 50, 50, 100, 150 )
local myObject2 = display.newCircle( 100, 300, 50 )
local myObject3 = display.newCircle( 210, 300, 50 )

local g = display.newGroup()
local t = display.newGroup()

g:insert(myObject1)
t:insert(myObject2)
t:insert(g)
t:insert(myObject3)

local baseDir = system.DocumentsDirectory
display.save( g, “entireGroup.jpg”, baseDir )[/lua]

Seems to work just fine for me.

Do you have a sample that shows the issues you having you could share? [import]uid: 52491 topic_id: 26211 reply_id: 106682[/import]

Hi Peach,

Thanks for looking into this. I wonder if my test version is a bit out-of-date, my ui.lua was not behaving the way things are described, and it was fixed when I downloaded the latest version. Will look a bit later.

Any how:
I insert the background and some line drawings into pixGroup, then insert pixGroup into localGroup;
I insert the navigation buttons directly into localGroup

 local localGroup = display.newGroup() -- whole display  
 local pixGroup = display.newGroup() -- bg and images   
...  
  
 local function bgimage() -- inserting a background image  
 local bgname = bgpix[1]  
 local bg = display.newImageRect(bgname, dimx, dimy)  
 bg.x = halfx bg.y = halfy  
 pixGroup:insert(bg)  
 localGroup:insert(pixGroup)  
 end  
  
 local function sizbutton() -- navigation and control buttons  
 localGroup.pb00 = ui.newButton{  
 defaultSrc = "b00.png", defaultX = 70, defaultY = 40,  
 overSrc = "b00.png", overX = 70, overY = 40,  
 text = textSize,  
 textColor = { 51, 51, 51, 255 },  
 size = 22,  
 }  
 localGroup:insert(localGroup.pb00)  
 localGroup.pb00.x = butx5 localGroup.pb00.y = buty59  
 ...  
 end  
  
 function newLine(event) -- draw some lines  
 ...  
 end  
  
 function savef() -- save the bg and lines  
 local baseDir = system.DocumentsDirectory  
 local date = os.date( "\*t" )  
 local fileN = fname .. date.year .. date.month .. date.day .. "\_" .. date.hour .. date.min .. date.sec .. ".png"  
 fnid[findex] = fileN  
 display.save( pixGroup, fnid[findex], baseDir )  
 findex = findex + 1  
 fprev = findex  
 end  

It saves ok, but looking at the save file shows the navigations buttons as well.

Thanks
fly [import]uid: 108015 topic_id: 26211 reply_id: 106718[/import]

Hard to tell from the code you posted but just for the record, you should only need to insert pixgroup into localgroup once.
[import]uid: 84637 topic_id: 26211 reply_id: 106827[/import]

OK thanks, will work on my code a bit more. [import]uid: 108015 topic_id: 26211 reply_id: 106972[/import]