1 Reply Latest reply on Sep 6, 2006 10:26 AM by NSurveyor

    Can you load a Word document?

      I have many pages of Word documents (.doc) that I would like to load into my SWF at runtime. Do I have to convert these to text files (.txt) in order to use LoadVars with a dynamic text field? If possible, I would like to keep my formatting and just load the word file as is.
        • 1. Re: Can you load a Word document?
          NSurveyor Level 2
          Flash can load Word documents using LoadVars, but displaying is the hardest part. Flash recieves the Word doc similarly to how you see a word doc in Notepad, with characters like: ÐÏࡱá. It seems rather unlikely to parse this data into how the document once looked. However, Flash does support some basic HTML, like <b>,<i>,<u>,<a>,<ol>,<ul>,<li>,<span>, <p>, <img>, etc. So it might be easier to export your Word document as an HTML document, and then simplify its contents to a form Flash understands. And Word likes to use CSS to format its data when exported, and with Flash MX 2004, you can use TextField.StyleSheet with the <p> or <span>mif you want to format it in a similar fasion. So say you save the following in your document to load:

          <b>This is bold.</b><i>This is italic.</i><u><a href="asfunction:trace,HAHAH"> And this is a link!</a>

          and saved it as contents.html or contents.txt or whatever you want, you can do something like this in Flash:

          my_lv = new LoadVars();
          my_lv.onData = function(text){
          my_txt.html = true;
          my_txt.htmlText = text;

          where my_txt is the TextField that will hold the contents of your HTML.