tags:

views:

151

answers:

2
public function fileBrowse():void {
          var success:Boolean = fileRef.browse();
         }  

         public function initFileAndImageReferences():void {

         fileRef.addEventListener(Event.SELECT, fileRef_select);

        }

        private function fileRef_select(event:Event):void {
            var XMLDP:XML = new XML();
            tree.dataprovider = 

        }

After i select a XML file, i need the xml file to be the dataprovider of a Flex tree

A: 

You cannot open a local file directly in a Flex app. You have to upload it to the server and load the contents from there. This code will upload it to the server.

var file:FileReference = FileReference(event.target);
file.upload(uploadURL);
Amarghosh
+1  A: 

Try:

tree.dataProvider = new XMLListCollection(XMLList(XMLDP));
Eric Belair