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

  • Home
  • SEARCH
  • 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 7762223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:20:32+00:00 2026-06-01T14:20:32+00:00

Hello I have the actionscript code here for a bubble popping game. When the

  • 0

Hello I have the actionscript code here for a bubble popping game. When the game starts, bubbles fall down from the top of the game to the bottom and score is kept for the most bubbles clicked or popped in 30 seconds.

The size of the bubble is defined by the initialize method in the code, and uses ToString() to calculate the score. ToString gives me a 1061: Call to a possibly undefined method Random through a reference with static type uint. This error which I cannot figure out where it comes from.

If anyone with experience in AS3 could give me some pointers to my faults, I would greatly appreciate it. Thank You.

package  {
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.media.Sound;

    public class Ball extends MovieClip{

        static public var burstCounter: uint;
        private var vx: Number;
        private var vy: Number;
        private var gravity: Number;
        private var stageWidth;
        private var stageHeight;
        private var bubble:Ball = new Ball();
        private var score: uint=0;

        public function Ball() {
            bubble.addEventListener(Event.ADDED_TO_STAGE, initialize)
            bubble.addEventListener(MouseEvent.CLICK, burst)
            bubble.addEventListener(Event.ENTER_FRAME, dropping)
        }

        public function initialize (e:Event):void
        {
            bubble.x = Math.random() * stageWidth;
            bubble.y = 0;

            stageWidth = stage.stageWidth;
            stageHeight = stage.stageHeight;

            bubble.vx = Math.random() * 2 - 1;
            bubble.vy = Math.random() * 2 + 1;
            gravity = 0.1;

            var sizeScale = Math.random() * 1.2 + .6;
            bubble.scaleX = bubble.scaleY = sizeScale;
            score = (10 / sizeScale);
            scoreValue.text = score.ToString();

            var colorTran = new ColorTransform();
            colorTran.color = Math.random() * 0xFFFFFF;
            transform.colorTransform = colorTran;
            addChild(bubble);
        }
        function dropping(e: Event) :void
        {
            x += vx;
            y += vy;
            vy += gravity;

            if((x<0) || (x>stageWidth) || (y<0) || (y>stageHeight))
            {
                if(parent != null)
                {
                    parent.removeChild(this);
                }
                removeEventListener(Event.ENTER_FRAME, dropping)
            }
        }
        function burst (e:Event):void
        {
            var ballonPopping: Sound = new BalloonPopping();
            bubble.removeEventListener(Event.ADDED_TO_STAGE, initialize);
            bubble.removeEventListener(Event.ENTER_FRAME, dropping);
            removeChild(bubble);

            ballonPopping.play();

            burstCounter += score;
        }
    }

}
  • 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-01T14:20:34+00:00Added an answer on June 1, 2026 at 2:20 pm

    You need to change each occurrence of

    Math.Random()
    

    to

    Math.random()
    

    note the lowercase r

    Or…since it looks like you just edited this question for ToString()

    Try

    toString()
    

    Notice how similar the errors are. You’re tying to call a method that doesn’t exist on both of these. Capitalization matters VAR is not the same as var

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

Sidebar

Related Questions

Hello I have the following php code here: $username = trim(mysql_real_escape_string($username)); $password = md5(trim(mysql_real_escape_string($password)));
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
Hello have only a few days with Java and android here. I am a
Hello I have a wordpress site than I want to upgrade to HTML5 code
Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello I have this in my code File file = new File(words.txt); Scanner scanFile
Hello only have a few hours with Java. (from Python) I am trying to
Hello I have the following piece of code and it won't post the data
Hello I have an edit item form. From this view, look at item.current_item_status_date .

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.