组件的重构
组件的重构
1.新建组件 File-New-MXML Conponent
为组件添加一个myProperty属性和一个标签,并将标签与属性绑定,组件代码如下:
<?xml version="1.0" encoding="utf-8"?><mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"><mx:Script><![CDATA[[Bindable]public var myProperty:String;]]></mx:Script><mx:Label x="151" y="129" text="{myProperty}"/></mx:Canvas>
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:local="*"><local:FirstConponent id="myConponent" myProperty="ddd"/></mx:Application>
<local:MyFirstConponent id="myConponent" myProperty="ddd"/>
<local:MyFirstConponent id="myFirstConponent" myFirstProperty="ddd"/>