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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:31:33+00:00 2026-05-25T12:31:33+00:00

I have an actionscript class MyClass that extens NavigatorContent. I instantiate the class as

  • 0

I have an actionscript class MyClass that extens NavigatorContent. I instantiate the class as a custom MXML NavigatorContnent component for an Accordion component. MyClass has a Button component that I have tried to attach an event listener to. I want the event to bubble so that I can have the handler in the Accordion component.

MyClass

package comp
{

  import flash.events.Event;
  import flash.events.MouseEvent;

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

  public class MyClass extends NavigatorContent
  {

    public function MyClass()
    {
      super();
      btnSelect.addEventListener(MouseEvent.CLICK, selectClickDispatcher);
    }


    public function selectClickDispatcher(event:MouseEvent):void
    {
      event.currentTarget.dispatchEvent(new Event("selectEvent",true));
    }
  }
}

From here I have the instantiated component nested in the Accordion. I am pretty sure the problem is in this class definition because when I set a breakpoint at the selectClickHandler, the code does not break. In case I am wrong I will post the rest of the components.

Custom component named MySubComp.mxml

<comp:MyClass
    ...I have a few more spark components here and nothing else...
/>

Accordion

<mx:Accordion>

    <fx:Script> //omitted CDATA tags to save space
        protected function selectEventHandler(event:Event):void
        {
            Alert.show("Value Selected");   
        }
    </fx:Script>

        //custom components are in the navs package
        <navs:MySubComp selectEvent = "selectEventHandler(event)"/>

</mx:Accordion>
  • 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-25T12:31:34+00:00Added an answer on May 25, 2026 at 12:31 pm

    Your class either needs to extend a DisplayObject class, or directly inherit from EventDispatcher in order to be able to use events. Forget about implementing IEventDispatcher as there’s a special piece of black code somewhere that means that EventDispatcher is the only class that can set the target property of the Event class (I’ve tried it before).

    Consider using other alternatives. Events in Flash tend to be slow and create objects all the time. Callbacks are a good system if you need something simple.

    public class A
    {
        public var onSomething:Function = null;
        public function foo():void
        {
            if( this.onSomething != null )
                this.onSomething();
        }
    }
    
    public class B
    {
        public function B()
        {
            var a:A = new A;
            a.onSomething = this._somethingCalled; // set the callback
            a.init();
        }
    
        private function _somethingCalled():void
        {
            trace( "hello there" );
        }
    }
    

    You can also take a look at the Signals project: https://github.com/robertpenner/as3-signals/wiki

    Signals are vastly superior to normal Flash events, and there’s no restriction on the type of object that can use them (i.e. non-DisplayObject objects can still add event listeners and dispatch events). It’s also faster and has a smaller memory footprint.

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

Sidebar

Related Questions

Lets say I have an ActionScript class: MyClass and that class has data in
In the library, right-click on a movieclip that you have written an ActionScript class
I have an actionscript file that defines a class that I would like to
I have a custom class defined in Actionscript and I want to make an
I have an actionscript class in my flex app that looks like this: package
I have a dynamic ActionScript Class that is used to send parameters to a
I have a class member in an ActionScript 3 class that looks something like
I have a CircleButton class in Actionscript. I want to know when someone externally
I have an ActionScript 2.0 file that contains a small library. This library parses
For example, the following MXML script attaches a listener to a Button class: <mx:Button

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.