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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:54:51+00:00 2026-05-26T04:54:51+00:00

I have one strange problem, if I use graphics.lineTo while moving the mouse (

  • 0

I have one strange problem, if I use graphics.lineTo while moving the mouse (MOUSE_MOVE), the lines are created live. But if I change it to MOUSE_DOWN, the lines are straight, and unresponsive if the mouse is still being pressed.

Here’s an example:

        stage.addEventListener(MouseEvent.MOUSE_MOVE, follow);
        stage.addEventListener(MouseEvent.MOUSE_DOWN, draw);


    private function follow(e:MouseEvent){

        trace(e.localY);

        activeChalk.x = e.stageX;
        activeChalk.y = e.stageY;

    }


    private function draw(e:MouseEvent){

        trace(e.localY);

        activeChalk.x = e.stageX;
        activeChalk.y = e.stageY;
        board.graphics.lineTo(e.stageX,e.stageY);
    }

EDIT: I managed to make it to work using the following example:
http://www.foundation-flash.com/tutorials/as3drawingbymouse/

  • 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-26T04:54:52+00:00Added an answer on May 26, 2026 at 4:54 am

    Your application is fundamentally flawed in a variety of ways.

    Instead of going in to detail, here’s a very simply implementation of drawing:

    package
    {
        import flash.display.Graphics;
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.MouseEvent;
        import flash.geom.Point;
    
        [SWF(percentWidth = 100, percentHeight = 100, backgroundColor = 0xefefef, frameRate = 30)]
        public class Chalk extends Sprite
        {
    
            protected var lastPoint:Point;
    
            public function Chalk()
            {
                super();
    
                stage.scaleMode = StageScaleMode.NO_SCALE;
                stage.align = StageAlign.TOP_LEFT;
    
                initializeDrawing();
            }
    
            protected function initializeDrawing():void
            {
                stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
            }
    
            protected function mouseDownHandler(event:MouseEvent):void
            {
                stage.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    
                // mark mouse down location
                lastPoint = new Point(mouseX, mouseY);
    
                // listen for movement or up/out
                stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
                stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
                stage.addEventListener(MouseEvent.MOUSE_OUT, mouseUpHandler);
            }
    
            protected function mouseMoveHandler(event:MouseEvent):void
            {
                var g:Graphics = graphics;
                g.lineStyle(1, 0x0000ff);
    
                // draw line segment
                g.moveTo(lastPoint.x, lastPoint.y);
                g.lineTo(mouseX, mouseY);
    
                // mark end of line segment
                lastPoint = new Point(mouseX, mouseY);
            }
    
            protected function mouseUpHandler(event:MouseEvent):void
            {
                stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
                stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
                stage.removeEventListener(MouseEvent.MOUSE_OUT, mouseUpHandler);
    
                // prepare for next line
                initializeDrawing();
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem, I use wifstream a(a.txt); wstring line; while (a.good()) //!a.eof()
I have a strange 'problem' with one of my created queries. Given the next
We have very strange problem, one of our applications is continually querying server by
I have a very strange problem in a Flex 3.4 Datagrid. One of the
Hallo, I have a quite strange problem in one of my C++ projects: I
I have a very strange problem with Visual Source Safe. I use VSS as
I have a strange problem...I have a MySql db with some columns and one
I have a strange one. Create a new form. Then add the following function
This a bit of strange one.... We have an internal web app that runs
This is a strange one... In a windows forms app (VB.NET/VS 2005) I have

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.