Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:34:40+00:00 2026-06-13T11:34:40+00:00

I have 3 movieclips, each one has 7 frames and labels that play different

  • 0

I have 3 movieclips, each one has 7 frames and labels that play different images, I want to stop each one randomly, but never have them equal the same frame. I was thinking array.push once its called, but I dont know how to do that. So I have this so far:

function startGame(event:MouseEvent)
{
    addChild(level6_mc);
    addChild(inGameNav_mc);
    level6_mc.gotoAndPlay(2);
    var timer = setTimeout(startAgain, 1000);
    startAgain();
}


// level 6
function startAgain()
{
    var randomNumber:Number= Math.floor(Math.random()*7);
    var door1 = level6_mc.door1_mc;
    var door2 = level6_mc.door2_mc;
    var door3 = level6_mc.door3_mc;
    door1.gotoAndStop(randomNumber);
    door2.gotoAndStop(randomNumber);
    door3.gotoAndStop(randomNumber);
}

there has to be an easy way for this, I just cant figure it out. I have been looking all over the net for a solution, but every method is just so complicated. Can anyone help me find a simple solution, and if you tell me to use an array can you please give example. Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:34:42+00:00Added an answer on June 13, 2026 at 11:34 am

    I would opt for an approach like this:

    function startGame(event:MouseEvent){
        addChild(level6_mc);
        addChild(inGameNav_mc);
        level6_mc.gotoAndPlay(2);
        var timer= setTimeout(startAgain, 1000);
        startAgain();
    }
    
    function startAgain(){
        var randomFrames:Array = getRandomFrames(3);
        var door1 = level6_mc.door1_mc;
        var door2 = level6_mc.door2_mc;
        var door3 = level6_mc.door3_mc;
        door1.gotoAndStop(randomFrames[0]);
        door2.gotoAndStop(randomFrames[1]);
        door3.gotoAndStop(randomFrames[2]);
    }
    
    
    /*
       Given input of 3, the return should be an array of integers randomly 
       chosen from the array defined by `frames`.  An example would be `[5,2,7]`
    */
    function getRandomFrames(var $frameCount:Number):Array {
        var frames:Array = [1, 2, 3, 4, 5, 6, 7]
        var randomFrames:Array = new Array(Math.min($frameCount, frames.length));
    
        var pos:Number = 0;
        for (var i:int = 0; i < randomFrames.length; i++)
        {
            pos = int(Math.random() * frames.length);
            randomFrames[i] = frames.splice(pos, 1)[0];
        }
        return randomFrames
    }
    

    I don’t have Flash on this machine, so I can’t test. But the idea is that you have an array of frame numbers, 1-7 and you randomly choose 3 of those numbers to be your stop frames.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Flash project I have a movieclip that has 2 keyframes. Both frames
I have 3 movieclips and each has a textbox as a child. I set
I have a bunch of movieclips that are animated using TweenLite, (code below), but
My stage have 3 movieclip that is mc1,mc2 and mc3. each of them are
I have some MovieClips that act like buttons, how can i do that when
Hi i have some movieclips like this one: game_mc.substage_mc.rightHand and inside the rightHand i
I have a MovieClip that I want the user to be able to drag
I have 5 movieclips called row1, row2, ..., row5. Inside each row are the
As the title shows, I have 2 container MovieClips (mc1, mc2), each of them
I have a method which registers an event listener to each of the MovieClips

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.