...

View Full Version : Showing counter numeral in movie



SteveH
02-25-2008, 03:23 PM
Hello

I have an hit counter script:

<div align="center">
<%=GetCurrentHitCount("counter", true)%> visitors
</div>

which works in the browser: it shows: x visitors

I am hoping to use this same script in a Flash movie. I imagine I need to show the numberof hits in a dymanic text field in my movie, but if I give my dynamic text field an instance name of, say, counter_txt, how to I pass the numeral to counter_txt and what would I need to show in my AS (2) panel?

Thanks for any help.

Steve

gnomeontherun
02-28-2008, 02:34 AM
http://www.smartwebby.com/Flash_and_ASP/basics.asp

once you load the variables you then need to set the value of the text field to that of the variable you loaded

SteveH
02-29-2008, 09:00 AM
Hello Jeremy

Thanks for your post.

I have created a dynamic text box (dyn.txt) which should show the numeral (but doesn't) and inserted the following in Action Script (thanks for the link) in my AS(2) panel:

loadVariables("counter.asp", 0, "POST");
dyn_txt.text = currentHitCount;

I have just clicked on my ASP file on the server and can see:

7 visitors

This is exactly what I want to see, but would like to see it in Flash.

Do I need to declare currentHitCount as a variable in Flash (in the AS panel), or should the dyn_txt.text simply be dyn_txt?

Thanks Jeremy for your help.

Steve

gnomeontherun
02-29-2008, 05:11 PM
Your asp should export the variable in this format:

&currentHitCount=7&

So the asp script should ONLY output the above text - I'm not familiar with asp but here is my guess.


&currentHitCount=<&#37;=GetCurrentHitCount("counter", true)%>&

Flash can recognize the variable when it is in this format. If that doesn't work, try changing POST to GET.

SteveH
03-03-2008, 01:33 PM
Hello Jeremy

Unfortunately, when I use

&currentHitCount=<%=GetCurrentHitCount("counter", true)%>&I get the following error message in my ASP script.

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

/counter/hitCounter.INC, line 15

I have also tried to use GET (instead of POST) in my FLA file with my original script and while I do not get any ASP or AS errors, imy movie is still not displaying a numer of hits.

Thanks anyway for all your help.

Steve

gnomeontherun
03-03-2008, 06:30 PM
Perhaps you have to use the ascii code for the & sign? Again, I know nothing with asp, but it just needs to output plain text '&currentHitCount=6&'

SteveH
03-05-2008, 05:16 PM
Hello Jeremy

No, I think the ASP file works fine. It processes the 'hit' and it is successfully installed into a database.

What kind of AS should I be using?

Thanks.

Steve

gnomeontherun
03-06-2008, 06:38 AM
as 2 is what the link i put uses.

SteveH
03-06-2008, 01:17 PM
Hello Jeremy

The link refers to making a dynamic text box, so my Action Script (2) looks like this:

loadVariablesNum("counter.asp", 0, "POST");
dyn_txt = currentHitCount;

'dyn_txt' is the instance name of the dynamic text box and 'currentHitCount' I have typed in the var field in my FLA file.

In my online movie, however, no numeral appears. So I tried this:

var currentHitCount

loadVariablesNum("counter.asp", 0, "POST");
dyn_txt = currentHitCount;

again using 'dyn_txt' as the instance name of the dynamic text box and 'currentHitCount' in the var field in my FLA file. Again, no numeral appears.

Then I used the same AS, but removed 'currentHitCount' from the var field.But again, nothing in the numeral field I was hoping for.

Then I simply used:

loadVariablesNum("counter.asp", 0, "POST");
dyn_txt = currentHitCount;

without anything in the var field. Again, nothing.

What can I be doing wrong!

Thanks.

Steve



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum