To do something like that, you'd need to declare the multiType variable as Object or * and simply forgo type-checking. It's a little bit of a cop-out, but it's not clear what you're trying to do at a higher level--there may or may not be better ways to go about it.
The * type worked fine. I didn't know that that type existed.
Thank you very much.
Object should have worked as well, since it's dynamic. Perhaps
FlexBuilder doesn't like it--it's not terribly smart sometimes. * is
just like Object, except that it can also hold the value undefined (of
the type void). I.e., the type hierarchy looks something like
Object void (with the one possible value of undefined, like
Boolean only holds true and false)
(all the usual classes)
The type 'Object' results in the following error message:
1118: Implicit coercion of a value with static type Object to a possibly unrelated type mx.core:IVisualElement.
I also tried to use IVisualElement as initial type but I did not succeed in casting it to another type (eg: MyComponent) to make all the variables and functions accessible from MyComponent.