Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Need Help
Topic Started: Feb 10 2006, 10:15 AM (167 Views)
bracks
Member Avatar
Brackenwood Lightweight
hi thanks for reading my question is

is there a way to save something at a notepad file (*.*txt)?? for example, you enter to a page with flash on it, flash reads that the person its the user number 5 and then the flash file prints hello your the 5th user that enters this page!!
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
You can do it, but to save stuff to the text file your server needs this thing called "PHP".

An easy way to test this is to make a text file, call it "test.php", and inside the file put:

Code:
 
<?PHP
phpinfo();
?>


Then upload the file to your server. If the server has PHP, that page should load with lots of stuff on it. If the server doesn't have PHP, the page will just have the words that you typed into it in it.

If you have PHP, then you can write to the file.
To do so, make a new text file called "update.php" and enter the following:
Code:
 
<?PHP

   if(isset($_POST['newcount'])) {
       file_put_contents("count.txt", "count=" . $_POST['newcount']);
   }

?>


This file will allow you to add to the count in the text file.

Now, go into flash, open up the actionscript panel and type:
Code:
 
var lv:LoadVars = new LoadVars();
var mycount:Number = 0;

lv.load("count.txt");
lv.onLoad = function(success:Boolean) {
if (success) {
 mycount = lv.count + 1;
 trace(mycount);
 lv = new LoadVars();
 lv.newcount = mycount;
 lv.sendAndLoad("update.php", lv, "POST");
 lv.onLoad = null;
} else {
 trace("There was an error loading from the file");
}
}


That should do the trick. When the text file gets loaded, it will store the visitor number in the variable called "mycount", and it will update the text file with the new number of hits via the update.php file.

Don't hesitate to post if you have any problems!
Offline Profile Quote Post Goto Top
 
bracks
Member Avatar
Brackenwood Lightweight
yeah I can do it like that and i also think that i can do it wit xml its not really a counter the thing that i want but anyways thanks vector just two more question to your code...

in php a variable its noted by $and_my_variable_name?
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Yeah.

$var = 0

will set the variable called "$var" to 0.

There are also special variable types, being $_SERVER, $_COOKIE, $_GET and $_POST, among others. These actually store arrays with the values set depending on the web page and the server.

For more information about them Check this page out.
Offline Profile Quote Post Goto Top
 
bracks
Member Avatar
Brackenwood Lightweight
wooooow thanks vector and it is in spanish double thanks vector!!!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply