Cannot seem to read a plain text file

this is actually macromedia flash mx 6.0, which I believe runs AS2 but is compatible with AS3
file = date.txt
file contents: xdate=12/01/2013
the file is in same directory as the .swf
code to read the file contents into a variable:
DateFile = new LoadVars();
DateFile.onLoad = function(ok) {
if (ok) {
var theDate = DateFile.xdate;
DateFile.load("date.txt");
theDate variable is empty
also tried this
file = date.txt
file contents: &xdate=12/01/2013&
DateFile = new LoadVars();
DateFile.load("date.txt");
var theDate = DateFile["xdate"];

1. the xdatefile.onload (method?) is automagically invoked by the xdatefile.load method AFTER loading is complete
2.the onload takes care of all the monitoring, byte counting, asynch back office stuff,
for moving file bytes to a variable value, ie, xDatea = xDateFile.xDate; however only after
the finish of that is the actual file data accessible, so the last action within the .onload
is to invoke a function to move the now available data to someplace really useable like
a textbox. This happens in the populateTF function. if I don't get the data moved some
place during the .onload processing I don't have it
not exactly.  you don't have to call another function from onLoad.  but you must wait until onLoad completes before trying to use the variables defined in onLoad. ie, it is a matter of timing.
so I was able to populate the textbox per the example, However, it seems I still can't
populate a variable and then have that variable content available after the .onload and
populateTF?
I tried this
var xDatec:string (declared earlier)
function populateF(){
txtTestBox2.text = xDatea;  //this worked
xDatec = xDateb;  //something wrong here.  where is xDateb defined?
when I try to use xDatec to populate a texbox, there is no value
txtTestBox3.text = xDatec
// when did you try to use xDatec?
i think you're still failing to see the timing issue.  try this test:
file content: &xDate=12012013&
var xDateFile = new LoadVars();
var xDatea:string;
var xDateb:string;
xDateFile.onLoad = function(ok) {
          if (ok) {
trace("onLoad finally executes @: "+getTimer());
trace("from this time forward, variables are available");
          xDatea = xDateFile.xDate;
          trace(xDatea);  // should work
          xDateb=this.xDate;
          trace(this.xDateb);  // should work
populateTF();
xDateFile.load("xDate.txt");
trace("loading started @: "+getTimer());
var idx = "xDate";
txtTestBox.text = xDateFile[idx]; // should fail
txtTestBox2.text = xDatea;  //should fail
txtTestBox3.text = xDateb;  //should fail
txtTestBox4.text = "so I know I got here";  //should work
trace("when trying to use data immediately after loading starts and BEFORE it completes you expect failure. eg @: "+getTimer());
function populateF(){
var idx = "xDate";
txtTestBox.text = xDateFile[idx]; // should work
txtTestBox2.text = xDatea;  //should work
txtTestBox3.text = xDateb;  //should work
txtTestBox4.text = "so I know I got here";  //should work
trace("when executing code AFTER loading completes you expect success. eg @: "+getTimer());

Similar Messages

  • Save results of javascript operation to a plain text file

    Hi,
    How do you save to a file using Acrobat javascript? Not a PDF file - I know how to do that - but to a plain text file.
    I have javascript that searches through a PDF document and generates some output. I can send the output to a Report (in PDF format, obviously) or to the console, but I can't see how to send it to a plain text file, which is what I need.
    Any assistance gratefully appreciated.
    Thanks,
    Tim.

    Ah, great, yes that seems to do what I want.
    However, I get an error ...
    My code is as follows:
    function CreateOutput()
         // assembles text and puts it into the variable: output
         // e.g.:
         output = "Hello, world";
    var output = "";
    CreateOutput();
    this.createDataObject("testfile.txt", output);
    Unfortunately I get this error and I don't understand it!
    InvalidGetError: Get not possible, invalid or unknown.
    Doc.pageNum:6:Batch undefined:Exec
    Obviously I'm doing somethign wrong ... but what?
    Thanks very much,
    Tim.

  • Font Used For Quick Look Plain Text Files?

    Hi,
    Does anyone know what font Leopard uses when you Quick Look a plain text file? It's one that isn't anti-aliased. I can't seem to find it anywhere in my Font Book.

    You could override that with code in userContent.css, either for all websites or for specific websites.
    *http://kb.mozillazine.org/userContent.css
    <pre><nowiki> pre{font-family:monospace!important}
    @-moz-document domain(svn.uni-konstanz.de){
    pre{font-family:monospace!important}
    }</nowiki></pre>

  • Help! Every app crashes when interacting with plain text files

    I recently bought a 13" i7 MacBook Air. I love its design and I found OS X Lion unbelievably fast on it, yet I find myself in a very dark situation, now.
    From the Finder to iA Writer, to TextEdit, every single app crashes when working with plain text files. In Finder’s column view I don’t even have to open them: the instant one .txt is selected, Finder crashes.
    Creating a new user account seems to fix the bug for that account, but I just spent one whole day copying files from my old work MacBook (where Lion opened .txt files without a problem) to the new account and losing another entire day of work because of a stupid bug is out of question. Also, I feel it would be a very temporary fix. What if the bug presented itself again? Would I have to create a third, a fourth account, and so on?
    I didn’t use any migration tool because I wanted a very clean installation.
    On top of that, the machine is as App Store–only as one could be. The only “internet” apps I have on it are Chrome (for the occasional Flash video), Movist (I can’t work with Quicktime’s flying controls), and nvALT. I didn’t even had the time to install the Creative Suite on this one. I can’t for the life of me think this is app–related. I suspect it’s some weird OS bug.
    I work in advertising, and I do some work in Adobe’s Creative Suite but *all* my copy is stored in plain text files. I always did it that way so that my files would be future–proof. It is kind of ironic now. So please, if anyone as the slightest idea of how to fix this, please, please, help. I find myself with a brand new computer I can’t use for work.
    Alessandro

    What are the files named?
    Where are they being made? (What folder?)

  • How to load data in plain-text file into database by using EJB?

    Hi,
    We need to develop an on-line application which requires us to load input data
    from a selected plain-text file on the Web server (iplanet server) into the backend
    oracle database. How could I use EJB to make it happen? it seems like using Entity
    EJB is not feasible.
    Really appreciate your help!
    Corona

    Hi Corona,
    "Corona Fang" <[email protected]> wrote in message
    news:3f3b0ea3$[email protected]..
    We need to develop an on-line application which requires us to load inputdata
    from a selected plain-text file on the Web server (iplanet server) intothe backend
    oracle database. How could I use EJB to make it happen? it seems likeusing Entity
    EJB is not feasible.If you are talking about loading thousands of records,
    the preferable way is using plain JDBC calls utilizing
    batch methods.
    Regards,
    Slava Imeshev

  • PI removing blank spaces at the end of the lines in a plain text file

    Hi -
    I have an interface that transfers a file via FTP. I defined both the sender and receiver to transfer either Text or Binary but the interface removes every blank space I have after the last character. The file is a fixed lenght file.
    Example:
    Original file:
    Hello world(space)(space)(space)(space)(space)(space)(space)(space)(eol)
    where (space) is the space character and (eol) is the end of line char.
    File after it is received.
    Hello world(eol)
    I already defined the parameter Row.fieldFixedLenghts with 10164 which is the lenght of the lines of the file.
    Any ideas why it may be happening?
    Thanks,
    Carlos.

    Hi -
    I tried both the parameters:
    xml.fieldContentFormatting
    structure.fieldContentFormatting
    The received file still has the problem. All the blank spaces are cleared out.
    The file is a plain text file not an XML file. May this be the issue?
    Thanks,
    Carlos.

  • Are plain text files treated differently in SP 2010 than MOSS 2007?

    We just moved to SP 2010 a week ago.  A user just contacted us asking why the files she accesses are not displaying.
    When she accessed these plain text files in MOSS 2007, they displayed within IE as a full page of text.
    When she accesses these now in SP 2010, she is prompted to download the file.
    These files do not end in .txt - they are names such as 2013.09.20 or whatever.
    Is there a way to configure 2010 to display, without any interpretation, plain text files within the browser?
    Thank you.

    Hi ,
    According to your description, my understanding is that you could not access the txt files with browser after migrading to SharePoint 2010..
    Whether this issue occurred if you upload a new txt file to a library.
    In my testing, everything worked well. The Open Documents in Client Applications by Default feature was acitve, and in the Library Settings->Advanced settings, ‘Use the server default(Open in the client application)’ was selected. When I clicked the file
    name, it promted a dialog like the below, I selected ‘Read-Only’, and clicked OK, the file could open with browser.
    Please go to IE->Tools->Internet Options->Programs->Manage add-ons, enable all add-ons related to SharePoint, compare the result.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • [SOLVED] Thunar sees both '.doc' and '.txt' as plain text files...

    Hello,
    I'm using Thunar as my file manager. However, it sees both '.doc' and '.txt' files as "plain text files".
    This means that I can't make the .doc files open with OpenOffice and the .txt files open with a plaintext editor, because whenever I change the program association of one, the other changes.
    How to fix that? (looks like a MIME-type issue).
    Thanks.
    Last edited by Renan Birck (2009-08-14 15:57:05)

    DaVince wrote:Open /usr/share/mime/globs and /usr/share/mime/globs2, find the lines that assign *.doc to the plaintext mime type, and remove them. Restart Thunar, problem solved.
    Finally it works. Thanks!

  • 'Plain text' files taking up 12gb

    Hi,
    I'm hoping someone can help me. I've recently been getting warnings that my start up disc is almost full. So I moved many photos and music files to an external HD and managed to free up 20gb.
    I then ran 'disc inventory' which showed that next to iTunes and movie files, 'plain text' files, 27,000 of them were taking up 12gb and 65,000 documents 11gb.
    Can someone please tell me where these files will be found on my mac as they need to be sorted - I've read that this could be a virus but what is the best way of combating this?
    There is no way I have this many files or documents and need to know how they are being stored!
    Thanks everyone

    bump

  • TextEdit - Plain Text Files That Open In Windows?

    Hi. Just got an iMac. I've been trying to make plain text files in TextEdit that show up correctly in Windows on a PC. I've tried saving the same document in 4 different formats:
    - Plan Text Unicode (UTF-8)
    - Plain Text Unicode (UTF-16)
    - Plain Text Western (Mac OS Roman)
    - Plain Text Western (Windows Latin 1)
    But none of these look right on a PC. All of the line breaks I've entered show up replaced by black rectangles. Why is this?
    What format should I save as in TextEdit, to create Plain Text files that are compatible with both PC and Macs?

    First, note that TextEdit does not create plain text files, it creates rich text files (.rtf). If you truly want plain text, try the free TextWrangler:
    http://www.barebones.com/
    As to the line break problem, Macs use just a carriage return as the end-of-line character, while Windows uses a carriage return followed by a line break character. At least, that's how I understand it. Most likely, whatever app you're using on Windows is dumb enough that it can't figure out what to do with the Mac line endings. TextWrangler will let you change the line breaks, so you could use it to create plain text files with Windows line breaks. Of course, that doesn't help if you didn't really want plain text (ie, absolutely no styling, just raw text).

  • Number format changed after opening a plain text file in Excel

    Hi,
    I have an urget need to understand about how to open a plain text file in Excel with numbers displayed as is. The text file is tab delimited. Right now, extra digits (0, or 00 ) are added. For example, 31:16 from text file is displayed as 31:16:00,
    15:0 becomes 15:00, 6:5 becomes 6:05. How to display the numbers as they are in the original text file?
    Thank you very much for the help.
    Amy

    This is a annoying problem.
    Excel will try to guess the data type if you leave the cell formatting as general.This happens a lot with specific numerical entries that could be confused as dates.e.g. 12:0,1-5 etc.Unfortunatley We can't tell Excel to stop reading it as a date, but what you
    can do is tell it to display the date how you want it.
    In addtion,in order to avoid confusion and keep track of troubleshooting steps, we usually troubleshoot one issue per thread. So if you need any further help, please create a new post.Thanks for your understanding.

  • Boot Camp Update 2.1: plain text file?

    Hi,
    in order to install the Service Pack 3 in my Windows XP partition, Apple recommends to upgrade the Boot Camp to version 2.1.
    I downloaded the BCUpdateXP.exe but it is label by Mac as "plain text" file, so I'm not able to run it and I don't know how to install the upgrade.
    What should I do?
    Thanks!

    Can you confirm with us that you have Boot Camp version 2.0 installed currently? This is because boot camp version 2.1 will ONLY install on if the previous version (2.0) is already installed.
    If your current version is not 2.0 then please insert the leopard installation disk in your CD/DVD drive while booted into Windows. This will begin installation of the 2.0 boot camp drivers. Reboot once completed. After that you can install the boot camp 2.1 drivers and it should install and complete.
    Axel F.

  • Add plain text files or notes to ipod 4th generation??

    I was wondering how to add plain text files or "notes" to my ipod. It says I should have a "Notes" tab on my iTunes, but I don't. I've tried enabling the disk use but it didn't change anything. What I need is to add some word files onto my ipod if thats possible.
    THANKS
    Sarah

    I haven't tested myself but after you open disk space you drag the file into your ipod?

  • What happened to importing plain text files in iTunes?

    I used to be able to export the playlist containing all the music I wanted to listen to as a plain text file. I would then import this file into a spread sheet, sort as I desired, assign each song a number, sort on that number and save the resulting groups to plain text files. I would then import these text files as playlists. It appears that this capability has disappeared in the current version of iTunes. I am capable of working with the xml if I have to, but that is more effort than I think is necessary. Have I missed something?

    I have been thinking about what you are suggesting and even with your last reply it does not solve the problem. I suspect you still do not see what I am driving towards. I have playlists for all songs with 5 starts, all songs with 4 stars, all songs with number of plays less than n. I also have playlists of those three that have not been played in n days. I listen to those sometimes. I also listen to my existing playlists which contain subsets all music not christmas and have at least a 3 start rating. This last set is not smart at present. With the current setup, music in those first 3 playlists get played more often. Any smart playlist that has to include not played in the last x will not play those songs more often unless I play those playlists more often. At present, to generate those non smart playlists I export, divide, and import information. Apple has changed the format it accepts on input. I either have to accept their new import method and start programming, or find a smart playlist method that solves this problem. I do not believe that anything yet suggested for smart solves the problem. The closest I have come is 3 playlists. One smart and two dumb. The smart one is all songs with rating above 3 and not christmas that have not been played in last x and is not in the two dumb ones and limit to 100. The dumb ones start empty. Let it populate, drag the list to one of the dumb ones. Let the smart one recompute. Drag it to the second dumb one. Play one list on each device. When playlist finishes, blank the dumb one for that device, sync, let iTunes repopulate the smart list, drag to dumb list and sync again. In the long term, I think I am better off programming.

  • How to read a whole text file into a pl/sql variable?

    Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?

    how to read a whole text file into a pl/sql variable?
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....

Maybe you are looking for