www.pudn.com > SHA1.rar > SHA1.mxml, change:2011-12-01,size:1615b


<?xml version="1.0" encoding="utf-8"?> 
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"  
					   xmlns:s="library://ns.adobe.com/flex/spark"  
					   xmlns:mx="library://ns.adobe.com/flex/mx"> 
 
	<fx:Script> 
		<![CDATA[ 
			import flash.filesystem.File; 
			import flash.filesystem.FileMode; 
			import flash.filesystem.FileStream; 
			 
			import mx.controls.Alert; 
 
 
			protected function aa_clickHandler(event:MouseEvent):void 
			{ 
				var file:FileReference=new FileReference(); 
				file.browse(); 
				//var file:File = File.documentsDirectory; 
				//file.browseForOpen("请选择要打开的文件"); //打开文件选择器 
				//file.addEventListener(Event.SELECT,fileSelectHandle) //监听文件选择事件 
 
			} 
			//将打开文件内容写入文本框 
			private function fileSelectHandle(e:Event):void{ 
				//var fileStream:FileStream=new FileStream(); 
				//var file:File = e.target as File; 
				//fileStream.open(file,FileMode.READ); 
				//txtTextAreaID.text = fileStream.readMultiByte(fileStream.bytesAvailable,"utf-8"); //只读方式打开文件,将内容放到TextArea 
				 
			} 
 
 
		]]> 
	</fx:Script> 
 
	<fx:Declarations> 
		<!-- 将非可视元素(例如服务、值对象)放在此处 --> 
	</fx:Declarations> 
	<mx:Panel title="从文件中读取数据" verticalAlign="middle" horizontalAlign ="center" width="90%" height="90%"> 
		<s:Button id="aa" label="计算" click="aa_clickHandler(event)"> 
			 
		</s:Button> 
		<mx:TextArea id="txtTextAreaID" width="300" height="200" borderColor="#FF0000" /> 
	</mx:Panel> 
</s:WindowedApplication>