Hi all, I need a code that i want to set an anchor tag to flash file , Bcz i want to count the clicks on the flash file and want to save into my DB . Is there any way for that ? I dnt need getURL(); It will take user to the page directly .

5 Years
Discussion Span
Last Post by tiggsy

You would need to embed the flash file on a page, then have a snippet of code on the page that increments your counter, wherever you are storing that information.

If you tell us where you're storing this (flat file? database file? which database?) it makes it possible to give a more comprehensive answer

Edited by tiggsy: n/a


Hi tiggsy, Thank you for reply, I have a site , One of my customers give their flash adds to me, SO in this case i want to send report to them how many users clicks their add , They were giving flash file which includes their URL, Some other gives me a GIF image, thats not a problem , Simply i added a HREF tag to that image and count the clicks to MySql DB . When going to flash i cant able to do that . Is there any way to give external link to flash object .


OK. Here's chapter and verse:

Set up a page (maybe showvideo.php). I've used table name visitcount and field name visits for storing the counts, doubtless you use a different name.

$video = $_GET['v'];
//put your increment code here, this is an example
include "includes/mysql-connect.inc"; //if you haven't already connected to database
$query = "update visitcount set visits=visits+1 where video='$video'";
$result = mysql_query($query);
<!-- all your regular stuff for the head section -->
//put your embed code here. use $video where the name of the video goes 
//(2 places in many embed codes, depends which one you are using)
//also ensure the height and width are set to the correct values - again, possibly in 2 places
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" 
width=\"320\" height=\"400\" >
<param name=\"movie\" value=\"[B]$video[/B]\">
<param name=\"quality\" value=\"high\">
<param name=\"play\" value=\"true\">
<param name=\"LOOP\" value=\"false\">
<embed src=\"[B]$video[/B]\" width=\"320\" height=\"400\" play=\"true\" loop=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" 

Then, instead of linking direct to the video ("filename.swf") link to showvideo.php?v=filename.swf

Hope this is clear

Edited by tiggsy: to put code thingies in


I've just noticed that you're wanting to use this for "adds" - you do mean advertisements? If so, you might want to do something else, which is use a redirect code instead of the url it's going to. Maybe use one generated by eg. bit.ly or one of the other services that keep stats on clickthroughs. This would be a LOT easier

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.