I don't think there's a good answer to this question. There's no way
to figure out via AS whether a component MIGHT dispatch a given event.

I did a search on livedocs to try to find all classes that dispatch a
change event. This only seems to include base classes, so subclasses
of any of these controls won't show up, so you'd hve to figure those
out. Also note that this doesn't mean that some classes might dispatch
other events that signify change that aren't specifically the same
"change" event. And these change events don't necessarily mean "user
input" either. All it means is that the component dispatches an event
called "change".

Here's the livedocs search:
http://livedocs.macromedia.com/cfusion/search/index.cfm?loc=en_us&term=site%3Alivedocs.macromedia.com%2Fflex%2F201++%22change%3DNo+default%22&action=Search

And here are the classes that come up:
mx.controls.RadioButtonGroup
mx.controls.sliderClasses.Slider (which means HSlider and VSlider as well)
mx.controls.ColorPicker
mx.containers.Accordion
mx.containers.ViewStack
mx.controls.DateChooser
mx.controls.NumericStepper
mx.controls.Button
mx.controls.DateField
mx.controls.PopUpMenuButton
mx.controls.ComboBox
mx.controls.TextInput 
mx.controls.TextArea
mx.controls.Tree
mx.controls.listClasses.ListBase (so that would mean all list controls
like List, TileList, DataGrid, etc)

So your best bet is probably to put together a more complete list of
each component you want to define as having "user input" and then just
check against that list using the "is" test as already mentioned. But
I think the basic answer to your question is no, there's no good way
to do this.

Doug



--- In flexcoders@yahoogroups.com, "Ralf Bokelberg"
<[EMAIL PROTECTED]> wrote:
>
> I guess the only way to do it reliable is to ask for the type.
> You can use if(  X instanceof Y)  for example
> 
> Cheers,
> Ralf.
> 
> On 2/6/07, gotgoose09 <[EMAIL PROTECTED]> wrote:
> >
> >   No one has done type checking like this before? If not, oh well. :)
> >
> > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> > "gotgoose09" <thegoosmans@> wrote:
> > >
> > > My current code now loops through the children of a container
and adds
> > > an event handler to each one to listen for a "change" event.
> > >
> > > However, I want to only add event handlers to UIComponents that have
> > > some sort of value that the user can change.
> > >
> > > Some examples of these components are: TextInput, ComboBox,
> > > RadioButton, CheckBox, ColorPicker, List, RichTextEditor, etc.
> > >
> > > My current code is something like this: (simplified)
> > >
> > > var component:UIComponent = container.getChildAt(i);
> > > if (component is Container)
> > > {
> > > // add event handlers to the container's children
> > > }
> > > else if (component is UIComponent && "enabled" in component)
> > > {
> > > // add an event handler to component
> > > }
> > >
> > > Unfortunately, this doesn't work for all the various input controls.
> > > e.g. The RichTextEditor is a Container, so the code tries adding
event
> > > handlers to it's children (I want an event handler on the actual
> > > RichTextEditor).
> > >
> > > Is there a reliable way of detecting a user editable control?
> > >
> > > Thanks in advance!
> > >
> >
> >  
> >
> 
> 
> 
> -- 
> Ralf Bokelberg <[EMAIL PROTECTED]>
> Flex & Flash Consultant based in Cologne/Germany
> Phone +49 (0) 221 530 15 35
>


Reply via email to