Alex, I now tried to fully qualified the event thrown and the result is the same.
I uploaded the TextInput modifications in a commit (dc2d8364393aa29df8c38f3fb91082bfab4f6036) could you take a look and let me know what you think. I'm doing something wrong? it's a bug? (I uploaded some changes to TodoList sample and you can see the use case in TodoListView,mxml) Thanks for your help Carlos 2014-03-01 11:05 GMT+01:00 Carlos Rovira <carlos.rov...@codeoscopic.com>: > Hi Alex, > > in the class file only flexjs event is imported, so it should be that one > and not flash event. If this is not what is happening, I think we have a > bug in the compiler. I should not need to use a fully qualified name each > time I use a event to ensure the right event. what do you think? > > > 2014-03-01 0:55 GMT+01:00 Alex Harui <aha...@adobe.com>: > > 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 >> >> >> >> >> >> > > > -- > Carlos Rovira > Director de TecnologĂa > M: +34 607 22 60 05 > F: +34 912 94 80 80 > http://www.codeoscopic.com > http://www.directwriter.es > http://www.avant2.es > -- Carlos Rovira Director de TecnologĂa M: +34 607 22 60 05 F: +34 912 94 80 80 http://www.codeoscopic.com http://www.directwriter.es http://www.avant2.es