It looks like you're new here. If you want to get involved, click one of these buttons!
i = 0 q = "" while (i<2) do local loader = UrlLoader.new("<a href="http://localhost/example.php"" rel="nofollow">http://localhost/example.php"</a><img class="emoji" src="http://forum.gideros.rocks/resources/emoji/wink.png" title=";)" alt=";)" height="20" /> local function onComplete(event) print(event.data) q = event.data end local function onError() print("error") end local function onProgress(event) print("progress: " .. event.bytesLoaded .. " of " .. event.bytesTotal) end loader:addEventListener(Event.COMPLETE, onComplete) loader:addEventListener(Event.ERROR, onError) loader:addEventListener(Event.PROGRESS, onProgress) i = i + 1 print ("q1 : " .. q) ---q is nil here .Why?? end print ("q : " .. q) -----q is nil here .Why?? |
Comments
The simple (and trite) answer is that "you told it to!" - not helpful I know it might be more helpful if you add in a couple more print statements and then copy and paste the output window contents.
It *might* be because event.data is nil because your local server might not have served the example.php file correctly. Try pinging http://google.com and see what you get back from there.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill