# allowing user to edit text in Flash site



## developing (Jul 25, 2008)

Hi, I'm really stuck on something so I hope anyone can offer some direction here...
I have developed a Flash site for a customer and they really like it but they want to be able to edit/update the text on three of the pages without having to use Flash. Right now, I have those three pages set up as Static Text and I've been making their updates myself by opening the .fla file and literally typing the new text in. Is there a way to set up an HTML or text file that they can use to type the text in themselves and then have that text automatically display in the Flash site? 
Any help would be great!


----------



## jamiemac2005 (Jul 5, 2007)

Hey, there are 2 ways to go about this, they're quite similar they differ slightly with the actionscript you'd need to use:

Both would need you to change the static text types to dynamic text.

- Do that first and give the dynamic text box an instance name ending in "_txt".

Method 1)
Set up the flash so it reads in a variable from a text file then puts that in the dynamic text box.
To do this:

```
- create a text file in the same directory as the site and call it something like "paragraph.txt" (or something more descriptive)
- Within that text file type "paragraph=Blah blah blah your paragraph to insert goes here"
- Within flash add the following actionscript where you want the text to load into the dynamic text boxes:

//define a loadvars object
myParagraph = new LoadVars();
//define its onload handler
myParagraph.onLoad = function() {
//set the text of paragraph_txt(the dynamic text box) to the variable
paragraph_txt.text = this.paragraph;//here paragraph is from the text file (paragraph=)
};
//load the text file
myData.load("paragraph.txt");
```
The other way would be to use XML but it is a fair bit harder to navigate xml using flash, so i'll leave you to google that if you wish to go down that route.

There are some amazing flash tutorials on XML here:
http://www.gotoandlearn.com/

Post back if you need more help.

Cheers,
Jamey


----------



## sobeit (Nov 11, 2007)

another way to for the customer to edit the files without messing anything up is using adobe ontribute. You can set it up the customer can only access what you want them to access. You may want to check this option out.

http://www.adobe.com/products/contribute/


----------



## Slapshot (Feb 3, 2008)

```
<?php

echo '
<form method="post" enctype="text/plain">
<br />
Content:
<br />
<textarea name="content"></textarea>
<br /><br />
<input type="submit" value="Submit" name="submit">
</form>
';

if(!$_POST['content']) {
	echo 'Content is a required field.';
} else {
	echo 'Content was successfully edited.';
	$content = htmlspecialchars($_POST['content']);
}

?>
```
Use javascript or something to import the variables.


----------



## developing (Jul 25, 2008)

Thank you everyone for your suggestions. Unfortunately, I can't get any of them to work correctly though.  For some reason, only the first three lines of the text file are displayed in the dynamic text area of the Flash page. Any idea why this would happen?
I really appreciate any help with this! The client wants it done by the end of this week.


----------



## jamiemac2005 (Jul 5, 2007)

Could you post the code/a link to the site?

Cheers,
Jamey


----------



## developing (Jul 25, 2008)

http://www.artedistrazza.com/test/Links_new3.htm


----------



## jamiemac2005 (Jul 5, 2007)

Hey, you'll have to post the source to the flash file...

Cheers,
Jamey


----------



## developing (Jul 25, 2008)

hmm....how do I do that?


----------



## jamiemac2005 (Jul 5, 2007)

lol, open the .fla, show us what actions are occuring, or just upload the .fla


----------



## developing (Jul 25, 2008)

loadVariables("linktext.txt", this);
this is really the only action that the .fla has 
i can't upload files for some reason 
thanks for helping me with this!


----------

