Hi Yishay,

can you share some code declaration example so I can try something similar?

I think the code I tried was this (can ensure 100%): if(!(_strand as
Object).hasOwnProperty("datagrid"))
for a Strand that is a normal Jewel List (that is not IDataGridColumnList,
the only one that supports "datagrid" property) the if block was executed.
So the if block was executing in all cases.
So I figured this was not supported right as in Flash or was a bug, although
if we are trying to support AS3 right that should be working fine.

Thanks

Carlos



El jue., 16 ene. 2020 a las 19:10, Yishay Weiss (<yishayj...@hotmail.com>)
escribió:

> We do use [1]  hasOwnProperty(). What went wrong? Maybe this needs to be
> in a different thread though, because the original thread is more about a
> getBeadByType() search.
>
> [1]
> https://github.com/apache/royale-asjs/blob/781c2ed44f7f64110fd011b617949c1faae5f158/frameworks/projects/MXRoyale/src/main/royale/mx/charts/renderers/CircleItemRenderer.as#L141
>
> From: Carlos Rovira<mailto:carlosrov...@apache.org>
> Sent: Thursday, January 16, 2020 11:50 AM
> To: dev@royale.apache.org<mailto:dev@royale.apache.org>
> Subject: Re: "has" vs "is": sharing code, swapping out subsystems, and
> more...
>
> Hi,
>
> recently I want to do a "has" instead of "is", but I couldn't.
> I'm not talking about at "bead" level, just something like we use to do in
> Flash (hasOwnProperty)
>
> Taking the code in [1]. I'd like to change this
>
> if(!(_strand is IDataGridColumnList))
>
> for something like this
>
> if(_strand.hasOwnProperty("datagrid"))
>
> in order to avoid check against the IDataGridColumnList interface, that
> users using List but not using DataGrid, will not need to compile in his
> apps (adding all that datagrid code burden)
>
>
> [1]
>
> https://github.com/apache/royale-asjs/blob/56dbe7a33e66f104a882654ce00c7a1074296725/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as#L154
>
> --
Carlos Rovira
http://about.me/carlosrovira

Reply via email to