1
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.external.ExternalInterface;
import com.google.analytics.AnalyticsTracker;
import com.google.analytics.GATracker;
public class DetailView extends MovieClip {
var tracker:AnalyticsTracker = new GATracker(this, "UA-BLABLA", "AS3", true);
我得到這個:Flash包中的`GATracker`應該使用什麼上下文?
1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject.
這完全是有道理的,因爲this
參考type Class
對象。但是 - 如果我不能通過type Class
,我應該通過什麼?
該文檔是here,但我找不到任何我應該作爲構造函數方法的第一個參數傳遞的引用。
編輯#1:聽起來像我需要通過一個displayObject
,http://code.google.com/p/gaforflash/source/browse/trunk/src/com/google/analytics/GATracker.as?r=398
此外,關於傳遞一個DisplayObject,您的DetailView是一個DisplayObject,因爲影片剪輯是一個DisplayObject。 –
實際上,我認爲代碼在'new GATracker'構造函數後停止工作 - 我在'new'之前有一個來自ExternalInterface'的console.log調用,並且它記錄了日誌,但之後沒有。另外,GA文檔在片段中使用了「AnalyticsTracker」而不是「GATracker」:http://code.google.com/apis/analytics/docs/tracking/flashTrackingSetupFlash.html#useAnalyticsLibrary –