Hi
Andrew, what I think is that u want here, is to pass some
parameter(s) along with the custom-event. If thats the case, then the
sample below should help:
1. Create a custom package, eg:
package com.joy9977.events
{
import flash.events.Event;
/**
* Custom-event to pass 'Parameter' along with the Event.
* @author [EMAIL PROTECTED]
*
*/
public class EventParam extends Event
{
// Properties
public var arg1:*;
public var arg2:*;
public static const HAS_PARAM:String = "hasParam";
// Constructor
public function EventParam(type:String, argument1:*,
argument2:*)
{
arg1 = argument1;
arg2 = argument2;
super( type, true, false );
}
// Override clone
override public function clone():Event
{
return new EventParam(type, arg1, arg2);
}
}
}
2. Dispatch an event. Import the package in your app:
import com.joy9977.events.EventParam;
dispatchEvent( new EventParam( EventParam.HAS_PARAM, param1, param2) );
3. Import the package in your app:
import com.joy9977.events.EventParam;
.
.
this.addEventListener( "hasParam", paramHandler);
.
.
.
private function paramHandler( evt:EventParam ):void
{
param1 = evt.arg1;
pamar2 = evt.arg2;
}
........ u r done.
--- In [email protected], "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
>