Hey guys,
Thanks for your help,
I ended up having to use both methods because of the nested
conditionals - they kept trying to loop.
So I now have -
var overbooked:Boolean = false;
while ( startDate <= endDate )
{
for (var a:int = 0; a <= disabledDates.length; a++) {
stayLength[i] = year.toString() + "," +
month.toString() +
"," + startDate.toString();
if ( disabledDates[a] == stayLength[i]
) {
overbooked = true;
}
}
if (overbooked)
{
Alert.show("Date Overbooked!", "Sorry", Alert.OK);
break;
}
i++;
startDate++;
}
Thanks for your help!
--- In [email protected], "Michael Schmalle"
<[EMAIL PROTECTED]> wrote:
>
> Yeah Doug, thats easy...
>
> To many commitProperties() calls for my, my head is templated.
>
> Mike
>
> On Wed, Jun 11, 2008 at 1:10 PM, Doug McCune <[EMAIL PROTECTED]> wrote:
>
> > or just do:
> >
> >
> > f ( disabledDates[a] == stayLength[i] ) {
> > Alert.show("Date Overbooked!", "Sorry", Alert.OK);}
> > break;
> > }
> >
> > Doug
> >
> > On Wed, Jun 11, 2008 at 9:55 AM, Michael Schmalle <[EMAIL PROTECTED]>
> > wrote:
> >
> >> Hi,
> >>
> >> This might help;
> >>
> >> var i:int = 0;
> >> var overbooked:Boolean = false;
> >>
> >>
> >> while ( startDate <= endDate ){
> >>
> >> for (var a:int = 0; a <= disabledDates.length; a++) {
> >>
> >> stayLength[i] = year.toString() + "," + month.toString()
+ "," +
> >> startDate.toString();
> >>
> >> if ( disabledDates[a] == stayLength[i] ) {
> >> overbooked = true;
> >> }
> >>
> >> i++;
> >> startDate++;
> >>
> >> }
> >>
> >> if (overbooked)
> >> {
> >> Alert.show("Date Overbooked!", "Sorry", Alert.OK);
> >> }
> >>
> >> Mike
> >>
> >> On Wed, Jun 11, 2008 at 12:24 PM, tspyro2002 <[EMAIL PROTECTED]>
> >> wrote:
> >>
> >>> Hi,
> >>>
> >>> I have a problem where I am processing dates and cross checking them
> >>> across two Arrays. One array holds user selected dates, the other
> >>> holds dates which are disabled.
> >>>
> >>> The loop I have at the minute checks them OK but outputs an
Alert box
> >>> for every date which is the same.
> >>>
> >>> How can I adjust the code so that only one alert box is displayed?
> >>>
> >>> CODE SEGMENT
> >>>
> >>> var i:int = 0;
> >>>
> >>> while ( startDate <= endDate ){
> >>>
> >>> for (var a:int = 0; a <= disabledDates.length; a++) {
> >>>
> >>> stayLength[i] = year.toString() + "," + month.toString() + "," +
> >>> startDate.toString();
> >>>
> >>> if ( disabledDates[a] == stayLength[i] ) {
> >>>
> >>> Alert.show("Date Overbooked!", "Sorry", Alert.OK);}
> >>>
> >>> }
> >>>
> >>> i++;
> >>> startDate++;
> >>>
> >>> }
> >>>
> >>>
> >>
> >>
> >> --
> >> Teoti Graphix, LLC
> >> http://www.teotigraphix.com
> >>
> >> Teoti Graphix Blog
> >> http://www.blog.teotigraphix.com
> >>
> >> You can find more by solving the problem then by 'asking the
question'.
> >>
> >
> >
> >
>
>
>
> --
> Teoti Graphix, LLC
> http://www.teotigraphix.com
>
> Teoti Graphix Blog
> http://www.blog.teotigraphix.com
>
> You can find more by solving the problem then by 'asking the question'.
>