Robert,
So I found out what the problem was.
Because I have more than one Dynamic layer in the operational layers list the if statement needed adjusting to:
if (m_operationalLayerIndex >= m_operationalLayers.length)
{
m_operationalLayerIndex = m_operationalLayers.length-1;
}
This assumes the Feature Layer is always at the bottom of the list.
Thanks again for your help with this.
Tom