We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Posted By

chrisaiv on 02/03/08


Tagged

as3


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

blackabee
visuallyspun


AS3: Calling Google's Urchin Tracker from Flash


Published in: ActionScript 3 


Needed to figure out how to call Google's Urchin Tracker in AS3 since getURL is no longer available. This example uses External Interface


  1. //ExternalInterface Send Method
  2. ExternalInterface.call("urchinTracker",trackingStr);
  3.  
  4. //Strip Out Spaces and Replace with Underscores
  5. var pattern:RegExp = / /gi;
  6.  
  7. //Formulate Tracking String
  8. var formattedVideoTitle:String = _videoTitle.replace(pattern, "_");
  9.  
  10.  
  11. var trackingStr:String = "/" + _trackingPath + "/" + formattedVideoTitle;
  12.  
  13. //URL Request Send Method
  14. sendToURL(new URLRequest("javascript:urchinTracker('"+trackingStr+"');");

Report this snippet 

You need to login to post a comment.