Well spotted Kessler, few excuses can be made now. ;P 
Thx
Hiedra

-----Mensaje original-----
De: Kessler CTR Mark J <mark.kessler....@usmc.mil> 
Enviado el: martes, 26 de abril de 2022 17:57
Para: users@royale.apache.org
Asunto: VSCode snippet, getter/setter. was (RE: Binding - dispatch event change)

All,
    Here is a VSCode snippet for implementing that pattern as an option.  
Simply add it to your AS3 user snippet file. I have placed a copy below and 
attached it as a txt file in case it gets mangled in transit.



    "Getter and Setter":
    {
        "body":
        [
            "//----------------------------------------",
            "// $1",
            "//----------------------------------------",
            "",
            "/**",
            " * ${0:TODO Description}",
            " */",
            "[Bindable(\"$1Changed\")]",
            "public function get ${1:propertyName}():${2:String}",
            "{",
            "    return ${3:returnVariable};",
            "}",
            "",
            "",
            "/**",
            " * @private",
            " */",
            "public function set ${1:propertyName}(value:${2:String}):void",
            "{",
            "    if (value == $3)",
            "    {",
            "        return;",
            "    }",
            "",
            "    $3 = value;",
            "",
            "    dispatchEvent(new Event(\"$1Changed\"));",
            "}"
        ],
        "description": "Getter and Setter default format",
        "prefix": "getter and setter"
    },




r/s
-Mark K

-----Original Message-----
From: Maria Jose Esteve <mjest...@iest.com>
Sent: Monday, April 25, 2022 16:38
To: users@royale.apache.org
Subject: [Non-DoD Source] RE: Binding - dispatch event change

Understood 😝, I don't think it's too much work.

I think something very important also is how it is implemented in the class 
hierarchy right?



One question, why are there places where the event is also dispatched? (I 
haven't debugged the code to know if the event is dispatched twice but it seems 
strange to me...)



Hiedra



De: Alex Harui <aha...@adobe.com>
Enviado el: jueves, 14 de abril de 2022 19:23
Para: users@royale.apache.org
Asunto: Re: Binding - dispatch event change



The short answer is if you have the time to write the code to use 
[Bindable(”fooChange”)] the result will be a bit more efficient.  Using 
[Bindable] is easier to write, but has a cost.  The cost is roughly what 
proportion of public properties need to actually dispatch change events.  
Royale SWCs in Royale releases should never use [Bindable].  We should take the 
time to optimize and use [Bindable(”fooChange”)].  What the app developer does 
is their own decision.



From: Maria Jose Esteve <mjest...@iest.com>
Reply-To: "users@royale.apache.org" <users@royale.apache.org>
Date: Thursday, April 14, 2022 at 10:04 AM
To: "users@royale.apache.org" <users@royale.apache.org>
Subject: RE: Binding - dispatch event change



I will look into it, thanks Yishay



Hiedra



De: Yishay Weiss <yishayj...@hotmail.com> Enviado el: martes, 12 de abril de 
2022 12:28
Para: users@royale.apache.org
Asunto: RE: Binding - dispatch event change



You might find answers here [1]



[1] Using Bindable Metadata Events | Tournas Dimitrios (wordpress.com) 
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftournasdimitrios1.wordpress.com%2F2010%2F08%2F01%2Fusing-bindable-metadata-events%2F&data=04%7C01%7Caharui%40adobe.com%7C65cec8778b514ca86b9508da1e38a625%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637855526509966549%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Q7hQc4uUDhJMckqddUsA%2FU%2B6i2sa4a8RNstBERCbL00%3D&reserved=0>



From: Maria Jose Esteve <mailto:mjest...@iest.com>
Sent: Tuesday, April 12, 2022 1:14 PM
To: users@royale.apache.org <mailto:users@royale.apache.org>
Subject: Binding - dispatch event change



Hello, I want to ask you a general question about the binding of as3 properties.

In the SDK we can observe different implementations:



[Bindable]

…

public function set foo(value:Boolean):void{

                _foo = value;

}

//-----------------------------

[Bindable(”fooChange”)]

…

public function set foo(value:Boolean):void{

                _foo = value;

}

//-----------------------------

[Bindable]

…

public function set foo(value:Boolean):void{

                _foo = value;

                dispatchEvent(new Event(“fooChange”));

}

//-----------------------------

[Bindable(”fooChange”)]

…

public function set foo(value:Boolean):void{

                _foo = value;

                dispatchEvent(new Event(“fooChange”));

}

//-----------------------------

public function set foo(value:Boolean):void{

                _foo = value;

                dispatchEvent(new Event(“fooChange”));

}



What is the difference between these options? In what cases would you implement 
one or the other?



Thx.

Hiedra





Reply via email to