Hey Corona-users,
I don’t know if I should post this here in the “Network” section or in the “Widgets” section, I’ve just chosen for this one.
Ok, to start off, what am I trying to achieve? Using a json-file which got image-links, titles, descriptions, etc. in it, I want to display remoteImages (so images that are on the web, not on the device) and show them in a tableview. Showing the images ain’t the problem, but the positioning is at this moment. (Started with using local images, so just display.newImage which DID work). I’ve been trying for hours now to get them inside the tableview-rows but it just won’t work. To make things a bit clearer here is my code for rendering the rows of the tableview:
local function onRowRender( event )
local row = event.target
local rowGroup = event.view
filename[event.index] = string.match(news[event.index].thumbImg, "(%w+).png")
if display.contentScaleX \> 0.5 then
display.loadRemoteImage( news[event.index].thumbImg, "GET", networkListener2, filename[event.index] .. ".png", system.DocumentsDirectory, 0, 0 )
else
display.loadRemoteImage( news[event.index].thumbImg, "GET", networkListener2, filename[event.index] .. "-x2.png", system.DocumentsDirectory, 0, 0 )
end
local function networkListener2( event )
if ( event.isError ) then
print ( "Network error - download failed" )
else
event.target.alpha = 0
event.target.x = 0
event.target.y = 0
event.target:setReferencePoint(display.TopLeftReferencePoint)
transition.to( event.target, { alpha = 1.0 } )
rowGroup:insert( event.target )
end
print ( "RESPONSE: " .. event.response )
end
end
The images are showing but all at the same place, so not in the rows they need to be. On top of that, when I slide the tableview, all content moves (titles etc.) but the images don’t. A screenshot of my problem:
http://postimage.org/image/xdamug54x/
I think it’s got something to do with the rowGroup:insert( event.target )
but because saving the even.target to a variable or something like that won’t work, it won’t let me insert it into the rowgroup then.
I hope there is someone that can help me out with this!
Thanks in advance!
René [import]uid: 189912 topic_id: 33379 reply_id: 333379[/import]