I'm beginning to wonder if the best solution is for the component to know all 
of the required information - it can be set up when it is instantiated. It 
seems to me that while in most scenarios extending the event payload may work 
it means that the order in which events are handled will be vitally important; 
furthermore you now need two event handlers to service a single event - one to 
extend the payload, one to actually handle the payload.

Paul
  ----- Original Message ----- 
  From: Fotis Chatzinikos 
  To: flexcoders@yahoogroups.com 
  Sent: Friday, November 07, 2008 4:23 PM
  Subject: Re: [flexcoders] Adding data to a bubbling event


  Hello Andrew, your solution sounds correct. 

  Another way would possibly be to check the parent component (and its parent) 
and manually set all 3 params in one go.



  On Fri, Nov 7, 2008 at 1:00 PM, greenfishinwater <[EMAIL PROTECTED]> wrote:

    I have some view components with are used in a heirarchy:

    Application
    Store
    Department
    Product

    Each component only knows about itself, so the data passed to the
    product view only contains product data, and does not contain the
    department or store that the product is within.

    When a product is clicked I dispatch a custom event
    'productSelectedEvent' giving the id of the product selected.

    What I also need is to have the department id and the store id, when
    the event bubbles up to the application. 

    Is it appropriate to have an event listener on 'productSelectedEvent'
    in the department view that adds the current department id to the
    event, and then similarly in Store add the store id to
    'productSelectedEvent'.

    The event 'productSelectedEvent' has 3 custom properties:
    productId
    departmentId
    storeId

    Thanks Andrew






  -- 
  Fotis Chatzinikos, Ph.D.
  Founder,
  Phinnovation
  [EMAIL PROTECTED], 
   

Reply via email to