In actionscript, just instantiate the component with the new keyword. No need to add it to the displaylist.
private var customComp:CustomComponent = new CustomComponent();
My 1st gut reaction was to try that as well but it is not equivalent to having something in the declarations tag.
When I had tried it I could not pull the application instance in the constructor's body via flex globals anymore. Whereas when the same object was added via declarations, I could pull the application object from flex globals.
So this key difference leads me to ask once again: How can I add a non-visual custom component to an Application via the actionscript syntax ... such that everything about is the same as if I had added it using the declarations tag in mxml?
1 person found this helpful
You can use -keep-generated-actionscript to see what it generates for the
stuff in the declarations tag.