I am working on an application, trying to get it as dynamic
At the moment, I am looping through an array, adding a panel
for each item.
I want to add an image into each panel - the image is unique
for each one.
I have the panels created correctly, and I am able to output
the correct id onto each panel as text for testing. However, when I
try to add the image, it only adds onto the last panel, leaving the
first two blank.
My code is attached. The functions all work, and the images
are being read from the system, but I cannot get the image.source
part to work properly.
Any ideas/help would be gratefully appreciated. Thank you
very much, and apologies for the possible vague posting.
I think its because in the Loader's Event.Complete event
handler you are setting the source of the "image". But the "image"
object refers to only the last Image instance you added.
Event.Complete handler is not invoked unless the image is
loaded, by the time the handler is invoked the loop is completed
and so the "image" variable refers to the last instance of the
Image object created.
Even if the loop is not completed by the time the event
handler is invoked, variable "image" will definitely be pointing to
some other instance of the Image rather than the one we actually
want to have the source property set to.