Hi,
Well, that's how I left it:

package com.mjesteve.jewel.beads.controls
{
        import org.apache.royale.jewel.Label;
        import org.apache.royale.events.MouseEvent;
        import org.apache.royale.jewel.beads.controls.Badge;

        [Event(name="click", type="org.apache.royale.events.MouseEvent")]

        /**
         *  The Badge class provides a small status descriptors for UI elements.
         *
         *  A Badge is an onscreen notification element consists of a small 
circle,
     *  typically containing a number or other characters, that appears in
     *  proximity to another object
         *
         *  The BadgeOnClick class is a Badge extension that dispatches the 
MouseClick Event.
         *
         *  @langversion 3.0
         *  @playerversion Flash 10.2
         *  @playerversion AIR 2.6
         *  @productversion Royale 0.9.6
         */
        public class BadgeOnClick extends 
org.apache.royale.jewel.beads.controls.Badge
        {
                /**
                 *  constructor.
                 *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion Royale 0.9.6
                 */
                public function BadgeOnClick()
                {
                        super();
                }
                /**
                 * used to create the badge ui element
                 * that will be a Label
                 */
                override protected function createBadge():Label
                {
                        var tmpbadge:Label = super.createBadge();

                        tmpbadge.addEventListener("click", function():void{
                                dispatchEvent(new MouseEvent("click"));
                        });
                        return tmpbadge;
                }
        }
}

@Carlos, I haven't been able to get it to work by changing this:

        > you can change:
        >
        > var badge:Label = new Label();
        > badge.typeNames = "jewel badge";

        > with just:
        > super.createdBadge();

If my modification is not correct, please tell me.
Thx.
Hiedra.

-----Mensaje original-----
De: Maria Jose Esteve <[email protected]> 
Enviado el: miércoles, 3 de febrero de 2021 3:06
Para: [email protected]
Asunto: RE: Extends Jewel Badge

Thanks Carlos, I just saw your commit, I'll review it tomorrow.

Hiedra.

-----Mensaje original-----
De: Carlos Rovira <[email protected]> Enviado el: martes, 2 de febrero de 
2021 18:30
Para: Apache Royale Development <[email protected]>
Asunto: Re: Extends Jewel Badge

Hi Maria Jose,

yes a bead could be convenient for some uses.

you can change:

var badge:Label = new Label();
badge.typeNames = "jewel badge";

with just:

super.createdBadge();

also this will not be needed:

public override function set strand(value:IStrand):void
                {
                        super.strand = value;
                }

thanks

El lun, 1 feb 2021 a las 22:18, Maria Jose Esteve (<[email protected]>)
escribió:

> Hello again, I have rectified the bead, maybe now it is more correct?
> (I share it in case someone is interested.)
>
>         import org.apache.royale.core.IStrand;
>         import org.apache.royale.jewel.Label;
>         import org.apache.royale.events.MouseEvent;
>         import org.apache.royale.jewel.beads.controls.Badge;
>
>         [Event(name="click",
> type="org.apache.royale.events.MouseEvent")]
>
>         /**
>          *  The Badge class provides a small status descriptors for UI 
> elements.
>          *
>          *  A Badge is an onscreen notification element consists of a 
> small circle,
>      *  typically containing a number or other characters, that appears in
>      *  proximity to another object
>          *
>          *  The BadgeOnClick class is a Badge extension that 
> dispatches the MouseClick Event.
>          */
>         public class BadgeOnClick extends Badge
>         {
>                 public function BadgeOnClick()
>                 {
>                         super();
>                 }
>                 /**
>                  * used to create the badge ui element
>                  * that will be a Label
>                  */
>                 override protected function createBadge():Label
>                 {
>                         var badge:Label = new Label();
>                         badge.typeNames = "jewel badge";
>
>                         badge.addEventListener("click", function():void{
>                                 dispatchEvent(new MouseEvent("click"));
>                         });
>                         return badge;
>                 }
>                 public override function set strand(value:IStrand):void
>                 {
>                         super.strand = value;
>                 }
>         }
>
> Thx.
> Hiedra.
>
>

--
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

Reply via email to