Anyone see an issue with this code? :-)

2013-06-19 Thread Justin Mclean
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? :-)

2013-06-19 Thread Justin Mclean
Hi,

And this may not do what you expect.

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

Justin


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

2013-06-19 Thread Erik de Bruin
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? :-)

2013-06-19 Thread Justin Mclean
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? :-)

2013-06-19 Thread OmPrakash Muppirala
On Wed, Jun 19, 2013 at 10:25 AM, Justin Mclean 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