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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:38:46+00:00 2026-05-10T16:38:46+00:00

I have a Flex application where I’m using a Canvas to contain several other

  • 0

I have a Flex application where I’m using a Canvas to contain several other components. On that Canvas there is a Button which is used to invoke a particular flow through the system. Clicking anywhere else on the Canvas should cause cause a details pane to appear showing more information about the record represented by this control.

The problem I’m having is that because the button sits inside the Canvas any time the user clicks the Button the click event is fired on both the Button and the Canvas. Is there any way to avoid having the click event fired on the Canvas object if the user clicks on an area covered up by another component?

I’ve created a simple little test application to demonstrate the problem:

<?xml version='1.0' encoding='utf-8'?> <mx:Application xmlns:mx='http://www.adobe.com/2006/mxml' layout='absolute'>     <mx:Script>         <![CDATA[             private function onCanvasClick(event:Event):void {                 text.text = text.text + '\n' + 'Canvas Clicked';             }              private function onButtonClick(event:Event):void {                 text.text = text.text + '\n' + 'Button Clicked';             }         ]]>     </mx:Script>      <mx:Canvas x='97' y='91' width='200' height='200' backgroundColor='red' click='onCanvasClick(event)'>         <mx:Button x='67' y='88' label='Button' click='onButtonClick(event)'/>     </mx:Canvas>     <mx:Text id='text' x='97' y='330' text='Text' width='200' height='129'/> </mx:Application> 

As it stands when you click the button you will see two entries made in the text box, ‘Button Clicked’ followed by ‘Canvas Clicked’ even though the mouse was clicked only once.

I’d like to find a way that I could avoid having the second entry made such that when I click the Button only the ‘Button Clicked’ entry is made, but if I were to click anywhere else in the Canvas the ‘Canvas Clicked’ entry would still appear.

  • 1 1 Answer
  • 1 View
  • 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-10T16:38:46+00:00Added an answer on May 10, 2026 at 4:38 pm

    The event continues on because event.bubbles is set to true. This means everything in the display heirarchy gets the event. To stop the event from continuing, you call

    event.stopImmediatePropagation() 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have flex application consisting of several modules which is configured using maven. I'm
I have a flex 3 application that creates an Image from a canvas which
We have a Flex application which has several 'pages' worth of content. Each time
I have a flex application that loads swf files and displays them using the
I have a Flex application that seems larger than it should be. There is
I have a flex application that has a button that calls a URL. The
I have a Flex application that calls a function which searches a large document
We have a flex application that connects to a proxy server which handles authentication.
I have a Flex application that connects to a BlazeDS server using the StreamingAMF
I have a portlet. Inside of this portlet I have Flex application that displays

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.