Grupos » Flash Maniacs » Temas » [T] Flash/PHP Myspace Hit Counter

Listado 1-9 de 9    1   de  1
Autor Mensaje
Copenhagen

M/20
Far Hills,
New Jersey
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder a esta publicación Publicado:  sep 9, 2007 4:51 a.m.
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.
Copenhagen


M/20
Far Hills,
New Jersey
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 9, 2007 4:53 a.m.
if you find problems with the tutorial let me know... i rushed it.
Flash Mod


M/22
,
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 9, 2007 1:44 p.m.
cool Cope, I added it to the tutorials list
Copenhagen


M/20
Far Hills,
New Jersey
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 12, 2007 9:59 p.m.
anyone used it?
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 13, 2007 3:38 a.m.
I did but I did it in a quick rush and I may have done something wrong or not followed the directions carefully cause it didn't seem to work...
Copenhagen


M/20
Far Hills,
New Jersey
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 13, 2007 8:13 p.m.
prob cause u rushed it. i did it 4 times by the tute. and it worked..
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 13, 2007 11:25 p.m.
yea
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: sep 15, 2007 3:48 a.m.
Raul wrote:
_root.form_mc.loadVariables("http://yoursite.com/counter.php", , "POST");

should be

_root.form_mc.loadVariables("http://yoursite.com/counter.php", "POST");

haha it gave me a compiler error


yea I fixed that when I tried it
Listado 1-9 de 9    1   de  1

dspPostReplies v29