Hi,
I'd like to specify a custom Array dataProvider to a
mx.controls.ButtonBar instead of binding it to a ViewStack instance.
I'm doing the following:
var array:Array = new Array();
array.push(chart); // chart is a DisplayObject instance
array.push(grid); // grid is a DisplayObject too
buttons.dataProvider = array;
... but NavBar.dataProvider (ButtonBar extends NavBar) doesn't seem to
like this array of DisplayObject and throws an error, as seen in
NavBar source code: (Flex 3.0.0)
else if ((value is IList && IList(value).length > 0 &&
IList(value).getItemAt(0) is DisplayObject) ||
(value is Array && (value as Array).length > 0 &&
value[0] is DisplayObject))
{
var name:String = id ?
className + " '" + id + "'" :
"a " + className;
message = resourceManager.getString(
"controls", "errWrongType", [ name ]);
throw new Error(message);
}
What is the reason behind throwing an error when an array of
DisplayObject is given? Why would I have to wrap my DisplayObject
instances in order to prevent this error?
Thanks in advance,
Regards.
--
Fiouz