在Adobe Flex 2

raining from the Source中找不到Util , AddProduct.mxml , 图片
后来在google上搜到了一个,可能适合的
(上次那个AddProduct链接被X掉了,这里唯有写出)
Adobe Flex 2

raining from the Source
flex2tfs/Lesson07/assets/AddProduct.mxml
Utils/Util.as
Util
AddProduct
Util地址:
http://files.blog-city.com/files/J05/88593/b/utils.zip图片地址:
http://files.blog-city.com//files/J05/88593/b/assets.zipAddProduct.xml
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import valueObjects.Product;
import mx.collections.ArrayCollection;
import flash.net.FileReference;
import mx.managers.PopUpManager;
private var win:ConfirmScreen;
[Bindable]
public var units:ArrayCollection;
[Bindable]
public var cats:ArrayCollection;
private function doProdAdd():void{
var prod: Product = Product.buildProduct(prodModel);
showPopUp(prod,"product "+ prodModel.prodName +" added");
}
private function fileBrowse():void{
var myFileRef:FileReferenceList = new FileReferenceList();
myFileRef.browse();
}
private function showPopUp(prod: Product,title:String):void{
win =ConfirmScreen(PopUpManager.createPopUp(this,ConfirmScreen,true));
win.prod = prod;
win.title = title;
}
]]>
</mx:Script>
<mx:Model id="prodModel">
<product>
<catID>{int(catID.selectedItem.catID)}</catID>
<prodName>{prodName.text}</prodName>
<unitID>{unitID.selectedItem.unitID}</unitID>
<cost>{Number(cost.text)}</cost>
<listPrice>{Number(listPrice.text)}</listPrice>
<description>{description.text}</description>
<isOrganic>{isOrganic.selected}</isOrganic>
<isLowFat>{isLowFat.selected}</isLowFat>
<imageName>{imageName.text}</imageName>
</product>
</mx:Model>
<mx:Form>
<mx:FormItem label="Category">
<mx:ComboBox id="catID"
dataProvider="{cats}"
labelField="catName"/>
</mx:FormItem>
<mx:FormItem label=" Product Name">
<mx

extInput id="prodName"/>
</mx:FormItem>
<mx:FormItem label="Unit">
<mx:ComboBox id="unitID"
dataProvider="{units}"
labelField="unitName"/>
</mx:FormItem>
<mx:FormItem label="Cost">
<mx

extInput id="cost" />
</mx:FormItem>
<mx:FormItem label="List Price">
<mx

extInput id="listPrice" />
</mx:FormItem>
<mx:FormItem label="Description">
<mx:RichTextEditor id="description" height="200"/>
</mx:FormItem>
<mx:FormItem label="Organic">
<mx:CheckBox id="isOrganic"/>
</mx:FormItem>
<mx:FormItem label="Low Fat">
<mx:CheckBox id="isLowFat"/>
</mx:FormItem>
<mx:FormItem label="Image Name" direction="horizontal">
<mx:TextInput id="imageName"/>
<mx:Button click="fileBrowse()" label="Browse"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Add Product" click="doProdAdd()"/>
</mx:FormItem>
</mx:Form>
</mx:VBox>