actionscriptflashbannerclicktag

Flash banner with clickTAG and clickTARGET


I need to adapt my swf banner so that will work with clickTAG and clickTARGET. Actionscript code is required to be

on (release) {
  if (clickTAG.substr(0,5) == "http:") {
    getURL(clickTAG, clickTARGET);
  }
}

and my HTML code looks like this:

<embed src="banner.swf?clickTAG=http://my-site.com&clickTARGET=_blank" height="250" width="300">

What is wrong?


Solution

  • Actually the wrong thing was that i was using Flash 8, upper code is for Flash from 4 to 7.

    Right way to do it in Flash 4, 5, 6 or 7 in ActionScript 2:

    on (release) { 
       if (clickTAG.substr(0,5) == "http:") { 
          getURL(clickTAG, clickTARGET); 
       } 
    } 
    

    Right way to do it in Flash 8 or 9 in ActionScript 2

    on (release) { 
       if (_root.clickTAG.substr(0,5) == "http:") { 
          getURL(_root.clickTAG, _root.clickTARGET); 
       } 
    } 
    

    The implementation in HTML is following.

    With embed tag:

    <embed src="path_to_swf.swf?clickTAG=http://website-to-open.com&clickTARGET=_blank" width="300" height="250">
    

    Or with object tag which should be better practice:

    <object type="application/x-schockwave-flash" data="path_to_swf.swf" width="300" height="250">
    <param name="flashvars" value="clickTAG=http://website-to-open.com&clickTARGET=_blank">
    </object>
    

    Target _blank can also be replaced with _self or _top.