newScrollView - inserted objects lose fill values

I have a weird problem, basically I have a number of white rectangular images arranged into a table, with text objects on top.

I then use setFillColor on these images to make each row a certain colour, this will be dynamic depending on what data is on that row.

That works fine if the images are just inserted into a normal display group, but when I insert them into a newScrollView, the first image object seems to inherit the alpha property of the ScrollView background, while the rest lose their setFillColor property and revert to white.

[lua]–create scrollGroup

scrollView = widget.newScrollView{
width = 480,height = hu, scrollWidth = 480, scrollHeight = 300,bgColor = {0,0,0,50}, maskFile=ms, listener = scrollViewListener}

–create images (extract)

local rd = math.random(100,255)
local gn = math.random(100,255)
local bl = math.random(100,255)

for b = 1, 9, 1 do
local i = display.newImageRect(“league_”…im[b]…".png", xs[b], 22)
i.x = xp[b] ; i.y = (a* 22); i.alpha = 1
i:setFillColor(rd,gn,bl) – random colours for now
tableGroup:insert(i)

content[no] = i

end

scrollView:insert(tableGroup) – same happens if objects added individually[/lua]

This is what the objects look like when not inserted in the scrollView:

When inserted in the scrollView:


[import]uid: 93133 topic_id: 33930 reply_id: 333930[/import]

I’ll try to get you a better answer, but if I understand it correctly, objects inside a group tend to inherit the group’s alpha/tint properties. Scrollviews are basically groups and that bgcolor with the alpha is probably interfering with other objects alpha and tinting.

[import]uid: 199310 topic_id: 33930 reply_id: 134912[/import]

Thanks for the reply. This can’t be expected behaviour - surely the background of the scrollView should be the equivalent of just inserting a background rect/image as the first object in a display group - setting the fillColor of that should not affect objects lying on top.

I’m not setting the alpha/tint properties of the scrollView - just the background. Hiding the background or having it alpha = 255 has the same effect.

I guess I’ll have to try the old scrollView library and see if that works any better, or else I’ll have to write my own which I could really do without having to do!

[import]uid: 93133 topic_id: 33930 reply_id: 134935[/import]

Hmm, did some digging and it seems this issue has been known for a while - namely that you can’t tint/alpha objects that have had a mask applied, whether directly or via a tableView/scrollView.

Seems to me like quite a hefty limitation. My only alternative at the moment is to make differently coloured bars rather than tinting white ones :frowning:

[import]uid: 93133 topic_id: 33930 reply_id: 134954[/import]

I’ll try to get you a better answer, but if I understand it correctly, objects inside a group tend to inherit the group’s alpha/tint properties. Scrollviews are basically groups and that bgcolor with the alpha is probably interfering with other objects alpha and tinting.

[import]uid: 199310 topic_id: 33930 reply_id: 134912[/import]

Thanks for the reply. This can’t be expected behaviour - surely the background of the scrollView should be the equivalent of just inserting a background rect/image as the first object in a display group - setting the fillColor of that should not affect objects lying on top.

I’m not setting the alpha/tint properties of the scrollView - just the background. Hiding the background or having it alpha = 255 has the same effect.

I guess I’ll have to try the old scrollView library and see if that works any better, or else I’ll have to write my own which I could really do without having to do!

[import]uid: 93133 topic_id: 33930 reply_id: 134935[/import]

Hmm, did some digging and it seems this issue has been known for a while - namely that you can’t tint/alpha objects that have had a mask applied, whether directly or via a tableView/scrollView.

Seems to me like quite a hefty limitation. My only alternative at the moment is to make differently coloured bars rather than tinting white ones :frowning:

[import]uid: 93133 topic_id: 33930 reply_id: 134954[/import]