@jfperusse@sim - I am struggling with a callback for a parameter.integer() function to identify and select images for display.
I have frequently used the callback to identify/change the background to my projects and have used an array with path lists to the images I need. But this does not seem to work now.
Is this due to a change in addressing mode for assets in the latest versions ? If so how do I solve my problem - how can I address assets without using path lists ?
Example below
`
viewer.mode = FULLSCREEN
function setup()
–
cW, cH = WIDTH//2, HEIGHT//2
pick = 1
show = readImage(pics[pick])
parameter.integer(“pick”, 1,#pics,1, getPick(pick))
end
function draw()
–
background(40, 40, 50)
sprite(show,cW,cH)
end
function getPick(piccie)
–
show = readImage(pics[piccie])
end
@piinthesky - I have tried moving them into the function start() and before that in global space with the same result - it loads the initial image but doesn’t load the other image after selection on the slider.
I am suspecting that you have to load your resources into the Codea assets folder where you can link directly to the assets. I need to fiddle with that a little more.
@jfperusse - thanks for the reply, I had tried that before but it gave me the same problem. Tried again and I found it works but there seems to be an issue with it - sometimes it worked and other times it seemed to ignore the new image retaining the first one. I wonder if it’s due to the size of the image - I am displaying photographs here. When there are only two assets there seems to be a point about half way through dragging the pointer across to the right when something happens.
Tried it with three source images and it was better but still didn’t change the image occasionally.
Edit: confirmed - it’s down to the size of the asset. Placing small image assets in the asset list works fine larger assets are the problem - perhaps there is an internal timer on the file loading which has an issue if the file size is too large. Threw me a wobbler when I started the project - played around with the code and couldn’t understand where I’d gone wrong. Not an issue generally but need to log large asset loading can impact the code - possibly in other asset loading situations.
Hi @Bri_G. Tested with photos and managed to reproduce the issue. We’ll investigate what’s going on. Thanks!
Edit: scratch that. I was actually missing some readImage calls. With 3 large photos taken from my iPhone 16 it seems to work fine. I have added “increment” and “decrement” buttons instead of the slider as I was having trouble using the slider. Is this what you are seeing? Or is the slider moving fine, but images are not updating?
@jfperusse - yes, a little trouble with the slider - don’t know if it was how fast I pulled across or if I lost contact part way across but the net result was no change in image. The buttons option sounds like a good idea though.
On the picture front - what format are your images png or jpeg ?
@jfperusse - just loaded the latest beta so I tested again. Don’t know if image display has changed significantly but viewing several large images was hit and miss. I had 4 images in a table and in general most displayed but sometimes it froze on one image and there was occasionally a funny with the slider. I displayed an image then moved the slider to introduce another - took off my finger and the slider was stationary but then it moved right and displayed the next image. Still think this re-enforces large image file issue.