Calling dispatchEvent with a parameter

Hello,

how can I send a parameter (Number) along with dispatchEvent, just like we were allowed to do with broadcastMessage(AS2):

myObj.broadcastMessage(“onBounceEffect”,parameter)

You can do that with a custom event - that’s typically how I deal with it.

edit:

Something like this:


package  
{
    import flash.events.Event;
    
    public class CustomChangeEvent extends Event
    {
        private var _customData:String;
        public static const CHANGE:String = "change";
        
        public function set customData(value:String):void
        {
            _customData = value;
        }
        
        public function get customData():String
        {
            return _customData;
        }
        
        public function CustomChangeEvent(type:String, myData:String, bubbles:Boolean = true, cancelable:Boolean = false) 
        {
            _customData = myData;
            super(CHANGE, bubbles, cancelable);
        }
        
    }
    
}

You would then dispatch like this:


dispatchEvent(new CustomChangeEvent(Event.CHANGE, myData));

I could be doing that totally wrong, but it seems to work for me.

to pass just text u can use builtIn TextEvent