In textChangeHandler, are you sure "new Event" will resolve to org.apache.flex.events.Event and not flash.events.Event?
On 2/28/14 3:48 PM, "Carlos Rovira" <carlosrov...@apache.org> wrote: >Peter, Alex, > >I'm having problems with this issue, since I think there's no reference to >flash.events.Event (I was already aware of this restriction) in my >modifications in TextInput, so all should be FlexJS events >(org.apache.flex.events.Event). A similar example is in CheckBox >component. > >What I'm trying to do is make TextInput to throw "change" events when user >type a character (a classic Flex use case). In SWF the type coercion is >thrown. > >TypeError: Error #1034: Type Coercion failed: cannot convert >flash.events::Event@1093d2f71 to org.apache.flex.events.Event. > >Note: In JS updating the input text does nothing, although enter key is >performing the change and running changeHandler method in final app (I >suppose due to EditableTextKeyboardController) > > >Mis changes are basic. In TextInput.as, add the following lines: > >[Event(name="change", type="org.apache.flex.events.Event")] > >... > >private var _strand:IStrand; > >public function set strand(value:IStrand):void >{ > _strand = value; > > model = UIBase(_strand).model as ITextModel; > model.addEventListener("textChange", textChangeHandler); >} > >public function textChangeHandler(event:Event):void >{ > dispatchEvent(new Event("change")); >} > >what do you think about it? > >Thanks > > > > > >2014-02-27 20:33 GMT+01:00 Alex Harui <aha...@adobe.com>: > >> We're trying not to dispatch flash.events.Event in FlexJS (since there >> isn't an equivalent in JS). So the change event should be dispatching >> org.apache.flex.events.Event and the component's event metadata also >>needs >> to say that it is dispatching an org.apache.flex.events.Event and the >> event handling code should be importing and using >> org.apache.flex.events.Event instead of flash.events.Event. >> >> -Alex >> >> On 2/27/14 11:27 AM, "Carlos Rovira" <carlosrov...@apache.org> wrote: >> >> >Hi, >> > >> >I'm having a problem with FlexJS events. >> > >> >* In TodoListView (a extension of ViewBase) if I use in a component >> >something like: change="logTodo(event)" >> > >> >and the method is >> > >> >public function logTodo(event:Event):void { >> > // something >> >} >> > >> >a type coercion error is thrown that said org.apache.flex.events.Event >>is >> >not flash.events.Event >> > >> >I need to use: public function >> >logTodo(event:org.apache.flex.events.Event):void { ... } to make it >>work >> >or >> >it doesn't compile >> > >> >So it seems there's a scope problem in MXML, >> > >> >What do you think about it? >> > >> > >> >-- >> >Carlos Rovira >> >http://about.me/carlosrovira >> >> -- >> <http://about.me/carlosrovira> >> Carlos Rovira >> <http://about.me/carlosrovira> >> <http://about.me/carlosrovira>http://about.me/carlosrovira >> >>