How to make MXML Component Constructor with Arguments? [closed]

不羁岁月 提交于 2019-12-13 06:32:07

问题


I`m new in flex and could anyone help me?

How do I create a constructor that takes arguments for an MXML component?


回答1:


You can't; MXML Components do not have constructors that you can modify.

You have a few options. The first is to rewrite your component to use ActionScript. This can be tedious in some situations, and trivial in others. It depends what the component does.

A second option os to use public variables on the component. When you create the instance of your MXML Component, set the properties on it. You should be able to access such properties in a preinitialize event handler. prenitinialize will be dispatched after the constructor, but before createChildren().



来源:https://stackoverflow.com/questions/10863209/how-to-make-mxml-component-constructor-with-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!