NYCPHP Meetup

NYPHP.org

[nycphp-talk] How can I include a hyperlink to swf file ?

Rob Marscher rmarscher at beaffinitive.com
Wed Mar 14 16:16:14 EDT 2007


This is the best way to add Flash to HTML: http://blog.deconcept.com/ 
swfobject/

So in your case it would be like this:
<script type="text/javascript">
    var so = new SWFObject("images/upload/' . $image_name . '",  
"mymovie", "' . $width . '", "' . $height .'", "7", "#336699");
    so.write("flashcontent");
</script>


To add click urls, you need to modify the source for the swf.  It is  
possible to do this programmatically.  The OpenAds (formerly  
phpAdsNew/MaxMediaManager) project does it: http://www.openads.org/   
Take a look at the www/admin/lib-swf.inc.php file.  You want to make  
your swf accept an actionscript argument that contains the link where  
it should go when clicked.  The standard name for this argument is  
clickTAG.  So with you swf modified, here's your embed code:

<script type="text/javascript">
    var so = new SWFObject("images/upload/' . $image_name . '? 
clickTAG=' . $whateverUrlYouWantToGoTo .'", "mymovie", "' . $width .  
'", "' . $height .'", "7", "#336699");
    so.write("flashcontent");
</script>


Good luck!



More information about the talk mailing list