To get the last element of an array, use back[back.length-1]
, or if you want to remove the last element and get it back at the same time then back.pop();
. So in your case, that for cycle has no use, it's all wrong.. nonsense to check all the elements of an array in this case.
function Softkey3GoTo(event:MouseEvent):void
{
switch (currentLabel)
{
case "m_1":
case "m_2":
case "reply":
case "messages":
gotoAndStop(back[back.length-2]); // -2 because the current one is -1, the previous frame is -2.
break;
}
}