Solved! Go to Solution.
//===================================================================== // Get UI Widget by Label.....,. (Make controlContainer PUBLIC) //===================================================================== public function getUIWidget(widgetLabel:String):IBaseWidget { for (var x:Number = 0; x < controlContainer.numElements; x++) { var widget:IBaseWidget = controlContainer.getElementAt(x) as IBaseWidget; if (widget.widgetTitle.toUpperCase() == widgetLabel.toUpperCase()) return widget; } return null; }ViewerContainer.getInstance().widgetManager.getWidgetId("HeaderControllerLabel")
/**
* @return Returns the widget ID for a specific widget based on the widget label.
*
*/
public function getWidgetId(widgetLabel:String, isController:Boolean = false):Number
{
var id:Number = Number.NaN;
if (isController){
for (var c:Number = 0; c < configData.controls.length; c++)
{
if (configData.controls.label == widgetLabel)
{
id = configData.controls.id;
}
}
}else{
for (var w:Number = 0; w < configData.widgets.length; w++)
{
if (configData.widgets.label == widgetLabel)
{
id = configData.widgets.id;
}
}
}
return id;
} ViewerContainer.getInstance().widgetManager.getWidgetId("hc",true)
public function getWidget(widgetId:Number, openWidgetIfNot:Boolean = false):IBaseWidget
.
.
.
if (idx == null)
{
throw new ArgumentError("Invalid widgetId: " + widgetId);
}
.
.
.
var wid:Number = ViewerContainer.getInstance().widgetManager.getWidgetId("MyWidgetLabel",true);
var widget:IBaseWidget = ViewerContainer.getInstance().widgetManager.getWidget(wid);
//===================================================================== // Get UI Widget by Label.....,. (Make controlContainer PUBLIC) //===================================================================== public function getUIWidget(widgetLabel:String):IBaseWidget { for (var x:Number = 0; x < controlContainer.numElements; x++) { var widget:IBaseWidget = controlContainer.getElementAt(x) as IBaseWidget; if (widget.widgetTitle.toUpperCase() == widgetLabel.toUpperCase()) return widget; } return null; }