Hi, I have extended the bead Badge by adding the click () [1] event to it. I 
have override the "createBadge" function because the "private" variable badge 
cannot be referenced directly.

I wanted to propose a change in the Jewel Badge component, change the badge 
variable to "proptected", which is currently "private". Do you see it as 
possible / convenient?

[1]
    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")]

    public class BadgeJwExt extends Badge
    {
        public function BadgeJwExt()
        {
            super();
        }
        private var badge2:Label;
        /**
         * used to create the badge ui element
         * that will be a Label
         */
        override protected function createBadge():Label
        {
            badge2 = new Label();
            badge2.typeNames = "jewel badge";
            return badge2;
        }
        public override function set strand(value:IStrand):void
        {
            super.strand = value;
            badge2.addEventListener("click", function():void{
                dispatchEvent(new MouseEvent("click"));
            });
        }
    }


Thx.
Hiedra.

Reply via email to