Composite images syntax question

I need to load images into a composite paint table in an unconventional way.

[lua]

– usually I do it like this

local compositePaint = {

    type=“composite”,

    paint1={ type=“image”, filename=“image1.png” },

    paint2={ type=“image”, filename=“image2.png” }

}

– but I’d like to do something like this (does not work, I tried it)

local sprite1 = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex(“sprite1”)}} )

local sprite2 = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex(“sprite2”)}} )

local compositePaint = {
    type=“composite”,
    paint1={ sprite1 },
    paint2={ sprite2 }
}

[/lua]

I would also consider using snapshots or canvases but have no idea if there is an alternate syntax I can use to load sprites, snapshots or canvases into a composite paint table.

My last resort would be to save the sprites as PNG’s and then load them into the composite paint table as that would defeat the purpose of image sheets and bloat the app.

Ideas?

Thanks,

Jonathan

Canvases expose filename and baseDir properties, allowing them to be passed to paints as in your “usually I do it like this” case.

I will try that, thanks!

Canvases expose filename and baseDir properties, allowing them to be passed to paints as in your “usually I do it like this” case.

I will try that, thanks!