I try to use getter/ setter with static function.
Inside a mxml file, I try to get http service like that :
EventColorByDayModel.acListeVac(event.result.ListeVac.VacPeriode);
Indeed, I need to use result to poulate arraycollection inside EventColorByDayModel.
See, below all my class:
package
{
import mx.collections.ArrayCollection;
public class EventColorByDayModel
{
private static var _acListeVac:ArrayCollection;
public static function get acListeVac():ArrayCollection
{
return _acListeVac;
}
public static function set acListeVac(value:ArrayCollection):void
{
_acListeVac = value;
}
public static function getEventColorByDate(date:Date):uint
{
var result:uint = 0xE3EBF6;
// Store renderer
for each ( var item:Object in _acListeVac )
{
if (( item.dateMySQLDeb.time <=date.time )&&( date.time<=item.dateMySQLFin.time ))
result = uint(item.sColor);
}
return result;
}
public function EventColorByDayModel()
{
}
}
}
But, in that case, an error appear with message, “impossible to access to acListeVac with a ref static Class”.
I try to translate message error french to english. I hope, it’s comprehensive.
Thanks for helping.
Because it is a setter (specified by the set keyword), you just set the value like any other variable. So try this instead of the first line of code you have up there: