PDA

View Full Version : ASP counter advice, please


SteveH
03-07-2008, 01:02 PM
Hello

I have the following snippet which shows the number of 'hits' on a Web page. There is an .INC file included, too.

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

How can I pass the number generated to a Flash site using Response.Write, please?

Is it something like: Response.Write &GetCurrentHitCount

Many thanks.

Steve

Spudhead
03-07-2008, 05:25 PM
well.. <%=value%> is just a shorthand for <%response.write(value)%> so I guess the question is really how you pass the value into Flash, and that depends on a few things, mainly what version of Flash you're using and how you're embedding the movie on the page.

arthurakay
03-07-2008, 09:58 PM
you could pass the variable (in this case, the number) into a query string...

www.domain.com?counter=5

then have your Flash scripts use a GET operation...

I don't know much about Flash, but that seems like an easy solution.

SteveH
03-08-2008, 06:43 PM
Hello Spudhead

Yes, if <%=value%> is just a shorthand for <%response.write(value)%>, as you say, that explains why, in a normal HTML page, I can see 12 visitors, or 13 visitors, etc by using <%=GetCurrentHitCount("counter", true)%> visitors.

Yes, you are right: the "question is really how you pass the value into Flash".

The version I am using is MX 2004. I have a dymanic text box (which should show the number passed to it from the ASP file) and its instance name is dyn_txt.

I have this in my Flash (FLA) file:

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

I think there are a number of combinations I could use: loadVariablesNum or LoadVars and maybe dyn_txt and not dyn_txt.text (I get different suggestions from different people on different Flash/Action Script forums), but what I am mainly concerned with here is just what you have identified: "how you pass the value into Flash" via ASP.

I'll read up on query strings, thanks arthurakay; in the meantime I will try to pursue it along this route, but many thanks for your post.

Cheers

Steve