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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:47:50+00:00 2026-06-09T17:47:50+00:00

Could you please take a look to my code below, I need to increase

  • 0

Could you please take a look to my code below, I need to increase the var misses by 1 every time the ball does not hit the goal area (it’s a penalty shootout game) but the matter is that it increases many times, this is the output message after making a trace for the variable value so you can have an idea:

It’s a fail 1
1
It’s a fail 2
2
It’s a fail 3
3
It’s a fail 4
4
It’s a fail 5
5
It’s a fail 6
6
It’s a fail 7
7
It’s a fail 8
8
It’s a fail 9
9
It’s a fail 10
10
And so on, my code is this and I’m pretty sure that the line affecting the result needed is the line stage.addEventListener(Event.ENTER_FRAME, onEnter); could you please give me some advice on how to work around this? Probably trying an alternative way to move the ball when is is moved in moveBall function? I have received a lot of help from you guys and I’m sorry for being so annoying, simply I’m still a newbie and get stuck at some points between my code and the ideas I have gathered so far. Here is my code

import flash.events.Event;
import flash.ui.Mouse;
import flash.geom.Point;
import flash.events.MouseEvent;

 var misses:int= 0;//Here the var used trying to put the game over when player misses 3 shoots
var cursor:MovieClip; // mouse will be converted to a cursor (aim) which is the spot ball must follow
var nowX:Number; ;// will be used to move the ball
var nowY:Number;// will be used to move the ball
var isUpdating:Boolean = false; // will be used to control mouse events and other later on
var isClipSync:Boolean = false; // will be used to control mouse events and other later on
const START_BALL_POINT:Point = new Point(296,353); // returning the ball to original positions
function initializeGame():void
 {   
cursor = new Cursor();
addChild(cursor);
cursor.enabled = false;
//Mouse.hide(); 
stage.addEventListener(MouseEvent.CLICK, dragCursor);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onCursorMove);
  }

  function onCursorMove(e:MouseEvent):void
  {
cursor.x = mouseX;
cursor.y = mouseY;
 }

function onEnter(e:Event):void
{
 isUpdating= true;

 if(pateador_mc.currentFrame == 19) 
 {
     pateador_mc.gotoAndStop(1);
 }
 //trace(pateador_mc.currentFrame);
 //

if(pateador_mc.currentFrame > 11)
    isClipSync = true;

 moveBall();
  }


  function dragCursor(event:MouseEvent):void
 {
if(isUpdating) return;

trace(isUpdating);
nowX = mouseX;
nowY = mouseY;

pateador_mc.play();
stage.addEventListener(Event.ENTER_FRAME, onEnter);// probably this is causing        multiple count of trace events when I try to gather the failed shoots
}

initializeGame();
var mouse=this.Mouse;

var speed:int = 800;
var ease:int = 4;
 var gravity:Number = 0.5;
function moveBall()
  {
if(!isClipSync) return;

bola.x += 0.2 * (nowX - bola.x);
bola.y += 0.2 * (nowY - bola.y);

if(Math.abs(nowX-bola.x)<1 && Math.abs(nowY-bola.y)<1) 
{
    stage.removeEventListener(Event.ENTER_FRAME, onEnter);
    isUpdating = false;
    isClipSync = false;
    var timer3:Timer = new Timer(3000,1);
    timer3.addEventListener(TimerEvent.TIMER, accionRepetida3);
    timer3.start();
    function accionRepetida3(e:TimerEvent)
    {
    bola.x = START_BALL_POINT.x;
    bola.y = START_BALL_POINT.y;}
}
if (bola.hitTestObject(goalie))
{

    gol_mc.play();  /// All good at this point
    red_mc.play();

}
//
  else
{

    misses++;
    trace("It's a fail", misses);


}

 }

I will really appreciate if some good pal takes the time to check on this, I promise when I get a better programmer I will help all those who need it.

Thanks again!

  • 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-09T17:47:52+00:00Added an answer on June 9, 2026 at 5:47 pm

    can you modify your code and give the output again?

    trace("It's a fail for barrier3", misses)
    trace("It's a fail for barrier2", misses) and so on.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please take a look at this sloppy code and explain to me
could somebody please take a look at this http://jsfiddle.net/bloodygeese/EzkFR/1/ My aim is to on
Could you please take a look at the harvard medical school website here http://hms.harvard.edu/
Please take a look at this piece of code. I'm allocating one byte for
http://jsfiddle.net/367ms/1/ Please take a look at my code. So what I want to achieve
Would someone please take a look at the following code fragments (all from one
Could someone please take a look at this ? You'll see the first alert
Hey guys, please take a look at my code and see what's wrong here.
Please take a look on the following pseudo-code: boolean blocked[2]; int turn; void P(int
Please, take a look at my code bellow. This part pops top view controller

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.