There's not enough context here to know for sure, but it's probably a
bad sign to be using callLater in any validation method as the point is
to validate synchronously.  I'm also concerned about how you are using
your properties bag on the ClassFactory.  I hope you're not changing the
values assigned.

 

Everything should be data-driven (pulling data from data objects).  If
feels like you're pushing stuff down, instead of pulling.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of markgoldin_2000
Sent: Tuesday, April 22, 2008 3:29 PM
To: [email protected]
Subject: [flexcoders] Question about commitProperties

 

I have a custom renderer based on canvas that has the following 
setters:
public function set trainId(value:String):void
{
_trainId = value;
}
public function get trainId():String
{
return _trainId;
} 
public function set highlightCurrentHour(value:String):void
{
_backgroundColor = value;
} 
public function get highlightCurrentHour():String
{
return _backgroundColor;
}
public function set xmlModelData(value:XML):void
{
_xmlModelData = value;
} 
public function get xmlModelData():XML
{
return _xmlModelData;
}

then I have:
override protected function commitProperties():void 
{
super.commitProperties();
assignBlocks(xmlModelData, trainId, highlightCurrentHour);
} 
and
public function assignBlocks(xmlModelData:XML, trainId:String, 
highlightCurrentHour:String):void
{ 
callLater(trainDepartGrid.assignBlocks, [trainId, 
xmlModelData, highlightCurrentHour]); 
trainDepartGrid.width = xmlModelData.trainshours.(train_id == 
trainId).setwidth;
callLater(trainReceivingGrid.assignCars, [trainId, 
xmlModelData, highlightCurrentHour]);
trainReceivingGrid.width = xmlModelData.trainshours.(train_id 
== trainId).setwidth;
}

I am setting these properties on this renderer like this:
ClassFactory(codeDestinationRenderer).properties =
{trainId:prop.train_id, highlightCurrentHour:bBackgroundColor, 
xmlModelData:xmlModelData};

My question is:
Is commitProperties is a right place to call assignBlocks?
Before I changed my code to this version the program worked much 
better though.

Please help.

Thanks

 

Reply via email to