I am new to Livecode - bear with me please.
I am trying to implement the create image function, using the tempateImage object. I almost have it. I'm creating lots of images on the fly I create an image and set the PNG filename to it and resize it to fit (for retina). It works fine first time then when I return to the same card the scale is wrong (it's too big). Here is my code:
Code: Select all
on setUpMapIcons
if the environment is "mobile" then
put specialFolderPath("Engine")&slash&"Media/MapIcons"&slash into tP
else
put specialFolderPath("Desktop")&slash&"MapIcons"&slash into tP
end if
lock screen for visual effect
put 0 into tC
set the width of the templateImage to 64 -- these 2 lines have no effect - why?
set the height of the templateImage to 64
lock messages
repeat for each line tMkey in the keys of gSlugList -- gSlugList is a list of filename without .png suffix
put gSlugList[tMkey] into tA
repeat for each line tS in the keys of tA
-- Name
add 1 to tC
put ("mapIcon"&tC) into i
-- create image
set the resizeQuality of the templateImage to "good"
create invisible image i in group "G_MapButs"
-- Filename for icon
set the filename of image i to (tP&"MapIcon_"&tA[tS]&".png")
set the width of image i to 64 -- original PNG size is 128x128 - this works first time then has no effect on revisting this card!!!
set the height of image i to 64 -- neither does this...
setImageLoc -- positions image on map
show image i
end repeat
end repeat
unlock messages
unlock screen with visual effect dissolve very fast
end setUpMapIcons
Kind regards, Paul.