phpAdsNew  Home 

 

 

 

  5.1Using Flash banners 

 

phpAdsNew can display Flash banners, but it is a bit trickier than a normal banner.

 
  
  5.1.1Adding a Flash banner 

 


phpAdsNew can display Flash banners, but it is a bit trickier than a normal banner.
If you want to display a flash banner you need to manually upload the .swf file to a location on the webserver and select 'HTML banner' in the admin interface.
You can enter the code needed to display the banner in the HTML field.

The code displayed below is the default HTML code Flash 5 generates to display a Flash movie.
The code you need to enter in the HTML field will be similar to this.

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=5,0,0,0" WIDTH=468 HEIGHT=60><PARAM NAME=movie
VALUE="http://www.flash.com/flashmovie.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="http://www.flash.com/flashmovie.swf" quality=high
bgcolor=#FFFFFF WIDTH=468 HEIGHT=60 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/
index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

 

 
  
  5.1.2Logging AdClicks 

 


After adding a Flash banner, you will probably notice phpAdsNew won't log AdClicks for that banner. This is normal behavoir. Usually the target URLs are hardcoded in the Flash banner and if the user clicks on the banner it the Flash player will tell the browser to visit the hardcoded URL directly.

An example of an hardcoded URL in Flash 5:

 


ActionScript variables

To solve this problem we need to tell the Flash player to use the adclick.php file instead of the hardcoded URL. One way to achieve this effect is to replace the hardcoded URL with an ActionScript variable, but this is only possible if you have access to the original Flash movie source.

In the example below the hardcoded URL is replaced with an ActionScript variable called 'targeturl':

The only thing which remains is to tell the Flash player what URL the 'targeturl' variable should contain.
You can specify the contents of ActionScript variables by adding them to the movie URL

http://www.flash.com/flashmovie.swf?targeturl=http%3A%2F%2Fwww.foobar.com

The example above will set the targeturl ActionScript variable to http://www.foobar.com. The effect is the same as the first example, the user will go to the foobar.com website after clicking on the banner.

 

{targeturl}
phpAdsNew automatically replaces the string {targeturl} with the correct code it needs to log clicks for the URL specified in the field 'Linked to URL'.

http://www.flash.com/flashmovie.swf?targeturl={targeturl}

In the example above {targeturl} will be automatically replaced, and as a result the targeturl ActionScript variable will be automatically set to the correct URL needed to log the AdClick. If the user clicks on the banner the click will be logged and the user will be referred to the URL specified in the field 'Linked to URL'.

The complete HTML source needed for displaying a Flash banner would become something like the example below.

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=5,0,0,0" WIDTH=468 HEIGHT=60><PARAM NAME=movie
VALUE="http://www.flash.com/flashmovie.swf?targeturl={targeturl}">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="http://www.flash.com/flashmovie.swf?targeturl={targeturl}"
quality=high bgcolor=#FFFFFF WIDTH=468 HEIGHT=60 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/
index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>