I can't provide objective reasons to not do it apart from it messes up OO.
You are listening to object's events and suddenly you force it to dispatch
something.
I'd better derive DataGrid class in something like AnotherSpecialDataGrid
and in subclass override selectedIndex setter:

override public function set selectedIndex(value : int) : void {
super.selectedIndex = value;
if (value == 0) {
 dispatchEvent(new Event(Event.CHANGE));
}
}

R.

On 29 Mar 2007 21:49:33 -0700, Alex Harui <[EMAIL PROTECTED]> wrote:

   You can fake the event.

var event:ListEvent = new ListEvent("change");
myGrid.dispatchEvent(event);

If any code is sensitive to the properties in the event you'll have to
fill those in.

 ------------------------------
*From:* [email protected] [mailto:flexcompone
[EMAIL PROTECTED] *On Behalf Of *dorkie dork from dorktown
*Sent:* Thursday, March 29, 2007 7:15 PM
*To:* [email protected]
*Subject:* [flexcomponents]Force a change event programmatically

 Let's say I am trying to force a DataGrid or any component to dispatch a
change event to trigger some listeners. When I do this in code the event is
never trigger. I remember reading about this and some methods you can pass
in an argument to dispatch the event. I realize its a benefit to not
dispatch an event in most situations but I have one that I would like to
dispatch an event. Unfortunately I do not see a default way to dispatch an
events on UIComponents.

// for example how would i trigger an event when selecting the first item
in a grid
myGrid.selectedIndex = 0;


Reply via email to