I'm trying to pull in multiple images that have been exported as .png to a specific folder on iOS. Everything works without any errors. I can get the original image from the users library, album or camera and save it as a .png. The problem comes when retrieving multiple .png files. The code below steps thru for each .png file and puts them each into a separate image object in a group.
Here's what's happening.
Only the final image in the repeat provides the formattedwidth and formattedheight. All the rest are "0". If there is only 1 .png it provides the true formattedwidth and formattedheight. If there are more than 1 .png files only the last one provides the true ormattedwidth and formattedheight even if all of the .png files are the same image.
So my question is, why am I only getting the correct values on the last .png? I tried putting wait statements is various places, thinking that LC was jut too fast for it's own good but no-joy.
Code: Select all
put 1 into theNewImage
repeat for each line theLine in tFiles -- tFiles is a list of the .png file names
put thePath & "/" & theLine into tPicPath -- build the path to each .png file
put line theNewImage of the_Group_IDs into theGrp_ID -- here I'm getting the ID of a group which contains an image object
set the filename of control 1 of grp ID theGrp_ID of grp "picGroup" to tPicPath -- this sets the image of the image object
put the formattedwidth of the last image of this cd into tWidthSource
-- get the formattedwidth of the last image of this cd -- this didn't work either
-- put it into tWidthSource
put the formattedheight of the last image of this cd into tHeightSource
-- get the formattedheight of the last image of this cd
-- put it into tHeightSource
if tWidthSource = "0" then put "240" into tWidthSource -- I had to add this to get around the 0. The size of the image objects is 240 x 240
if tHeightSource = "0" then put "240" into tHeightSource
answer "tWidthSource" && tWidthSource &CR& "tHeightSource" && tHeightSource