[AS2 - Flash CS5] Need help with Random frames please =)

Good morning people! this is my first post here in the forum, i need help with a quiz game im doing, im actually a newbie i’ve been learning along with this but this random frame thing i can’t do it x.x so here is the thing:

I have a 14 frames flash

on frame 2 it’s the “CORRECT ANSWER” page with a NEXT button that will take me to a random frame between 5 and 14 with the following coding (took it from another site and modified it):

coding for the frame

// random frames
var myarr=[0,1,2,3,4,5,6,7,8,9];
index = Math.ceil(Math.random() * 10);
num = myarr.splice(index, 1)[0];
function findNewFrame() {

    if(myarr.length == 0)
        gotoAndStop(num + 5);


coding for the button


so, it does splice the value from the Array and it does take me to a random frame but the moment i go to the other frame (ex: frame 7 that has a button with on(release){gotoAndStop(2);}) it loads again the Array with the number 7 in it, (Array resets) how can i prevent this?

I hope i’ve explained myself my english kind of sucks :hang: and thanks for your replies in advance!