Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    Showing counter numeral in movie

    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

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    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

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.

    Code:
    &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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    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

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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&'
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #7
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    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

  • #8
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    as 2 is what the link i put uses.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #9
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •