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 8396179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:28:26+00:00 2026-06-09T20:28:26+00:00

I have a movie clip (goalkeeper) with different positions in different frames (inside), I

  • 0

I have a movie clip (goalkeeper) with different positions in different frames (inside), I would like to play a random frame after executing a function to make the goalkeeper move to a determinate position, there are 6 frames with 6 different positions so I need to play 1 position randomly, this is the code that should go to the random number after ball is kicked:

  function moveBall()
  { 
var targetX:Number = mouseX;
var targetY:Number = mouseY;
var angle = Math.atan2(targetY,targetX);
ball.x =  mouseX + Math.cos(angle);
ball.y =  mouseY + Math.sin(angle) ;
ballRotation = true;

if (ballRotation==true)
{


    goalkeeper_mc.gotoAndStop( Random Frame);//Here is when I need to go and play the random frame everytime function is executed


}

Thanks a lot for your help guys, sorry for bothering again, I searched the web for some examples but I found many of them really complicated for a newbie like me.

  • 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-09T20:28:27+00:00Added an answer on June 9, 2026 at 8:28 pm

    refer a following code.

    you must randomize from 1 frame to last Frame.

    Math.random () of the range is greater than 0 and less than 1(floating-value). by use it implements available.


    function moveBall()
    { 
        var targetX:Number = mouseX;
        var targetY:Number = mouseY;
        var angle = Math.atan2(targetY,targetX);
        ball.x =  mouseX + Math.cos(angle);
        ball.y =  mouseY + Math.sin(angle) ;
        ballRotation = true;
    
        if (ballRotation==true)
        {
            goalkeeper_mc.gotoAndStop(int(Math.random * (goalkeeper_mc.totalFrames)+1));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mainMovie clip that consist of different movie clips. Inside of my
I have a dynamic text field (textLabel) inside a Movie Clip (textMC). I am
I have an AS3 movie clip that I want to return to first frame
Im having some trouble getting the syntax right. I have a movie clip that
So, I'm building stuff in AS3, I have a main movie clip, and I
very often I like to have my movieclip code inside the movieclip (on a
I have a movie clip named button1 and in this movie clip there is
I have a movie clip who is only a square, i need to copy
I have placed a movie clip on the main timeline, with instance name sq_mc
I have a movie clip object with a width of 306 and height of

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.