开发者

create a FlashBuilder4 mxml class instance using ActionScript?

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:  Mxml2ActionScript开发者_运维百科Class("FOO.mxml") = new AutomagicalMXMLFactory( "FOO.mxml");
    myFoo.addEventListener(etc etc)
    this.AddChild(myFoo);


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜