Thursday, 8 July 2010

ClickTag in Actionscript 3

The clickTag in Actionscript 3 has changed from Actionscript 2. You can no longer use the _root property and the getURL. In AS3 you have to access the clicktag from the loaderInfo parameters and use the navigateToURL. Here are examples of the two types.

AS2 ClickTag

 getURL(_root.clickTag, '_blank'); 

AS3 ClickTag
ctag.addEventListener(MouseEvent.CLICK, clicked);

function clicked(e:MouseEvent):void{
 navigateToURL(new URLRequest(loaderInfo.parameters.clickTag), "_blank");

The HTML for embedding the swf with the AS3 clickTag is exactly the same as the AS2 version. It should look something like below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""> 
 <title>Click Tag example</title>
 <script type="text/javascript" src="swfobject.js"></script> 

 <script type="text/javascript">
  var flashvars ={ clickTag:""};
  var params = {};
  var attributes = {};
  swfobject.embedSWF("clicktag.swf?rnd="+Math.random(), "flashContent", "300", "250", "8", false, flashvars, params, attributes);

 <div id="flashContent"></div>


  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP