意思是,如果我有:
<mx:Tree>
<!-- ... -->
</mx:Tree>
Run Code Online (Sandbox Code Playgroud)
并且我想通过执行(在AS中)来更改控件的某些行为或添加功能:
class ChristmasTree extends mx.controls.Tree {
// ...
}
Run Code Online (Sandbox Code Playgroud)
如何更改MXML以便使用我的类?
在手册中,它说明了如何通过MXML扩展组件,但我如何使用AS 进行扩展?
好吧,那是最好的懒人网.当然它也在TFM中,实际上非常整洁.在AS中,您可以:
package myComponents
{
// as/myComponents/TextAreaFontControl.as
import mx.controls.TextArea;
public class TextAreaFontControl extends TextArea
{
// add / change behaviour, properties etc. ...
}
}
Run Code Online (Sandbox Code Playgroud)
然后在MXML中,您执行以下操作:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="myComponents.*">
<!-- ... -->
<MyComp:TextAreaFontControl />
Run Code Online (Sandbox Code Playgroud)
凉.
| 归档时间: |
|
| 查看次数: |
1533 次 |
| 最近记录: |