Export .txt file using ActionScript

Posted on 2009-04-30
Last Modified: 2013-11-11
I am runing a word macro and it creates a .txt file and then runs a .swf file. the .swf file loads the text file and based on its content it performs diferent functions. For example if the word exit is in the text file then flash will not display a movie clip for example.
How could I create a .txt file using ActionScript or save a var as text so that my word macro can then search for that .txt file and depending on what words that file has then thats what word will execute. I have the following code to load the textfile into flash:
var req:URLRequest = new URLRequest("external.txt");

var loader:URLLoader = new URLLoader();

function fileLoaded(event:Event):void


		external_txt.text =;

		external_txt.appendText(" Here's some additional text!");


loader.addEventListener(Event.COMPLETE, fileLoaded);


Open in new window

Question by:TonoNam
    LVL 8

    Accepted Solution

    Actionscript won't let you write anything to the hard drive. That would be a serious breech of security. If it did, then people would be writing apps that screw up other people's PCs left and right.


    Author Comment

    Is there a way to comunicate with vba though? Could I run a flash application that will make a macro run?
    LVL 8

    Expert Comment

    I don't have any expierience with vba, so maybe someone else could answer that better than me, but I seriously doubt Actionscript could execute anything with a call to a vba script.
    LVL 12

    Expert Comment

    You could consider using ActionScript in Adobe Flex + AIR. That runs on the desktop as a standalone app and can create/edit files on the system.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
    Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
    In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
    The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now