Alex's solution to the original challenge of selecting which Child
components to add at runtime, worked very well with the adjustments
mentioned.
However, the function to instantiate & add the Child component
requires a class parameter dynamically specified at runtime.
The mx.ComboBox approach described works...by surrounding the
package/name of the component with curly braces, Flex manages to
pass the actual component(reference) to the function.
--So, the string of "{components.Comp1}" is passed as an actual
class reference.
But, to make the Dynamic UI "table-driven"...to specify which Child
components to add using an array...I must find a way in ActionScript
to convert the strings into the actual component reference. (Can't
use the curly brace approach, since curly braces work in Flex, not
Actionscript.)
How, in AS, can you convert a string ("components.Comp1") into the
actual reference to the component? This is very basic. I'm
embarrassed to not know the answer. I've combed the docs and the
FlexCoder archives.
I tried explicit coercion or casting:
private function fAddApps():void
{
var clComp:Class = Class(acCompList.getItemAt(2).compname);
fAddCustomView(clComp);
}
private function fAddCustomView(compClass:Class):void
This didn't work
Does anyone have a suggestion?