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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:27:43+00:00 2026-05-15T11:27:43+00:00

I have a custom event class public class FFTDrawEvent extends Event { public static

  • 0

I have a custom event class

public class FFTDrawEvent extends Event {

    public static const DRAW_EVENT:String = "drawEvent";

    private var _param:Array = new Array();

    public function FFTDrawEvent(type:String, __param:Array, bubbles:Boolean=true, cancelable:Boolean=false) {
        _param = __param;
        super(type, bubbles, cancelable);
    }

    public function get param():Array {
        return _param;
    }
}

This event is dispatched by a class, that extends EventDispatcher:

public class ToneGenerator extends EventDispatcher {

 public function someFunction():void {

 this.dispatchEvent(new FFTDrawEvent(FFTDrawEvent.DRAW_EVENT,_param));
}

Another class listen to this event. This class is extending SpriteVisualElement.

public class SpectrumVisualizer extends `SpriteVisualElement`:
{
    public function SpectrumVisualizer()
    {
        this.addEventListener(FFTDrawEvent.DRAW_EVENT, draw);
    }

Unfortunately this doesn’t work. The event is dispatched (returns with true), but the Event listener is never triggered.

Both class (Dispatcher & Listener) are Child class of a MXML application. Also listen to the event in the parent MXML application doens’t work. Listen to the event in the dispatching class itself somehow works.

I have to feeling that the EventDispatcher class is not the right one to dispatch events to a mxml application or respectivly AS classes, which extend/inherent from a MXML component class.

Anybody can help me with that?

  • 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-15T11:27:44+00:00Added an answer on May 15, 2026 at 11:27 am

    You should listen for events on the dispatcher. In your case, an instance of ToneGenerator is dispatching the event and SpectrumVisualizer is listening – it wouldn’t work.

    Listen to the event in the dispatching class itself somehow works.

    That’s the only way it would work.

    When you call

    this.addEventListener(FFTDrawEvent.DRAW_EVENT, draw);
    

    you are telling this object to call this.draw method whenever it (the this object) dispatches an event of type FFTDrawEvent.DRAW_EVENT. Change it to

    toneGen.addEventListener(FFTDrawEvent.DRAW_EVENT, draw);
    

    Now you are telling toneGen object to call this.draw method whenever it (the toneGen object) dispatches an event of type FFTDrawEvent.DRAW_EVENT.

    You can also do the following from the parent mxml.

    toneGen.addEventListener(FFTDrawEvent.DRAW_EVENT, specVis.draw);
    

    Call specVis.draw method whenever the toneGen object dispatches an event of type FFTDrawEvent.DRAW_EVENT.

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

Sidebar

Related Questions

Say I have two classes which extend Event : public class CustomEventOne extends Event
I have created a custom event in my Qt application by subclassing QEvent. class
I have created a custom event in flex 3.5. But the handler is not
I am making a custom Listbox (for the compact framework). I have made an
Does anyone know any trick I could use to keep the Derived class until
I havea a UserControl1 (in witch I have an Label1 ) in Form1 .
I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008,
I've done a lot of reading through forum posts and tutorials, but I still
There's a standard pattern for events in .NET - they use a delegate type

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.