加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

FLEX3组件定制

发布时间:2020-12-15 05:05:13 所属栏目:百科 来源:网络整理
导读:组件中,所有的ID都是可以对外访问的。但是组件中的子控件,是无法提供对外事件支持的,这时需要做事件的转发功能,如下: ?xml version="1.0" encoding="utf-8"? mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" width="292" height="226" ?mx:M

组件中,所有的ID都是可以对外访问的。但是组件中的子控件,是无法提供对外事件支持的,这时需要做事件的转发功能,如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" width="292" height="226">
?<mx:Metadata>
? [Event(name="myComponentTextChange",type="flash.events.Event" )]
?</mx:Metadata>

<mx:Script>
?<![CDATA[
? [Bindable("text")]
? [Inspectable(defaultValue="hello word")]?
? public function set myComponentText(value:String):void
? {
? inputText.text=value
? }
? public function get myComponentText():String{
? return inputText.text
? }
??
?]]>
</mx:Script>
?<mx:TextArea id="inputText" change="this.myComponentText=inputText.text; this.dispatchEvent(new Event('myComponentTextChange'))" width="264" height="183" />
</mx:TitleWindow>

?

--------------------------------------------------------------

?<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:wxsr="components.*" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> ?<wxsr:TestComponent id="testComponent" enterFrame="trace(testComponent.myComponentText)" myComponentTextChange="trace('------')"> ?? ?</wxsr:TestComponent> </mx:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读