Hi Pavan,

Once go through these sample files,i have used httpservice and parsed
the data.If your are using with filereference u need to download that
file to server and pass that file path to httpservice it,so we can
parse and read the data of the file,let me know if u need any more
help on this

sampleTest.mxml code here
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="horizontal">
        <mx:Label text="India"/>
        <mx:Label text="USA"/>
</mx:Application>

sampleParsing.xmlml code here

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Button label="parse data" click="ser1.send()"/>
        <mx:HTTPService id="ser1" url="http://localhost:8080/FileUploadSample/
src/SampleTest.mxml" result="resHandler(event)"
fault="fltHander(event)" resultFormat="e4x"/>
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import mx.rpc.events.FaultEvent;
                        import mx.rpc.events.ResultEvent;
                        public function resHandler(event:ResultEvent):void
                        {
                                var resXml:XML = new XML(event.result);
                                var xmllist:XMLList = resXml.children();
                                for(var cnt:int = 0;cnt<xmllist.length();cnt++)
                                {
                                        
Alert.show(""+xmllist[cnt][email protected]());
                                }
                        }
                        public function fltHander(event:FaultEvent):void
                        {
                                Alert.show(""+event.fault.message);
                        }

                ]]>
        </mx:Script>
</mx:Application>


On Feb 14, 7:59 pm, Pavan Kumar <[email protected]> wrote:
> Please any one help me,
>
> On Feb 14, 7:32 pm, Pavan <[email protected]> wrote:
>
> > Hi,
> > i am loading the mxml file , i want the data which was in label(text)
> > from the loaded mxml, how to trace it and save it ?
>
> > here is the code
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="absolute" width="460" height="600"
> >         borderColor="#000509" backgroundGradientAlphas="[1.0, 1.0]"
> > backgroundGradientColors="[#2D2D2D, #403F3F]"
> >         horizontalScrollPolicy="off" verticalScrollPolicy="off"
> >          >
>
> > <mx:Script>
> >         <![CDATA[
> >                 import mx.events.FlexEvent;
> >                 import mx.collections.ArrayCollection;
> >                 import mx.preloaders.Preloader;
> >                 import mx.controls.Alert;
> >                 import flash.net.FileReference
>
> >                 [Bindable]
> >                 private var getData:String=""
> >                 private var _filerefer:FileReference;
> >                 private var fileName:String
>
> >                 private function MxmlLoad():void{
> >                         var filetype:FileFilter=new FileFilter("Select Mxml
> > File(.mxml)","*.mxml")
> >                         _filerefer=new FileReference()
> >                         _filerefer.browse(new Array(filetype))
> >                         
> > _filerefer.addEventListener(Event.SELECT,fileReference_Select);
> >                 }
>
> >                  private function fileReference_Select(event:Event):void
> >                 {
>
> > _filerefer.addEventListener(Event.COMPLETE,fileReference_Complete);
> >                    _filerefer.addEventListener(IOErrorEvent.IO_ERROR,
> > LoadError);
> >                    _filerefer.load()
>
> >                 }
>
> >              private var DataStore:ArrayCollection=new ArrayCollection()
>
> >                  private function fileReference_Complete(event:Event):void
> >                 {
> >                         var fileData:ByteArray=_filerefer.data
> >                         fileName=event.currentTarget.name
> >                 if(fileData!=null && fileData.length > 0)
> > {
> >                       getData = fileData.toString();
> >                     }
> >                     _filerefer=null
>
> >                   /*  event.currentTarget.data=DataStore
>
> >                      fileName:String=ArrayCollection
> >                                       for(var i:int=0; 
> > i<myARRAY.length;i++){
> >                             trace(myARRAY[i].text);
> >                             Alert.show(event.currenTarget.name)
> >                             event.currentTarget.data=DataStore
> >                         } */
>
> >                         Alert.show(event.currentTarget.data)
> >                         btnExcel.enabled=true
> >                         /* LoadData(event.currentTarget.data) */
> >                 }
>
> >                /*  private function LoadData(data:String):void{
> >                         for(var i:int=0; i<myARRAY.length;i++){
> >                             trace(myARRAY[i].text);
> >                         }
> >                 } */
>
> >                 private function LoadError():void
> >                 {
> >                  Alert.show("Failed to Load");
> >                 }
>
> >                    private function ExcelSave():void{
> >                         Alert.show("Failed to Save Excel")
> >                 }
> >         ]]>
> > </mx:Script>
>
> >            <mx:ArrayCollection id="myARRAY" />
>
> > <mx:Button id="btnMxml" x="85" y="200" label="Select Mxml File"
> > width="140" height="30" click="MxmlLoad()"
> >           borderColor="#FFFFFF" color="#FFFFFF" fillAlphas="[1.0, 1.0]"
> > fillColors="[#0666A9, #144160]" toolTip="Load Mxml" />
>
> > <mx:Button id="btnExcel" x="280" y="200" label="Generate Excel"
> > width="140" height="30" click="ExcelSave()" color="#FFFFFF"
> > enabled="false"
> >          borderColor="#FFFFFF" fillAlphas="[1.0, 1.0]" fillColors="[#0666A9,
> > #144160]"  />
>
> > <mx:Label y="11" text="Excel Creation" fontWeight="bold" fontSize="20"
> > horizontalCenter="8" color="#2978A5" fontFamily="Georgia"/>
> > <mx:Label x="348" y="560"  text="MXML-EXCEL Generation "
> > color="#C8C8C8"  fontSize="8"/>
> > <mx:Image x="5" y="535" source="assets/SAP-Logo.png" width="50"
> > height="70" toolTip="MXML-EXCEL Generation Tool" />
> > </mx:WindowedApplication>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to