In this sample the OpenStreetMap Layer is added as basemap and World population layer which is a dynamic map service hosted on ArcGISOnline sample server is added as an overlay. Use the transparency slider to control the opacity of the overlay.Refer to this link for documentation on creating custom layer types
Change World Population layer transparency (0.3)