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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:17:33+00:00 2026-05-13T11:17:33+00:00

In my AIR application I am having problems catching dispatched events in my eventmap.

  • 0

In my AIR application I am having problems catching dispatched events in my eventmap.
The class that is dispatching the events looks like this:

Shortcuts.as

[Event(name="centeredZoomOut", type="flash.events.Event")]

public class Shortcuts extends EventDispatcher
{
    // Event Names
    public static const CENTERED_ZOOM_OUT:String = "centeredZoomOut";

    public function Shortcuts(target:IEventDispatcher=null)
    {
        super(target);
        NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
    }

    private function onKeyUp(event:KeyboardEvent):void
    {
        this.dispatchEvent(new Event(CENTERED_ZOOM_OUT, true));
    }
}    

I know that the event is getting dispatched from debugging it, but it is not getting caught by the following eventmap.

ShortcutMap.mxml

<?xml version="1.0" encoding="utf-8"?>
<EventMap 
xmlns="http://mate.asfusion.com/"
xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import mx.events.FlexEvent;
        import models.Shortcuts;
    ]]>
</mx:Script>

<EventHandlers type="{ Shortcuts.CENTERED_ZOOM_OUT }">
    <MethodInvoker generator="{ShortCutExample}" method="showAlert" arguments="{['centeredZoom']}" />
</EventHandlers>

Here is the main application file called “ShortCutExample”

ShortCutExample.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication 
xmlns:mx="http://www.adobe.com/2006/mxml" 
xmlns:maps="maps.*"
layout="absolute"  
creationComplete="init()">

<mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import models.Shortcuts;

        private var shortcuts:Shortcuts;

        private function init():void
        {
            this.shortcuts = new Shortcuts();
        }

        public function showAlert(value:String):void
        {
            Alert.show(value);
        }
    ]]>
</mx:Script>
<maps:ShortcutMap/>

</mx:WindowedApplication>

Why is my eventmap not catching the event?

  • 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-13T11:17:33+00:00Added an answer on May 13, 2026 at 11:17 am

    Because I was not adding the object to the display list and it did not extend DisplayObject the dispatched events were not being caught by the eventmap. To solve this problem create a private variable of type GlobalDispatcher and dispatch your events from that variable.

    private var dispatcher:GlobalDispatcher = new GlobalDispatcher();
    ...
    this.dispatcher.dispatchEvent(new ShortCutEvent(ShortCutEvent.CENTERED_ZOOM_OUT, true));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AIR application with two DataGrids that I would like to export
I have an AIR application that I'm compiling to mobile. There is an iOS
I have an Air application that lets users import jpg, png and swf files
I have an adobe air application running on windows. I would like to call
I am going to be building an AIR application that shows a list (about
I am writing an Adobe AIR application that needs to build in a CI
I am creating a AIR application in flex. I have a textArea having a
I have an Adobe AIR application for Android. Using for this AIR 3.0 and
I have an AIR application that is downloaded from a webpage. In order to
I have AIR application that i have created. One of my customers wants me

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.