Hi !
I have a problem in my app (again :D).
In fact I want to load an image when I click on a button. Each click launch a function with the url of the image in parameter. I found a “loadImage” function in the forums and I tried to adapt it with what I need. Here it is :
--IMG is a url
--TMPNAME is different each time I use the function
--GROUPE is the group where I put the image in
--X and Y are the coordinates of the newly loaded image
function loadImage(IMG, TMPNAME, GROUPE, X, Y)
--try to erase the previous data, doesn't work...
path = nil
myfile = nil
path = system.pathForFile( TMPNAME .. ".png", system.DocumentsDirectory )
myFile = io.open( path, "w+b" )
-- Request remote file and save data to local file
http.request{
url = IMG,
sink = ltn12.sink.file(myFile),
}
-- Display local file
groupeFiche:remove(testImage)
testImage = display.newImage(TMPNAME .. ".png",system.DocumentsDirectory,X,Y);
GROUPE:insert( testImage )
end
My problem is that I want to overwrite the previous image with the new one each time I use this function, but from now on, each image is set on top of the previous…
Can a corona god help me ?
Thanks in advance !
Tonyo
[import]uid: 4431 topic_id: 1230 reply_id: 301230[/import]