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