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 .

Recommended Answers

All 7 Replies

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

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 .

Not directly, you would need to do it the way I suggested

Hi tiggsy, sry, I cant understand what you are saying

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.

<?php
$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);
?>
<html>
<head>
<title></title>
<!-- all your regular stuff for the head section -->
</head>
<body>
<center>
<?php
//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\" 
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,16,0\"
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\" 
type=\"application/x-shockwave-flash\">
</embed>
</object>";
?>
</center>
</body>
</html>

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

Hope this is clear

Thank you tiggsy.. I helped more.. thank you

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.