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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:21:03+00:00 2026-05-30T23:21:03+00:00

This is NOT duplicate of my earlier post (its is slightly different) But this

  • 0

This is NOT duplicate of my earlier post (its is slightly different)

But this is similar issue with similar error but its not the same error

The error I am getting now is below while dispatching the custom event from my custom component

TypeError: Error #1034: Type Coercion failed: cannot convert events::MapEvent@a74ab51 to flash.events.MouseEvent.

     dispatchEvent(new MapEvent(MapEvent.CLICKED_ON_MAP));

Note: The error in my earlier post is giving below error message

Type Coercion failed: cannot convert flash.events::Event@81ecb79 to com.events.ShopEvent

The difference here are two things, the earlier error is while converting flash event to custom event and now this one is while converting custom event to flash event and secondly, I have no clue why it is trying to convert to the mouseevent where I am just dispatching my custom event with proper listeners.

Can some one correct me what I am doing wrong here.

This is my custome event

package events
{
    import flash.events.Event;

    import ui.map.MapElement;

    public class MapEvent extends Event
    {
        public static const NEW_ELEMENT_ATTACHED:String = "newElementAttached";
        public static const CLICKED_ON_MAP:String = "clickedOnMap";
        public static const CLICKED_ON_ELEMENT:String = "clickedOnElement";

        public var element:MapElement;

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

        override public function clone():Event{

            var c:MapEvent = new MapEvent(type, bubbles, cancelable);
            c.element = this.element;
            return c;
        }
    }
}

This is how I am dispatching the event from my custom component (WorldMap.as class file)

    private function clickHandler(e:MouseEvent):void{
        e.stopImmediatePropagation();
        trace("worldmap click handler");
        if (dragInProgress){
            /*trace ("stopping event propagation");*/
            dragInProgress = false;
            return;
        }else{
            trace("dispatching proxy click event");
            dispatchEvent(new MapEvent(MapEvent.CLICKED_ON_MAP));
        }
    }

I have declared [Event] metatag as well

[Event(name="newElementAttached", type="events.MapEvent")]
[Event(name="clickedOnMap", type="events.MapEvent")]
[Event(name="clickedOnElement", type="events.MapEvent")]

Finally the listener is attached in other component (controller.as)

        _userWorld.addEventListener(MapEvent.CLICKED_ON_MAP,clickedOnWorldMap);
        _userWorld.addEventListener(MapEvent.CLICKED_ON_ELEMENT,clickedOnElement);

    private function clickedOnWorldMap(e:MouseEvent):void{
        _draggingMapElement.hideBaseGrid();
        _draggingMapElement = null;
    }
    private function clickedOnElement(e:MapEvent):void{

    }
  • 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-30T23:21:05+00:00Added an answer on May 30, 2026 at 11:21 pm

    Its my bad. I fixed the silly bug.

    I changed the lister function definition. (Replace mouseevent to MapEvent)

        private function clickedOnWorldMap(e:MapEvent):void{
            _draggingMapElement.hideBaseGrid();
            _draggingMapElement = null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is not a duplicate post, i just done research but not helping. First,
This is not a duplicate of this post although the title is very similar.
I hope this question is not a duplicate but I didn't find anything equivalent
I am sorry if this is a duplicate but I was not able to
I saw this question and some similar and I think it's not duplicate :
I hope this is not an duplicate question, but a quick search didn't give
Note: Although at first similar, this is not a duplicate of Using Spring, JPA
PreNote: This is not a duplicate. I've checked several questions and mine is different
This is NOT a duplicate question, and the problem is driving me crazy. I
Nota: this is not a duplicate of Translating PHP date() for Multilingual Site .

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.