Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Old 03-08-2001, 05:51 PM   #1
Flipper
Registered User
 
Join Date: Mar 2001
Posts: 9
Default

I've got the hang of reading data from a text file, but is there any way of writing to one? I don't know a thing about php or xml. I'm trying to write a scoreboard for a game i've written.
Cheers.
Flipper is offline   Reply With Quote
Old 03-08-2001, 07:25 PM   #2
deadbeat
Registered User
 
Join Date: Feb 2001
Location: vancouver
Posts: 2,219
Default

Hi...

You'll need a server-side scripting solution...PHP, ASP, etc...then you use loadVariables to send info from Flash out to the php script...

Here's a basic php script to get you started...this will write all variables in your flash movie into the text file test.txt. The SWF file, test.txt, and the php script file should all be in the same directory for this to work...

<?php
$data="test.txt";
$fp= fopen($data, "w+");
$fw= fwrite($fp,"$QUERY_STRING");
fclose($fp);
echo "status=Done"
?>

Hope this helps,

K.
deadbeat is offline   Reply With Quote
Old 03-08-2001, 07:35 PM   #3
Flipper
Registered User
 
Join Date: Mar 2001
Posts: 9
Thumbs up

Thanks for that. How do I link the swf to the php? And I'm assuming having a file anything.php3 with just the code you gave me will work - no extra code is needed.
Flipper is offline   Reply With Quote
Old 03-08-2001, 07:58 PM   #4
deadbeat
Registered User
 
Join Date: Feb 2001
Location: vancouver
Posts: 2,219
Default

Copy the php script into a text editor and save it out as anything.php

Then in the Flash movie you would trigger it with the action:

loadVariablesNum ("anything.php", 0 ,"POST");

Note that this is a really basic script, there's no error checking or anything- it just dumps all variables into the text file...

Hope this helps,

K.


deadbeat is offline   Reply With Quote
Old 03-08-2001, 09:57 PM   #5
Flipper
Registered User
 
Join Date: Mar 2001
Posts: 9
Default

I don't want to appear stupid, but I can't help it!
I've got the php code in a file called anything.php and have a swf file with 2 named text fields with values loaded from a txt file. That works. I have a button which has
loadVariablesNum ("anything.php", 0 ,"POST");
as the only thing in the 'on' call. I also have a txt file test.txt in the same dir as the others. I've tried looking up php codes but have only found it with mysql.

Can you suggest anything?!

Cheers
Flipper is offline   Reply With Quote
Old 03-08-2001, 10:03 PM   #6
deadbeat
Registered User
 
Join Date: Feb 2001
Location: vancouver
Posts: 2,219
Default

You may need to set the CHMOD permissions on the test.txt file to read/write...

K.
deadbeat is offline   Reply With Quote
Old 03-08-2001, 10:12 PM   #7
Flipper
Registered User
 
Join Date: Mar 2001
Posts: 9
Default

I've done chmod 666 test.txt and text1.txt, where I'm reading them from. Clicking on the button which is supposed to call loadVariablesNum doesn't seem to do anything.
Flipper is offline   Reply With Quote
Old 03-08-2001, 10:25 PM   #8
deadbeat
Registered User
 
Join Date: Feb 2001
Location: vancouver
Posts: 2,219
Default

Hmmm...

Do your variables exist on the root timeline? And are they being loaded from the movie on level 0?

Other than that, I'm not sure why it's not working for you...sorry...

K.
deadbeat is offline   Reply With Quote
Old 03-08-2001, 10:28 PM   #9
Flipper
Registered User
 
Join Date: Mar 2001
Posts: 9
Default

Yep, the text fields are directly on the stage. I used the debugger and it told me the variables were _level0.varname. It's a very simple movie, or so I thought! Thanks for your help - if you do come up with an answer let me know.
Cheers
S.
Flipper is offline   Reply With Quote
Old 03-09-2001, 12:21 AM   #10
flashlite
Registered User
 
Join Date: Feb 2001
Location: Levittown, N.Y.
Posts: 25
Default

Out of curiousity, is there any way to append this info so the text file can contain a list of say login users & passwords? Or must u have a database?

Flashlite
flashlite is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to text file theMonitor Flash 8 General Questions 6 10-05-2006 03:40 PM
trying to create preloader for flat file text mnk0 ActionScript 2.0 1 05-26-2005 06:16 AM
External text loads partially & Render text as HTML prevents loading of text file piercedwater ActionScript 2.0 20 03-02-2005 11:33 PM
Writing to a text file using actionscript sharadha ActionScript 1.0 (and below) 1 08-01-2002 07:08 AM
help writing to a text file seniorcrap Other Flash General Questions 4 04-05-2002 05:04 AM


All times are GMT. The time now is 04:21 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.