I know what I am doing wrong must be simple, but I can't for the life of me get 
this event to fire.

In my Product object, when a user clicks the "Add To Quote" button it calls my 
addToQoute() function:

private function addToQuote(event:MouseEvent):void{
        dispatchEvent( new AddProductEvent(AddProductEvent.PRODUCT_ADDED, true, 
false) );
                        
        <some other code>
} // END addToQuote()

but I get a compile error: 1180: Call to a possibly undefined method 
dispatchEvent.

So I used an eventDispatcher:

private function addToQuote(event:MouseEvent):void{
        var dispatcher:EventDispatcher = new EventDispatcher();
        dispatcher.dispatchEvent( new 
AddProductEvent(AddProductEvent.PRODUCT_ADDED, true, false) );
                        
        <some other code>
} // END addToQuote()

which seems to call my Event class just fine:

package Classes.Events
{
        import flash.events.Event;
        import mx.collections.ArrayCollection;
        
        public class AddProductEvent extends Event {
                
        // Define static constant
        public static const PRODUCT_ADDED:String = "productAdded";
        
        public var result:Boolean;
        
                public function AddProductEvent(type:String, 
bubbles:Boolean=false, cancelable:Boolean=false) {
                        // Call the constructor of the superclass.
                        super(type, bubbles, cancelable);
                }
        }
}

but never fires the listener I added to my main app:

private function init(event:FlexEvent):void{
        addEventListener(AddProductEvent.PRODUCT_ADDED, addToQuote);

        <some other code>
} // END init()

What am I missing?

It's been one of those weeks already!!!!!

Mike



-------------------------------------------------------------

To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line



For more info, see http://www.affug.com

Archive @ http://www.mail-archive.com/discussion%40affug.com/

List hosted by http://www.fusionlink.com

-------------------------------------------------------------

Reply via email to