ScrollView- the icon inserted doesn't show on device

Hi all  :wink:

I used the scrollView to act as the sidebar (refer to this tutorial : http://coronalabs.com/blog/2014/08/19/tutorial-building-a-sliding-menu/)

In simulator everything is fine : a button to call the scrollView to appear - click button - perform action.

But when I test in device, the button inserted into the scrollView disappear >>> empty sidebar.

Any tips and solution about this?

Thanks in advance  :slight_smile:

Coding :

[lua]

function iconListener1( event )

if ( event.phase == “moved” ) then
local dx = math.abs(event.x - event.xStart )
if ( dx > 5 ) then
scrollView:takeFocus( event )
end

local options = {
effect = “fade”,
time = 100
}

elseif ( event.phase == “ended” ) then
– do action

timer.performWithDelay( 10, function() scrollView:removeSelf(); scrollView = nil; end )
print (“Close sidebar”)
end
return true

end

function showSlidingMenu( event )
if ( “ended” == event.phase ) then
scrollView = widget.newScrollView
{
top = 0,
left = 0,
width = 50,
height = H,
hideBackground = true
}

scrollView:setIsLocked( true)

local scrollViewBackground = display.newImageRect( “image/bar.png”,55,H)
scrollViewBackground.x = 25
scrollViewBackground.y = H/2
scrollView:insert( scrollViewBackground )
–generate icons

icon1 = widget.newButton
{ defaultFile = (“image/a.jpg”),
width = 50, height = 50,
onEvent = iconListener1
}

icon1.y = H * 0.2;

scrollView:insert(icon1)

icon2 = widget.newButton
{ defaultFile = (“image/b.jpg”),
width = 50, height = 50,
onEvent = iconListener2
}

icon2.y = icon1.y+icon2.height*1.3

scrollView:insert(icon2)

icon3 = widget.newButton
{ defaultFile = (“image/c.png”),
width = 50, height = 50,
onEvent = iconListener3
}

icon3.y = icon2.y+icon3.height*1.3

scrollView:insert(icon3)

end
return true
end
[/lua]

Just recheck again, not filename issue.  :slight_smile:

Any messages in your console log?

Need help with that?  http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

@Rob thanks for the suggestion :slight_smile: Had recheck my codes and discover that the issue is file name extension. I write “.png” but the one my member give me is “.PNG” and after I convert all into png file “.png” everything is working fine :slight_smile:

Just recheck again, not filename issue.  :slight_smile:

Any messages in your console log?

Need help with that?  http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

@Rob thanks for the suggestion :slight_smile: Had recheck my codes and discover that the issue is file name extension. I write “.png” but the one my member give me is “.PNG” and after I convert all into png file “.png” everything is working fine :slight_smile: