Reputation: 429
I have a number of GUI dialogs defined using MXML. Assuming these mxml objects have been compiled into my application, is there any way to instantiate these objects using ActionScript, sort of like this?
myFoo: Mxml2ActionScriptClass("FOO.mxml") = new AutomagicalMXMLFactory( "FOO.mxml"); myFoo.addEventListener(etc etc) this.AddChild(myFoo);
Upvotes: 2
Views: 844
Reputation: 549
Yes. Whatever the file name is for your MXML class, that is the class name you use.
So, if you have an MXML document by the name of "Foo.mxml" , that file will be compiled into a class called "Foo". You can instantiate said class like any other in actionscript, with the "new" keyword.
var myFoo:Foo = new Foo();
whatever.addChild(myFoo);
Upvotes: 1