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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:55:37+00:00 2026-06-05T17:55:37+00:00

When creating a simple Flex 4.6 App, where the creationComplete-handler looks like this: protected

  • 0

When creating a simple Flex 4.6 App, where the creationComplete-handler looks like this:

protected function creationCompleteHandler(event:FlexEvent):void {
    var groupVisible : Group = new Group();
    groupVisible.graphics.beginFill(0xff0000);
    groupVisible.graphics.drawCircle(100, 100, 50);
    groupVisible.graphics.endFill();
    addElement(groupVisible);

    var groupInvisible : Group = new Group();
    groupInvisible.graphics.beginFill(0x0000ff);
    groupInvisible.graphics.drawCircle(200, 100, 50);
    groupInvisible.graphics.endFill();
    addElement(groupInvisible);
    groupInvisible.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {trace("click");});
}

The first groupVisible.graphics content (red circle at 100,100) is drawn.
The second groupInvisible.graphics content (blue circle at 200, 100) is NOT drawn.

It depends definately on that added EventListener.

Any ideas?

  • 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-05T17:55:39+00:00Added an answer on June 5, 2026 at 5:55 pm

    If you switch to a SpriteVisualElement instead of a Group, both items are displayed. On the plus side, the mouse click event will actually dispatched from a Sprite/SpriteVisualElement whereas they will not dispatch from a container. Since the Click event bubbles, it can be dispatched from elements inside the group, and listened to on the group level. But, graphics will not dispatch the click event.

    Anyway, here is some code:

    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                           xmlns:s="library://ns.adobe.com/flex/spark" 
                           xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
    
                import spark.core.SpriteVisualElement;
    
    
                protected function onMouseClick(event:MouseEvent):void{
                    trace('click');
                }
    
                override protected function createChildren():void{
                    super.createChildren();
                    var groupVisible :SpriteVisualElement = new SpriteVisualElement();
    
    //              var groupVisible : Group = new Group();
                    groupVisible.graphics.beginFill(0xff0000);
                    groupVisible.graphics.drawCircle(100, 100, 50);
                    groupVisible.graphics.endFill();
                    groupVisible.addEventListener(MouseEvent.CLICK, onMouseClick);
                    addElement(groupVisible);
    
    //              var groupInvisible : Group = new Group();
                    var groupInvisible : SpriteVisualElement = new SpriteVisualElement();
                    groupInvisible.graphics.beginFill(0x0000ff);
                    groupInvisible.graphics.drawCircle(200, 100, 50);
                    groupInvisible.graphics.endFill();
    //              groupInvisible.addEventListener(MouseEvent.CLICK, onMouseClick);
                    groupInvisible.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {trace("click");});
                    addElement(groupInvisible);
    
                }
    
            ]]>
        </fx:Script>
    
    </s:WindowedApplication>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating simple app on Silverlight 4. In folder of View I have
I have made a program in Flex for creating simple schedules, similar to MS
I would like to create simple C++ calculator using bison and flex. Please note
I am fairly familiar with creating simple custom controls, but I haven't had this
Creating simple app using GAE / Django-nonrel (I don't think the problem is specific
Creating some simple html pages specific for the iphone, and would like to use
i am creating simple dashboard view in which i using createDashboardItem function item has
I am creating simple pojo webservice like TemperatureConversion. I was able to make deploy
I am creating simple reports module by following this tutorial .When i try to
Creating a simple app that calculates the speed your going and displays it in

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.