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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:52:09+00:00 2026-05-10T20:52:09+00:00

I have a main canvas ‘blackboard’ in a panel, this canvas has itself several

  • 0

I have a main canvas ‘blackboard’ in a panel, this canvas has itself several children, like a toolbar (tiles), a label and some skinning.

The problem is that when I move to the rectangle tool and I start drawing rectangles if I want to change the tool when I click on an other tool such as ‘circle’ or ‘select’ the button won’t catch the click event, instead the canvas will catch the mouse down and start drawing.

Just like on the picture. So I am unable to change tool once I start drawing.

alt text http://www.freeimagehosting.net/uploads/397a7cd49e.png

How could I not make the canvas react when it is on a tool, or how could I make the button catch the click first and tell the canvas no to do draw anything.

Of course I could just put the toolbar somewhere else not on the canvas, but since space is important I would like the buttons to be on the canvas.

I am open to any suggestions.

=== Here are some code to show how it works internally. ===

<?xml version="1.0" encoding="utf-8"?> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"            xmlns:degrafa="http://www.degrafa.com/2007"           xmlns:comp="org.foo.bar.view.components.*"           layout="absolute"           title="Tableau">           <mx:Script>     <![CDATA[         import org.edorado.edoboard.ApplicationFacade;     ]]>     </mx:Script>          <mx:Canvas id="blackBoard">                         <degrafa:Surface id="boardSurfaceContainer">              skinning            </degrafa:Surface>          <!-- Tool bar -->         <comp:ToolbarView             id = "toolbar"            name = "toolbar"            verticalScrollPolicy="off"             horizontalScrollPolicy="off"            bottom="5"            right="5"            top="5"            direction="vertical"            width="30" />                        <mx:Label x="10" y="10" text="Label"  color="#FFFFFF" id="lbl"/>                     </mx:Canvas>  </mx:Panel> 

The toolbar is a list of buttons contained in a tile. The canvas ‘blackboard’ is linked to several events handling, in particular mouse up down and move for drawing shapes.

... boardCanvas.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);             boardCanvas.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); ...         private function handleMouseDown(event:MouseEvent):void {             // Get the current mouse location which may be adjusted to the grid             var selectPoint:Point = boardCanvas.globalToLocal(new Point(event.stageX, event.stageY));             startPoint = snapPoint(selectPoint.x, selectPoint.y);             boardView.lbl.text = '(' + startPoint.x +',' + startPoint.y + ')'; .... 

The toolbar also listen to clicks

<?xml version="1.0" encoding="utf-8"?> <mx:Tile xmlns:mx="http://www.adobe.com/2006/mxml">      <mx:Script>         <![CDATA[             import mx.charts.BubbleChart;             import org.edorado.edoboard.view.components.shapes.*;               public static const TOOL_CHANGE:String  = "toolChange";             public static const TEXT_TOOL:String  = "textTool";             public static const SELECT_TOOL:String  = "selectTool";             public static const RECTANGLE_TOOL:String  = "rectangleTool";                          private var b:Button = null;                          private function handleButtonClick(event:MouseEvent):void {                 trace("CLICKED  TOOL");                 // selectButton.dispatchEvent(new Event(TOOL_CHANGE, true, true))                  b = event.target as Button;                 b.dispatchEvent(new Event(TOOL_CHANGE, true, true));             }           ]]>     </mx:Script>                <!-- Use class facotry ? -->           <mx:Button id="selectButton"                      name="{SELECT_TOOL}"                      selectedUpSkin="assets.skins.ToolButtonSkin"                      width="30"                       height="30"                       styleName="selectButton"                       toolTip="selection"                       click="handleButtonClick(event); " />                      <mx:Button id="textButton"                      name = "{TEXT_TOOL}"                      selectedUpSkin="assets.skins.ToolButtonSkin"                      width="30"                       height="30"                       styleName="textButton"                        toolTip="text"                      click="handleButtonClick(event);" />                      <mx:Button id="rectButton"                       name = "{RECTANGLE_TOOL}"                      selectedUpSkin="assets.skins.ToolButtonSkin"                      width="30"                      height="30"                      styleName="rectButton"                      toolTip="rectButton"                      click="handleButtonClick(event);" /> </mx:Tile> 
  • 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. 2026-05-10T20:52:09+00:00Added an answer on May 10, 2026 at 8:52 pm

    Thanks, I found some similar post actualy i just listened for mouse down in my toolbar and stoped the event propagation so that the canvas dont catch it.

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

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Do you have the source code to the WCF service?… May 11, 2026 at 1:45 pm
  • added an answer When you delete an item from the file system it… May 11, 2026 at 1:45 pm
  • added an answer You might take a look at mergebin, a tool that… May 11, 2026 at 1:45 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.