So a few people have been asking for hit counters that work on Myspace. You can put one of those image ones, but I figured this would be better because you can incorporate it into your flash layouts and stuff:
Step 1 - Making the php:
Open Notepad or any other text editor (Crimson editor!).
Copy and paste the text in
this file into a blank document and save it as counter.php.
Step 2 - Making the counter textfile:
Open a new text document and type this:
counter=0
and save that as counter.txt
Step 3 - Building the flash:
Open flash.
Open a new document and save it as counter.fla
In that document make a new movie clip - CTRL + F8 (CMD + F8 on Mac) and name it "counter_mc".
Within that movie clip make a dynamic text field, type the number 1 inside of it, and give it the VARIABLE name counter_field
If you dont know where the Var field is, lookie here:
ok. now go back to the main timeline. Click "Scene 1" on the timeline at the top of the screen.
Drag an instance of counter_mc from your library to the stage. Now once it's on the Stage, drag it outside of the white Stage area to the top left. Now give the movieclip the instance name form_mc
Click on the first frame on the first layer and press F9 to bring up your actions panel.
type these actions:
_root.form_mc.loadVariables("http://yoursite.com/counter.php",,"POST");
Export your swf.
Step 4 - Upload time:
upload counter.swf, counter.txt, and counter.php to a server or host that allows php.
everytime that swf file is accessed it will add one to the counter.txt file.
You can clear the counter simply by downloading the text field, changing it back to zero and re-uploading, replacing the old file.
Here is a working version of the FLA file (i made it usable in Flash 8):
FLA
<hr>
Step 5 - Accessing the text file to use in flash movies:
Open a new flash document_
Save it as access_counter.fla
add a Dynamic text field to the stage and give it the instance name counter_text
add the actionscript from
this text file to the first frame of the first layer of your timeline.
You can add this text box and those actions to any flash movie and it will load the count.
Here is the source for the counter access.