Hi Alex,

Working at last! :)
that was the trick, I left the Piotr changes so we remove one HTML
dependency (RadioButtonIcon)
I was not setting up the listener you told me, and the clue was in your
last one.

COMPILE::JS
        override public function addEventListener(type:String,
handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object =
null):void
        {
            if (type == "click")
            {
                icon.addEventListener(type, handler, opt_capture);
            }
            else
            {
               super.addEventListener(type, handler, opt_capture,
opt_handlerScope);
            }
        }

and could remove all the dead code and do some cleaning :)

Thanks! :)



2017-02-03 18:21 GMT+01:00 Alex Harui <aha...@adobe.com>:

> I don't understand the changes you and Piotr have been making.
> -Why does RadioButtonIcon not extend EventDispatcher or UIBase?
> -Why did Piotr replace RadioButtonIcon with an HTMLInputElement?
> -Why are both of you calling the clickHandler?  It shouldn't be needed.
>
> I did not use Piotr's last change or yours.  Instead I commented out the
> one call to call clickHandler when the element dispatches a click:
>
> //element.addEventListener("click", clickHandler, false);
>
>
> Then I put in the following:
>
> override public function addEventListener(type:String, handler:Function,
> opt_capture:Boolean = false, opt_handlerScope:Object = null):void
> {
>   if (type == "click")
>     icon.element.addEventListener(type, handler, opt_capture);
>   else
>     super.addEventListener(type, handler, opt_capture, opt_handlerScope);
> }
>
> And everything appears to be working for me.  Please try it this way so I
> don't have to spend time debugging the recent changes you have made.  And
> if there is a problem, please explain as clearly as you can what the
> problem is.
>
> I'm assuming the code is setting up the DOM just like the "no-Flex"
> example I posted yesterday.  In that example, there appears to be enough
> code in the MDL JS file to make the RadioButtons function correctly
> without any FlexJS code involved.  So, in theory, all the FlexJS code
> should be doing is setting up the DOM correctly and then the getters and
> setters and event listeners should just be monitoring the DOM widgets and
> dispatching new events as needed.  I don't understand why the code in
> clickHandler should be needed at all.
>
>
> HTH,
> -Alex
>
> On 2/3/17, 12:30 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"
> <carlos.rov...@gmail.com on behalf of carlos.rov...@codeoscopic.com>
> wrote:
>
> >Hi Alex,
> >
> >for "App counter" I'm referring to the example in MDLExample or the same
> >in
> >MDLRadioButton example that I uploaded for Peter and you to check.
> >
> >I'm saying that click is working as you said, internaly to the class. I
> >don't recognize the code diff you post.
> >
> >this is the last one:
> >
> >COMPILE::JS
> >        override public function addEventListener(type:String,
> >handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object =
> >null):void
> >        {
> >            if (type == "click")
> >            {
> >                icon.addEventListener("click", clickHandler, false);   <--
> >this is working ok
> >            }
> >            else
> >            {
> >               super.addEventListener(type, handler);
> >            }
> >        }
> >
> >and
> >
> >COMPILE::JS
> >        public function clickHandler(event:Event):void
> >        {
> >            selected = !selected;   <-- this is called too as I click a RB
> >        }
> >
> >as I click In a radio button, I see clickHandler is called, but, in my App
> >the event is not reaching since the counter is not incremented
> >
> >I mean here one instance of RadioButton in the App is like this:
> >
> ><mdl:RadioButton groupName="g2" text="Black" click="counter7++"/>
> >
> ><js:Label text="RadioButtons throw 'click' event {counter7} times"/>
> >
> >and the label is not getting incremented.
> >
> >Hope is more clear now
> >
> >Thanks
> >
> >
> >2017-02-03 0:41 GMT+01:00 Alex Harui <aha...@adobe.com>:
> >
> >> What is the "App counter"?
> >>
> >> Without taking Piotr's or your changes and just doing the changes below,
> >> the click event counter increments as expected.
> >>
> >> -Alex
> >>
> >> diff --git
> >> a/frameworks/projects/MaterialDesignLite/src/main/
> >> flex/org/apache/flex/mdl/
> >> RadioButton.as
> >> b/frameworks/projects/MaterialDesignLite/src/main/
> >> flex/org/apache/flex/mdl/
> >> RadioButton.as
> >> index 0366013..001c587 100644
> >> ---
> >> a/frameworks/projects/MaterialDesignLite/src/main/
> >> flex/org/apache/flex/mdl/
> >> RadioButton.as
> >> +++
> >> b/frameworks/projects/MaterialDesignLite/src/main/
> >> flex/org/apache/flex/mdl/
> >> RadioButton.as
> >> @@ -321,7 +321,7 @@ package org.apache.flex.mdl
> >>              (icon.element as WrappedHTMLElement).flexjs_wrapper =
> this;
> >>              (radio as WrappedHTMLElement).flexjs_wrapper = this;
> >>
> >> -            element.addEventListener("click", clickHandler, false);
> >> +            //element.addEventListener("click", clickHandler, false);
> >>
> >>              return element;
> >>          };
> >> @@ -464,6 +464,15 @@ package org.apache.flex.mdl
> >>                  }
> >>              }
> >>          }
> >> +
> >> +               override public function addEventListener(type:String,
> >> handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object =
> >> null):void
> >> +               {
> >> +                       if (type == "click")
> >> +                               icon.element.addEventListener(type,
> >> handler, opt_capture);
> >> +                       else
> >> +                               super.addEventListener(type, handler,
> >> opt_capture, opt_handlerScope);
> >> +               }
> >> +
> >>          /**
> >>           * @param e The event object.
> >>           */
> >>
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Reply via email to