When we click on an image it should come in front as the selected image, but I dont want to change the index value of that image
canvas1.setChilIndex(Image(event.target), numChildern-1)
The above line is changing the index value of the selected image and setting it to maximum-1 (for ex: 5-1 = 4 as index value). I Need alternate for above line that keeps the same index for the image.
Any help is appreciated.
What you can do, is in your click handler store the index of the item clicked, then on the next click (or whenever you want), send the item back to its previous index:
so in your click handler, do this instead of the line you have in your question:
With this method, anytime you call
selectImage, it will put the last click one back where it belongs. You could also calldeselectImagemanually if you so desired.