Seems the compiler has a restriction on declaratively setting values of
"Function" type properties and styles. If I do this:


<bl:HorizontalClusteredBarChart
formatPointLabelFunction="PointLabelFormatters.myPointFormatter" />


Where PointLabelFormatters is defined as:


class PointLabelFormatters {

public static function myPointFormatter(point:Object):String {
return "this is my point";
}
}


I get an error:


Error /charts/CustomPoints.mxml:19
Only functions in the document are allowed.


Even if I try to create a document level alias for the function:


<mx:Script>
var localAliasForSillyCompilerRestriction:Function =
PointLabelFormatters.myPointFormatter;
</mx:Script>
<HorizontalClusteredBarChart
formatPointLabelFunction="localAliasForSillyCompilerRestriction" />


I get the same error. Only workaround is to create a wrapper function which
means an extra unnecessary function call just because of a compiler
restriction. This is a function that will be called thousands of times upon
each rendering, so the extra call can be significant.

Is there any other way around this besides the wrapper function?

Sam



----------------------------------------
Blog http://www.rewindlife.com
TeamMM http://www.macromedia.com/go/team 
----------------------------------------





Reply via email to