You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Justin Mclean <ju...@classsoftware.com> on 2013/06/19 18:33:44 UTC

Anyone see an issue with this code? :-)

Hi,

The rabbit hole keeps getting deeper. From displayDropdown in DateField.

            if (screen.right > dd.getExplicitOrMeasuredWidth() + point.x &&
                screen.bottom < dd.getExplicitOrMeasuredHeight() + point.y)
            {
                xVal = point.x
                yVal = point.y - dd.getExplicitOrMeasuredHeight();
                openPos = 1;
            }
            else if (screen.right < dd.getExplicitOrMeasuredWidth() + point.x &&
                     screen.bottom < dd.getExplicitOrMeasuredHeight() + point.y)
            {
                xVal = point.x - dd.getExplicitOrMeasuredWidth() + downArrowButton.width;
                yVal = point.y - dd.getExplicitOrMeasuredHeight();
                openPos = 2;
            }
            else if (screen.right < dd.getExplicitOrMeasuredWidth() + point.x &&
                     screen.bottom > dd.getExplicitOrMeasuredHeight() + point.y)
            {
                xVal = point.x - dd.getExplicitOrMeasuredWidth() + downArrowButton.width;
                yVal = point.y + unscaledHeight;
                openPos = 3;
            }
            else
                // Why do we need to disable downArrowButton when its hidden?
                //downArrowButton.enabled = false;
                openPos = 0;

What's the value of openPos after this? Why braces should be required IMO! :-)

Justin

Re: Anyone see an issue with this code? :-)

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Wed, Jun 19, 2013 at 10:25 AM, Justin Mclean <ju...@classsoftware.com>wrote:

> Hi,
>
> > I feel an aslint application coming up...
> It exists for JS so AS shouldn't be hard :-)


It already exists and it is called the compiler!  I am sure that the
generated bytecode for this snippet is quite optimized.


> Flex PMD does a good job (but requires a little tuning) I once run it over
> the Flex SDK and was rather horrified by the results. :-)
>

Flex PMD is probably a better bet for these kind of situations.

Om

Re: Anyone see an issue with this code? :-)

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> I feel an aslint application coming up...
It exists for JS so AS shouldn't be hard :-) Flex PMD does a good job (but requires a little tuning) I once run it over the Flex SDK and was rather horrified by the results. :-)

Justin

Re: Anyone see an issue with this code? :-)

Posted by Erik de Bruin <er...@ixsoftware.nl>.
I feel an aslint application coming up...

;-)

EdB



On Wednesday, June 19, 2013, Justin Mclean wrote:

> Hi,
>
> And this may not do what you expect.
>
> if (true)
>     trace(true);
> else
>     // will false be traced?
>     trace(false);
>
> Justin
>


-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: Anyone see an issue with this code? :-)

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

And this may not do what you expect.

if (true)
    trace(true);
else
    // will false be traced?
    trace(false);

Justin