Optical properties of armchair graphene nanoribbons embedded in hexagonal boron nitride lattices