PDA

View Full Version : Changing news from a swf



GPP
September 21st, 2005, 09:28 PM
I've been trying to figure this one out fer quite a while... Ok say there was a textbox with news... and if you had a password you could cahnge the news right from the swf insted of resorting to the fla to cahnge it

_BYTE
September 21st, 2005, 09:38 PM
Ive tried, and the only way to do it is with a php script that will edit the text file. Php is not something I can understand YET. But you should try looking at this.

http://www.flash-db.com/Tutorials/

The Guestbook uses a php script that edits a text file that contains the actual data that is posted. If this were my problem, Id make a MC with a password protection that can "Post" an additional "Comment" or entry. If you modify it, it can be made into a flash Journal/Blog system.

Blackspirit
September 21st, 2005, 10:46 PM
Um, why not XML?

http://www.kirupa.com/web/xml/examples/newseditor.htm

optixburn
September 22nd, 2005, 09:40 AM
Are you talking about using the swf file as an interface or actually exporting the new xml out from the swf?

If you are using the swf as an interface then you can have it load in an xml file that you can retrieve and upload to the server or wherever you need it. There is no way to export an xml file back out to the server from flash through a swf file, other than getting flash 8 and using the new upload and download features with it (haven't tested it yet but looking forward to since it elimates some of the back end programming since you can upload and download files).

hope this helps.

GPP
September 24th, 2005, 01:20 AM
With the xml .. it alwayz displayz a error..

nathan99
September 24th, 2005, 06:55 AM
mmm i dont no much php or xml, what i would do is load info from a .txt file and update that, not the fla. Otherwise, i say go php

GPP
September 24th, 2005, 02:37 PM
I tried txt'ing it but i didnt work :|

nathan99
September 24th, 2005, 06:59 PM
do it like by making a variable in your .txt file.

1.
Make your text file by putting in.
News = your text.
the flash file reads everything after the News =

2.
Name your text file [/B]news.txt[/b]

3.
Make your dynamic text box in your swf with the name news

4.
Place this code on the frame;


myLoadVar = new LoadVars();
myLoadVar.load("news.txt");
myLoadVar.onLoad = function() {
news = myLoadVar.News;
//myLoadVar.News; = variable name in text file
};

GPP
September 24th, 2005, 07:22 PM
Hmmm it didnt work.. i followed ur steps

nathan99
September 24th, 2005, 07:43 PM
put ur files in a zipped folder and send it to me, or if u wish, an example folder

GPP
September 24th, 2005, 11:59 PM
Ok here

nathan99
September 25th, 2005, 12:13 AM
the names are case-sensitive.
it should be news.txt
you have News.txt

Blackspirit
September 25th, 2005, 12:15 AM
I think you should take the spaces out in your text file :D

GPP
September 25th, 2005, 01:11 AM
i did change it to lowercase it didnt do anything and i tried taking out the spaces :|

nathan99
September 25th, 2005, 02:11 AM
myLoadVar = new LoadVars();
myLoadVar.load("news.txt");
myLoadVar.onLoad = function() {
news = myLoadVar.news;
//myLoadVar.News; = variable name in text file
};

that also needs to be changed as you have news = hello not News = hello

GPP
September 25th, 2005, 12:39 PM
Now it gives me undifined.... hmmm

Can you gimme a zipped file.. it would help :)

nathan99
September 25th, 2005, 06:19 PM
here u go

GPP
September 26th, 2005, 11:42 PM
Unexpected File Format MX 2004 PLZ

nathan99
September 27th, 2005, 02:27 AM
oop

GPP
September 27th, 2005, 06:24 PM
Hey thx so much man!

nathan99
September 27th, 2005, 06:54 PM
:)

GPP
October 8th, 2005, 02:29 PM
Is there a way to change the news from the SWF ...

Say if you entered a password and then you can update it without touching the text file.. is this possible?

_BYTE
October 8th, 2005, 02:42 PM
... Just refer to my post on page ONE

GPP
October 8th, 2005, 02:46 PM
Yes, but that changes it from a php I want to know if I can change it from a swf

Bash321
October 8th, 2005, 03:57 PM
without php or other server-side scripts, no.

GPP
October 8th, 2005, 05:32 PM
How bout flash communicating with php and i can change it from flash which communicated to the php file which communicates to the txt

Swf-->Php-->Text?