Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --# Main
- -- Appetizer 06 - http
- -- Bruce Elliott
- -- May 2013
- -- Use this function to perform your initial setup
- function setup()
- logoImage = nil
- print("Touch the screen to see openURL() in action.")
- print("There does not appear to be a way to return")
- print("to your Codea program.")
- print("http.request() has a parameter table.")
- print("I can not demonstrate that at this time.")
- http.request("htt://weather.com/images/maps/current/curwx_720x486.jpg", didGetImage, failure)
- -- http.request("http://weather.com/images/maps/current/curwx_720x486.jpg", didGetImage, failure)
- end
- function failure(value1)
- print("fail")
- print(value1)
- end
- function draw()
- background(53, 38, 38, 255)
- pushMatrix()
- spriteMode(CORNER)
- -- scale(2)
- if logoImage ~= nil then
- sprite(logoImage, 10,10,WIDTH)
- -- if value ~= nil then
- -- sprite(value, 10,98, WIDTH,HEIGHT)
- -- else
- -- ellipse(200,200,100)
- end
- popMatrix()
- end
- -- Our callback function
- function didGetImage( theImage, status, head )
- logoImage = theImage
- print(status)
- for k, v in pairs(head )do
- print(k.." "..v)
- end
- end
- function touched (touch)
- openURL("http:/twolivesleft.com")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement