multiple images - lesson learned

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

multiple images - lesson learned

Post by cusingerBUSCw5N » Thu Dec 13, 2012 2:31 am

I had a problem with pictures being inconsistently ftp'd - sometimes it would work and sometimes it wouldn't.

I have an app that allows people to ftp pictures from their mobile devices and then do it again and again...

It consistently works the first time, but for the second and third pictures and so on, there have been problems.

I have learned that part (hopefully all) of the problem is that the image needs to be DELETED before returning to the button to do it again. I had the visible turned off - but that isn't good enough. If you don't delete the image, when it comes back to do it again, it shows the picture, but apparently it no longer knows what "last picture" is when it is named - and can't figure out widths and heights for sizing -- and fails in the ftp process. Once I put the code: delete the image "libImageZ"
before sending the user back to the button to do it again, it has worked consistently.

Seems obvious now, but it has made me crazy for a long time because I didn't take the time to go test it for multiple uses in the same session.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: multiple images - lesson learned

Post by jacque » Thu Dec 13, 2012 10:39 pm

The "last" anything is the object of that type that has the highest layer number. It doesn't depend on the name or any other property, but if you change its layer then it isn't the last one any more. You shouldn't have to delete it though; if you create a new image then the new one will be the "last" image.

Another approach is to create an image and give it a unique name, and then consistently refer to it by name to avoid confusion.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply