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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:32:44+00:00 2026-06-08T02:32:44+00:00

This problem has stopped development, and I can’t figure out what’s wrong. I’m not

  • 0

This problem has stopped development, and I can’t figure out what’s wrong. I’m not clear on how flex is connecting these two unrelated events. The Some1 Sprite dispatches a Some1Event.MOUSE_UP event on a MouseEvent.MOUSE_UP while stopping propagation of the MouseEvent. The parent of Some1, Some2 similarly dispatches a Some2Event.MOUSE_UP while stopping the MouseEvent.MOUSE_UP on Some2. The coercion error is between Some2Event and Some1Event. With this error I’ve tried the other #1034 solutions:

  1. Adding an instantiation of Some1Event and Some2Event in the main application.
  2. Wrapping with ‘new Event’ – I am unable to dispatch the event as type Event, as it has custom properties.

I’ve also tried the following code:

    import flash.utils.getQualifiedClassName;
    private var systemManager:SystemManager=new SystemManager;

    private function addEventTracer():void
    {
        systemManager.addEventListener(Some1Event.MOUSE_UP, eventTracer, true);
    }

    private function eventTracer(event:Event):void
    {
        trace("Got ", event.type, "from", event.target, "as",
            getQualifiedClassName(event));
    }

but it didn’t report anything.

While dispatching the event Some2Event, I get the error

TypeError: Error #1034: Type Coercion failed: cannot convert  ::Some2Event@117c6c831 to Some1Event.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at ::Some2/mouseUpHandler()[Some2.as:154]

The code is structured as Some2 (Sprite) has many children of Some1 (Sprite). In Some2, I am listening for a MouseEvent.MOUSE_UP event on the Some1 Sprite, and in that listener, stopping the propagation, and dispatching a custom Some2Event:

    private function mouseUpHandler(event:MouseEvent):void{
        event.stopImmediatePropagation();
        var ev:Some2Event=new Some2Event(Some2Event.MOUSE_UP);
        ev.node2=this;
        dispatchEvent(ev);

In Some2, I have the following registered event listeners:

    private function registerListeners():void
    {
        addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); //detects mouse up on Some2 Sprite
        addEventListener(Some1Event.MOUSE_UP, some1MouseUpHandler); //detects mouse up on Some1 Sprite, custom event, Some1 mouse up stopped in Some1
        addEventListener(Event.ADDED, addedHandler); //detecting add of child Some1
    }

The Some1Event and the Some2Event are nearly the same:

import flash.display.Sprite;
import flash.events.Event;


public class Some1Event extends Event
{

    public static const MOUSE_DOWN:String = "MOUSE_DOWN";
    public static const MOUSE_UP:String = "MOUSE_UP";

    public var node:Sprite;

    public function Some1Event(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
    {
        super(type, bubbles, cancelable);
    }
    public override function clone():Event
    {
        return new Some1Event(type, bubbles, cancelable);
    }

}

and Some2Event:

import flash.display.Sprite;
import flash.events.Event;

public class Some2Event extends Event
{
    public static const MOUSE_DOWN:String = "MOUSE_DOWN";
    public static const MOUSE_UP:String = "MOUSE_UP";

    public var node2:Sprite;

    public function Some2Event(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
    {
        super(type, bubbles, cancelable);
    }

    public override function clone():Event
    {
        return new Some2Event(type, bubbles, cancelable);
    }

}

Any help is definitely appreciated.

  • 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-08T02:32:46+00:00Added an answer on June 8, 2026 at 2:32 am

    Constants in Some1Event:

    public static const MOUSE_DOWN:String = "MOUSE_DOWN";
    public static const MOUSE_UP:String = "MOUSE_UP";
    

    Constants in Some2Event:

    public static const MOUSE_DOWN:String = "MOUSE_DOWN";
    public static const MOUSE_UP:String = "MOUSE_UP";
    

    The constant value is the same in each case. ‘MOUSE_DOWN’ or ‘MOUSE_UP’ . How do you expect Flex to tell the difference between the two? It can’t! Change the constant values to be unique

    In Some1Event:

    public static const MOUSE_DOWN:String = "MOUSE_DOWN_SOME1";
    public static const MOUSE_UP:String = "MOUSE_UP_SOME1";
    

    In Some2Event:

    public static const MOUSE_DOWN:String = "MOUSE_DOWN_SOME2";
    public static const MOUSE_UP:String = "MOUSE_UP_SOME2";
    

    Now Flex will view the two events as different / unique and won’t call a listener for one event when the other is dispatched.

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

Sidebar

Related Questions

This problem has been bugging me for a long time. For example, the code
This problem has bugged me so many times and i have now decided to
This problem has happened to me twice.Both times during programming with Borland C++.when i
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're
Premise This problem has a known solution (shown below actually), I'm just wondering if
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
Alright so this problem has been breaking my brain all day today. The Problem:
By some coincidence this problem has come up twice in the last week. A
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
Edit : The bug that caused this problem has been fixed. The @version tag

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.