You're trying to assign a number into a string really...

 

Just doing this should be enough.

 

currentDate = "11";

 

It does raise the issue... if you are always wanting to treat the date
as a number, why create it as a string in the first place?

 

Gk.

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of stldvd
Sent: 09 June 2010 14:23
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Reference value

 

  

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