# Need help with flash and .txt files

**URL:** <https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306>\
**Category:** flash\
**Created:** [December 20, 2003, 11:56pm UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306 "2003-12-20T23:56:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boom\_dk](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@Boom\_dk](https://forum.kirupa.com/u/Boom_dk)\
**Post date:** [December 20, 2003, 11:56pm UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306/1 "2003-12-20T23:56:10Z")

</div>

Hi! I know there’s a way to load text from a .txt file into a flash movie… I tried that some time ago… BUT! I had the problem that flash was making double line spacing (know what i mean?).

Also i’d like to know if there’s a way SAVE a .txt file to a server / harddisc in flash. And if there is… How? PHP? Pure Flash? HTML?

HELP!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2003, 2:12am UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306/2 "2003-12-21T02:12:37Z")

</div>

[http://www.kirupa.com/developer/mx/multiple\_dynamictext.htm](http://www.kirupa.com/developer/mx/multiple_dynamictext.htm)  
[http://www.kirupa.com/developer/mx/externaldata.htm](http://www.kirupa.com/developer/mx/externaldata.htm)

there are 2 examples for loading external text…

as for your other question, yes you can save to an external text file using Flash and PHP…i added an example, and here is a brief explaination…

First, upload these files to the same directory on your server…  
secret.swf, secret.html, write.php, and textdata.txt .

How it works:

The Name, and Message Input text boxes have Variable names of  
name, and message respectively…

the actions on the submit button are:  
[AS]  
on (release) {  
loadVariablesNum(“write.php”, 0, “POST”);  
gotoAndStop(2);  
}  
[/AS]

So, when you press the button, it communicates with the write.php file on your sever which is set up like this…

```php

<html>
<body>

<? 

// Let's declare the 2 variables: 

$name = $_POST['name']; 
$message= $_POST['message']; 

// Let's open the file we want to put the data in: 

if($REQUEST_METHOD == 'POST'){ 
$file = "textdata.txt"; 
$fp = fopen($file, "a+"); 

// Write to the file: 

fwrite($fp, $_POST['name'] . ":" . $_POST['message'] . "
");fclose($fp); 
} 
?> 

</body>
</html>

```

The php file, saves the name/message to the external text document textdata.txt…ofcoarse you can customize it to your needs…this just an example of how it can be done…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2003, 9:34am UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306/3 "2003-12-21T09:34:32Z")

</div>

To get rid of double spacing, use

```auto

yourTextField.condenseWhite = true;

```

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 21, 2003, 1:58pm UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306/4 "2003-12-21T13:58:10Z")

</div>

Ey thx!! I’ve just got that problem taht i have no experience in PHP… Can i use it anyway?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 22, 2003, 2:34pm UTC](https://forum.kirupa.com/t/need-help-with-flash-and-txt-files/38306/5 "2003-12-22T14:34:41Z")

</div>

Guys? It doesn’t work! :\*( Why?!?! I’m so sure that the server has php support but it just wont write the file!!!:puzzle: It’s driving me crazy!!! :drool:
