Tuesday, May 15, 2012

[Action Script] need to read textBox text into .... May,2012

Hi there,

After several days of searching and going through my collection of Flex database files I can't seem to find anything about writing from several different textBoxes into ONE only Text file OR even writing from an Xml file into plain text with line breaks.

If anybody has any suggestions please do not hesitate to pass them on as I get now quiet frustrated to get hung out to dry on this.

What I was after are several items, but I would be happy if I could make some of these work !

I JUST HAVE WORKED OUT ALL ITEMS STATED BELOW (1 TO 3 AND 6) YET WOULD BE STILL INTERESTED TO FIND OUT MORE ABOUT THE ITEM NUMBER 4 IF THERE IS A DIRECT WAY OF READING A DATAGRID ROW INTO A TEXT FILE ???


AND IF YES WOULD IT BE POSSIBLE TO HAVE ALSO LINE BREAKS ???

My options would be:
Read out of several different textBoxes with each readout having a line break. Possibly not with all the guff of the htmlText just plain text from the input would be fine. Or a direct readout from Xml file into a text.txt if that would be possible. Or a direct readout from a gatagrid row into a text.txt if that would be possible. Saving of a file automatically as a text.txt file without asking first or any other interaction, and Saving to a specific directory folder on the desktop.
I have come up with something which started me off yet uses 'htmlText' or plain text without line breaks.

OK, here is some of the code I have with the 'htmlText' readout:

Code: <TEXTFORMAT LEADING="2">
<P ALIGN="LEFT">
<FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">
The Text which was used in textBox ....
</FONT>
</P>
</TEXTFORMAT> Code:     <mx:Script>
        <![CDATA[
            private const textFilter:FileFilter = new FileFilter(Text Files (txt, html, htm, ods),*.txt;*.html;*.htm;*.ods;);
        ]]>
    </mx:Script>
           
            <mx:TextInput id="inputOne"/>
           
            <mx:Button>
               
                <mx:click>
                   
                    var f:File = File.desktopDirectory;
                   
                    f.browseForSave(Save As);
                   
                    f.addEventListener(Event.SELECT, function (event:Event):void {
                   
                    var stream:FileStream = new FileStream();
                   
                    stream.open((event.target as File),FileMode.WRITE);
                   
                    stream.writeUTFBytes(inputOne.htmlText);
                   
                    stream.close();
                    });
                </mx:click>
               
            </mx:Button>
need to read textBox text into ....

Related Post



0 comments: