Reputation: 103
I do not understand what is wrong with this code I get the error:"Attempt to index local 'image' (a nil value)"
local image = display.loadRemoteImage( "http://2.bp.blogspot.com/-LDaA7cP9MmA/Tddgg2e-HcI/AAAAAAAABoQ/xHH5Wau_V00/s1600/hello.png", "GET", networkListener, "helloCopy.png", system.TemporaryDirectory, display.contentCenterX, display.contentCenterY)
image.x = -100
Is there another way to move the image?
Upvotes: 0
Views: 100
Reputation: 3063
display.loadRemoteImage() does not return a display object. This is an asynchronous call. It returns immediately to your code and when the download completes, your listener function is called. At that point you have a display object but it's known as event.target in the listener function.
Once you have it in the listener function you can begin to manipulate it.
Upvotes: 2