r = Math.floor( Math.random() * 28 ) + 1;//1〜28までのランダム数を変数rに代入。
gotoAndStop(r);

こうかね。なんで1から画像を入れるのかよくわからんけど。