Flex Builder 3 如何弹出“打开文件对话框”,限制选择文件类型

TitleWindowApp.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
  3.     <mx:Script>
  4.         <![CDATA[
  5.        
  6.             import mx.managers.PopUpManager;
  7.             import mx.containers.TitleWindow;
  8.             import flash.geom.Point;
  9.             private var point1:Point = new Point();
  10.                        
  11.             private var file:FileReferenceList=new FileReferenceList();
  12.             private var imagesFilter:FileFilter = new FileFilter("Images (*.jpg, *.gif, *.png)", "*.jpg;*.gif;*.png");              
  13.             private function showWindow():void { 
  14.                 file.browse([imagesFilter]);
  15.                 file.addEventListener(Event.SELECT, onFileSelect);
  16.             }           
  17.             
  18.             private function onFileSelect(event : Event) : void {
  19.                 for(var i:int=0;i<file.fileList.length;i++){
  20.                    var f:FileReference = FileReference(file.fileList[i]); 
  21.                    returnedName.text=f.name;                           
  22.                 }               
  23.             }
  24.             
  25.         ]]>
  26.     </mx:Script>
  27.     <mx:Panel title="TitleWindow Container Example" height="75%" width="75%" 
  28.         paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
  29.         <mx:Button id="myButton" label="Click to open the TitleWindow container" 
  30.             click="showWindow();"/>
  31.         <mx:Image id="imgTest"   x="10" y="50"/>
  32.         <mx:Text id="returnedName" width="100%" />
  33.     </mx:Panel>
  34. </mx:Application>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值