piotreky commented on issue #930:
URL: https://github.com/apache/royale-asjs/issues/930#issuecomment-725539144


   Here is a small test application:
   
   `<?xml version="1.0" encoding="utf-8"?>
   <mx:Application 
        xmlns:fx="http://ns.adobe.com/mxml/2009";
        xmlns:mx="library://ns.apache.org/royale/mx" 
        width="100%"
        horizontalAlign="center"
        layout="vertical"
        backgroundColor="white" 
        creationComplete="init();">
   
       <fx:Script>
        <![CDATA[
           import mx.controls.Alert;
                import mx.net.FileReference;
                import mx.net.FileFilter;
           import org.apache.royale.events.Event;
   
            private var fileRef:FileReference;
                private var excelFilter:FileFilter = new FileFilter("Excel", 
"*.xls;*.xlsx"," XLBN ,XLS_;XLS3;XLS4");
                private var csvFilter:FileFilter = new FileFilter("Comma 
Separated Values (*.csv)","*.csv","CSV");
                private var tabFilter:FileFilter = new 
FileFilter("Tab-delimited Files (*.txt)","*.txt","TXT");
   
            private function init():void {
                fileRef = new FileReference();
                fileRef.addEventListener(Event.SELECT, fileRef_select);
            }
   
            private function browseAndUpload():void {
                fileRef.browse([excelFilter, csvFilter, tabFilter]);
            }
        
            private function fileRef_select(evt:Event):void {
                try {
                                Alert.show("Hello: "+fileRef.name+ " of size " 
+ fileRef.size);
                } catch (err:Error) {
                    Alert.show("ERROR: zero-byte file");
                }
            }
        
        ]]> 
        </fx:Script>
   
        <mx:Button label="Select file" click="browseAndUpload();"/>
   
   </mx:Application> 
   `


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to