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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:22:02+00:00 2026-05-26T22:22:02+00:00

I am trying to get the cue to stop rotating when it is in

  • 0

I am trying to get the cue to stop rotating when it is in the MOUSE_DOWN event, but continue to add the distance of mouseX and mouseY to the distance of the cue from the cueball. In other words, for the cue to slide along the line the cue is aimed down.

    Cue.addEventListener(Event.ENTER_FRAME, aimCue);
    Cue.addEventListener(MouseEvent.MOUSE_DOWN,StartToShoot);
    addEventListener(Event.ENTER_FRAME,MoveBalls);

    public function aimCue(event:Event)
    {
        var dx:Number = Cueball.x - Cue.x;
        var dy:Number = Cueball.y - Cue.y;
        var angle:Number = Math.atan2(dy,dx);
        Cue.rotation = angle * 180 / Math.PI;
        Cue.x = mouseX;
        Cue.y = mouseY;
    }
    public function StartToShoot(event:MouseEvent)
    {
        var dx:Number = Cueball.x - mouseX;
        var dy:Number = Cueball.y - mouseY;
        var dist:Number = Math.sqrt(dx * dx + dy * dy);
        //Cue.x = dx + Cueball.x;
        //Cue.y = dy + Cueball.y;


        if (dist > 230)
        {
            Cue.startx = Cue.x;
            Cue.starty = Cue.y;

            Cue.addEventListener(Event.ENTER_FRAME,FinishShoot);
        }
    }
    public function FinishShoot(event:Event)
    {
        var dx:Number = Cueball.x - Cue.x;
        var dy:Number = Cueball.y - Cue.y;
        var dist:Number = Math.sqrt(dx * dx + dy * dy);

        if (dist < 230)
        {
            Cueball.vx = Cue.x - Cue.startx;
            Cueball.vy = Cue.y - Cue.starty;
            Cue.removeEventListener(Event.ENTER_FRAME,FinishShoot);
        }

    }
  • 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-05-26T22:22:02+00:00Added an answer on May 26, 2026 at 10:22 pm

    You could add a Boolean isShooting for instance. In your MOUSE_DOWN handler you can set it to true and within the aimCue you can check wether it’s true or not. When your done shooting, you can set it to false again.

    Cue.addEventListener(Event.ENTER_FRAME, aimCue);
    Cue.addEventListener(MouseEvent.MOUSE_DOWN,StartToShoot);
    addEventListener(Event.ENTER_FRAME,MoveBalls);    
    
    private var isShooting:Boolean = false;
    
    public function aimCue(event:Event)
    {
        if(!isShooting)
        {
            var dx:Number = Cueball.x - Cue.x;
            var dy:Number = Cueball.y - Cue.y;
            var angle:Number = Math.atan2(dy,dx);
            Cue.rotation = angle * 180 / Math.PI;
            Cue.x = mouseX;
            Cue.y = mouseY;
        }
    }
    public function StartToShoot(event:MouseEvent)
    {
    
        isShooting = true;
    
        var dx:Number = Cueball.x - mouseX;
        var dy:Number = Cueball.y - mouseY;
        var dist:Number = Math.sqrt(dx * dx + dy * dy);
        //Cue.x = dx + Cueball.x;
        //Cue.y = dy + Cueball.y;
    
    
        if (dist > 230)
        {
            Cue.startx = Cue.x;
            Cue.starty = Cue.y;
    
            Cue.addEventListener(Event.ENTER_FRAME,FinishShoot);
        }
    }
    

    For the logic to move your cue you could use something like this:
    (don’t forget to remove the stage listener when you’re finished shooting)

    private var storedPoint:Point;
    
    public function StartToShoot(event:MouseEvent)
    {
    
        isShooting = true;
    
        storedPoint = new Point(stage.mouseX, stage.mouseY);
    
        stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
    }
    
    private function onMouseMove(e:MouseEvent):void
    {
        var curPoint:Point = new Point(stage.mouseX, stage.mouseY);
        var distance:Number = Point.distance(storedPoint, curPoint);
    
        /* do stuff with the distance*/
    
        e.updateAfterEvent();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying get some licensing code from AndroidPit.com working, but I get Unable to
I am trying get the data from my database but i am not getting
Well, I'm trying get some values from places.sqlite database. But when I do $
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
Hi am trying get GPS using network provider and GPS provider. but am getting
I'm trying get only the Saturdays and Sundays between two dates, but I don't
I am trying get content from the link https://....com:8455 where Server's certificate is not
When I'm trying get method from remote webservice it gives me error. My code
Hello everyone I been trying get php uploader working but having a lot of
I'm trying get bytes from bitmap in blackberry using the next method in Bitmap:

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.