Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i = 1,5 do
- local function networkListener( event, urlOfImage )
- if ( event.isError ) then
- print( "Network error - download failed: ", event.response )
- elseif ( event.phase == "began" ) then
- print( "Progress Phase: began" )
- elseif ( event.phase == "ended" ) then
- print( "Displaying response image file" )
- -- myImage = display.newImage( event.response.filename, event.response.baseDirectory, 60, 40 )
- imageContent = display.newImageRect(contentGroup, event.response.filename,event.response.baseDirectory, 100, 100);
- imageContent.x = -display.contentWidth/3
- imageContent.y = 5+(110+10)*(i-1)
- contentGroup.x = display.contentCenterX
- -- contentGroup.y = (110+10)*(i-1)
- scrollView:insert(contentGroup)
- end
- end
- local contentGroup = display.newGroup()
- local backgrRect = display.newRect(contentGroup, 0, 5, display.contentWidth, 110 ):setFillColor(0.4)
- local textTitle = jsonData[i].name
- local textTitleObject = display.newText(contentGroup, textTitle, 110, -20, 300, 50, "Helvetica", 20)
- local textDescr = jsonData[i].description
- local textDecsrObject = display.newText(contentGroup, textDescr, 60, 25, 200, 50, "Helvetica", 14)
- local params = {}
- params.progress = true
- local urlOfImage = jsonData[i].img
- -- local urlOfImage = "http://docs.coronalabs.com/images/simulator/image-mask-base2.png"
- print(urlOfImage)
- print("check")
- contentGroup.x = display.contentCenterX
- contentGroup.y = (110+10)*(i-1)
- scrollView:insert(contentGroup)
- params =
- {
- }
- params[i] = urlOfImage
- print("Param"..i,"=",params[i])
- network.download(
- urlOfImage,
- "GET",
- networkListener,
- params,
- "helloCopy.png",
- system.DocumentsDirectory
- )
- -- local imageContent = display.newImageRect(contentGroup, "img/img1.jpg", 100, 100);
- -- imageContent.x = -display.contentWidth/3
- -- imageContent.y = 5
- local options =
- {
- effect = "fade",
- time = 400,
- params = {
- iCount = i,
- textT = textTitle,
- descrD = textDescr
- }
- }
- contentGroup:addEventListener("tap",
- function(event)
- -- composer.showOverlay("scenes.activity")
- -- composer.gotoScene("scenes.activity", options)
- print("hello")
- end
- );
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement