Flex dynamic 关键字的用法
package empty
{
public dynamic class EmployeeRecord
{
}
}
<?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>