I think that "!view" is generally fine, and it doesn't need to be changed. Using ! to check if something is null is pretty commonly used in AS3. The only time it gets tricky is with numbers, where 0 is considered equivalent to false, but that's not something that you usually need to worry about.
-- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Tue, Dec 10, 2024 at 3:12 AM Maria Jose Esteve <[email protected]> wrote: > Ok, thx > > One question: what is more correct " view == null" or "!view"? > The "!xxx" instruction is used very frequently (to check if xxx is null) > and I don't know if it should be changed to "xxx == null" or "xxx === > null"... > > Hiedra > > -----Mensaje original----- > De: Yishay Weiss <[email protected]> > Enviado el: martes, 10 de diciembre de 2024 11:32 > Para: [email protected] > Asunto: Re: Correction of warnings for incorrect type > > I would guess this was code taken from Flex which cannot be implemented in > full because function get gridViewLayout is not implemented. I think you > can just replace > > return view ;//&& view.gridViewLayout.isCellVisible(rowIndex, columnIndex); > > with > > return view !=null;//&& view.gridViewLayout.isCellVisible(rowIndex, > columnIndex); > > ________________________________ > From: Maria Jose Esteve <[email protected]> > Sent: Tuesday, December 10, 2024 12:27 PM > To: [email protected] <[email protected]> > Subject: Correction of warnings for incorrect type > > Hi, > I'm making some modifications to royale-asjs to fix the warnings: > "incorrect type", "comparison between different types", etc, etc. > I have a question about the Spark Grid component because I don't work with > mx/spark and I don't know what the best implementation would be. > The warning occurs in the isCellVisible function [1]: > > Warning: GridView used where a Boolean value was expected. The expression > will be type coerced to Boolean. > > public function isCellVisible(rowIndex:int = -1, columnIndex:int = > -1):Boolean > { > const view:GridView = getGridViewAt(rowIndex, columnIndex); > return view ;//&& view.gridViewLayout.isCellVisible(rowIndex, > columnIndex); > } > [1] > https://github.com/apache/royale-asjs/blob/0d87dd2f3324e793958211cb6877facf62ee213a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Grid.as#L4185 > > ¿true/false? > > Thx. > > Hiedra > >
