Thanks in advance for any help, bit of a newb here.
I have been able to successfully pull a static image from a remote server and load it into my app, however the next step is to randomly pull the image.
Again I have been able to do this locally but am lost as to how to include the randomization in the url. Below is what I've used to successfully pull 2.png and load it (obviously with additional networking code.
1 | network.download( "http://mydomain.com/2.png", "GET", networkListener, "2.png", system.TemporaryDirectory ) |
Try this
1 2 | local r = math.random ( 1, 10 ) network.download( "http://mydomain.com/"..r..".png", "GET", networkListener, "2.png", system.TemporaryDirectory ) |
Darci,
Thank you so much!,, I was missed the ..rr.. .
THanks again
HI all again,
Darci thanks again for the help,
I have another issue.
I load the game and pull the image from the server without any problems.
Problem is when using director to reload the scene the remote image download fails to pull another random image,
Here is my Director call
1 2 3 4 5 6 7 8 9 10 11 12 | function button:touch(event) local phase = event.phase if "began" == phase then print("Someone touched me!") goToScene = "Game1" fxMode = "fade" director:changeScene( "Game1" ) end end button:addEventListener( "touch", button ) |
Mklein,
Unfortunately I don't know much about the director class or how it works so I won't be much help there.