You can directly access the date using now.date (1..31) and month using
now.month (0..11), so you code can be simplified as follows.
var now:Date = new Date();if ( now.month == 5 && now.date < 11 )
    now.date = 11;
--- In [email protected], "stldvd" <stl...@...> wrote:
>
> Hi,
>
> I'm working on a sports app with teams. Depending on the date,
different team matchups will be displayed. However, before the 11th we
just want to display the matchup for the 11th.
>
> I have the following code, but I'm getting a compile-time error:
> "Target of assignment must be a reference value."
>
> Here's the code.
>
>       var now:Date = new Date();
>      var currentDate:String = now.getDate().toString()
>           //if the current date is before the 11th, set it to the 11th
>             if((Number(currentDate)) < 11)
>              {
>               Number(currentDate) = 11; //error is here
>
>              }
>             else
>             ...
>
> I realize I'm assigning a value to a value, and that's the problem.
I'm just not sure how to fix it.
>
> Thanks.
>

Reply via email to