There seems to be a problem with GetImageChosen() returning the last picture that was successfully loaded, even when the presses the back button on the device to cancel the action at the image selection screen the second time.
This code shows that the last image loaded continues to be selected by GetImageChosen() when you press the back button the second and third time at the select image screen.
To see it bug do the following steps:
1. Press the white box/sprite and then pick an image on your device. That will then put the image on the white box sprite.
2. Press the box/sprite again but this time press the back button on your device to cancel picking a picture.
You will see that the first image that was successfully loaded is still held in GetImageChosen().
sprButton = CreateSprite(0)
SetSpriteSize(sprButton, 200, 200)
SetSpritePosition(sprButton, 200, 200)
do
print(imageFile)
if (GetPointerPressed() = 1)
spriteHit = GetSpriteHit(ScreenToWorldX(GetPointerX()), ScreenToWorldY(GetPointerY()))
endif
if (GetPointerReleased() = 1)
DeleteImage(imageFile)
imageFile = 0
ShowChooseImageScreen()
repeat
Sync()
until (IsChoosingImage() = 0)
imageFile = GetChosenImage()
SetSpriteImage(sprButton, imageFile)
endif
sync()
loop
I think we need ShowChooseImageScreen() to automatically clear out what's in GetChosenImage() or have a new function that clears it i.e. ClearChosenImage(). The former option seems the most logical one though.