should be like this:

frameNo = (int)((float)actDist / ( (float)maxDist / (float)( frameCount - 1 ) ))+1