Game Development Reference
In-Depth Information
local loader3 = UrlLoader.new(url, UrlLoader.POST, "my post data")
local loader4 = UrlLoader.new(url, UrlLoader.PUT, "my put data")
local loader5 = UrlLoader.new(url, UrlLoader.DELETE)
local headers = {
["Content-Type"] = "application/x-www-form-urlencoded",
["User-Agent"] = "Gideros Browser",
}
local loader6 = UrlLoader.new(url, UrlLoader.PUT, headers, "key=value")
We can set up listeners that listen for progress events, complete events, and error events. Each time
a chunk of data is received, the progress event is fired and the event object passes bytesLoaded and
. This can be used to track and display the progress in bytes or as a percentage. If there
Event.HEADING_UPDATE for the GPS and Event.LOCATION_UPDATE
end
function onLocationUpdate(event)
latitude = event.latitude
longitude = event.longitude
altitude = event.altitude
print(latitude, longitude, altitude)
end
function onHeadingUpdate(event)
local tHeading = event.trueHeading
local mHeading = event.magneticHeading
print(tHeading, mHeading)
end
geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate)
geolocation:addEventListener(Event.LOCATION_UPDATE, onLocationUpdate)
geolocation:start()
You can check the hardware if the GPS is available or if the user has enabled the GPS capability
by using the function isAvailable . You can also check for the heading details via the
isHeadingAvailable function on the geolocation objects.
 
Search WWH ::




Custom Search