Flex dynamic 關(guān)鍵字的用法
更新時(shí)間:2009年05月25日 18:17:50 作者:
Flex dynamic 關(guān)鍵字使用實(shí)例代碼。對于學(xué)習(xí)flex的朋友也許有所幫助。
EmployeeRecord.as
package empty
{
public dynamic class EmployeeRecord
{
}
}
EmptyClass.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
viewSourceURL=""
horizontalAlign="center" verticalAlign="middle"
width="100%" height="100%"
>
<mx:Script>
<!--[CDATA[
import empty.EmployeeRecord;
private function showProperties():void
{
var emp:EmployeeRecord = new EmployeeRecord();
emp.name = "Peter Griffen";
emp.age = 22;
emp.address = "123 St Peter Blvd, #552";
emp.city = "Quahog";
emp.state = "NY";
emp.zip = "02593";
var displayInfo:Function =
function ():String
{
var out:String;
out = "Employee Record:\n";
out += "Name: " + emp.name + "\n";
out += "Age: " + emp.age + "\n";
out += "Address: " + emp.address + "\n";
out += "City: " + emp.city + "\n";
out += "State: " + emp.state + "\n";
out += "Zip: " + emp.zip + "\n";
return out;
}
emp.displayRecord = displayInfo;
panelPropertyArea.text = emp.displayRecord();
}
]]-->
</mx:Script>
<mx:Panel id="panel" title="A Simple Use of Package" status="Active"
height="75%" width="75%"
paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5">
<mx:Label width="100%" color="blue"
text="Program Execution Result: "/>
<mx:TextArea id="panelPropertyArea" width="100%" height="100%"/>
<mx:Button label="Click to Run Program" click="showProperties();"/>
</mx:Panel>
</mx:Application>
復(fù)制代碼 代碼如下:
package empty
{
public dynamic class EmployeeRecord
{
}
}
EmptyClass.mxml
復(fù)制代碼 代碼如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
viewSourceURL=""
horizontalAlign="center" verticalAlign="middle"
width="100%" height="100%"
>
<mx:Script>
<!--[CDATA[
import empty.EmployeeRecord;
private function showProperties():void
{
var emp:EmployeeRecord = new EmployeeRecord();
emp.name = "Peter Griffen";
emp.age = 22;
emp.address = "123 St Peter Blvd, #552";
emp.city = "Quahog";
emp.state = "NY";
emp.zip = "02593";
var displayInfo:Function =
function ():String
{
var out:String;
out = "Employee Record:\n";
out += "Name: " + emp.name + "\n";
out += "Age: " + emp.age + "\n";
out += "Address: " + emp.address + "\n";
out += "City: " + emp.city + "\n";
out += "State: " + emp.state + "\n";
out += "Zip: " + emp.zip + "\n";
return out;
}
emp.displayRecord = displayInfo;
panelPropertyArea.text = emp.displayRecord();
}
]]-->
</mx:Script>
<mx:Panel id="panel" title="A Simple Use of Package" status="Active"
height="75%" width="75%"
paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5">
<mx:Label width="100%" color="blue"
text="Program Execution Result: "/>
<mx:TextArea id="panelPropertyArea" width="100%" height="100%"/>
<mx:Button label="Click to Run Program" click="showProperties();"/>
</mx:Panel>
</mx:Application>
相關(guān)文章
基于WebService的數(shù)據(jù)訪問(下) Flex與.NET互操作(三)
在上一篇文章《Flex與.NET互操作(二):基于WebService的數(shù)據(jù)訪問(上) 》中介紹了通過<mx:WebService>標(biāo)簽來訪問Webservice。實(shí)際上我們也可以通過編程的方式動(dòng)態(tài)的訪問WebService,F(xiàn)lex SDK為我們提供了WebService類。2009-06-06Flex 全屏組件 部分全屏的實(shí)現(xiàn)代碼
一般情況下,F(xiàn)lex全屏是指將整個(gè)舞臺全屏,而不是待定的組件全屏.網(wǎng)上的例子也一般是指這種情況的.2009-09-09Flex 自動(dòng)獲取焦點(diǎn) 監(jiān)聽全局鍵盤事件
Flex 編程注意之自動(dòng)獲取焦點(diǎn)、監(jiān)聽全局鍵盤事件2009-07-07