AppMeasurement.swc和错误#1023:发生堆栈溢出

时间:2012-08-30 21:23:45

标签: actionscript-3 flash adobe-analytics

我下载了一个新的AppMesaurement.swc并且一直在Omniture网站上尝试“Media.monitor Code Sample”。 http://microsite.omniture.com/t2/help/en_US/sc/appmeasurement/video/#Measuring_Additional_Metrics_using_Media.monitor

问题在于示例中的以下代码。

        if(media.event=="CLOSE") {
            s.prop51=media.name+ " : " +"100%"
            sendRequest(); //------> Not working and error(Error #1023: Stack overflow occurred.) occured on flash debug player
            s.prop51="";

        }

当media.event ==“CLOSE”时,flash调试播放器显示“#1023:发生堆栈溢出”并停止。

如果我注释掉“sendRequest()”,则错误消失并调用SC服务器,但不是s.prop51值。 我们需要在Media.close()之前发送自定义变量。

如何使这个Adobe示例有效?

感谢。

=== Adob​​e链接页面上的原文===

    /* Import line for ActionScript 3 */
    import com.omniture.AppMeasurement;

    /* Uncomment for ActionScript 2 with Flash Player 8+ and comment out other import lines */
    /* import com.omniture.AS2.AppMeasurement; */

    /* Uncomment for ActionScript 2 with Flash Player 6, 7, or Lite and comment out other import lines */
    /* import com.omniture.AS2.FPL.AppMeasurement; */

    var s:AppMeasurement = new AppMeasurement();
    /* Uncomment for Flex and comment out addChild(s); */
    /* rawChildren.addChild(s); */
    addChild(s);

    /* Specify the Report Suite ID(s) to track here */
    s.account = "jdoe";
    /* Turn on and configure debugging here */
    s.debugTracking = true;
    s.trackLocal = true;
    /* You may add or alter any code config here */
    s.pageName = "";
    s.pageURL = "";
    s.charSet = "UTF-8";
    s.currencyCode = "USD";

    s.Media.autoTrack=true;
    s.Media.segmentByMilestones=true;
    s.Media.trackMilestones="25,50,75";
    s.Media.trackVars="eVar2,eVar3,eVar1,events,prop51,prop50";
    s.Media.trackEvents="event1,event2,event3,event4,event5,event6,event7";

    /* Turn on and configure ClickMap tracking here */
    s.trackClickMap = true;
    s.movieID = "";

    /* WARNING: Changing any of the below variables will cause drastic changes
    to how your visitor data is collected.  Changes should only be made
    when instructed to do so by your account manager.*/
    s.visitorNamespace = "corp1";
    s.trackingServer = "corp1.d1.sc.omtrdc.net";
    var tracked25:Boolean
    var tracked50:Boolean
    var tracked75:Boolean
    var fireRequest:Boolean

    s.Media.trackUsingContextData = true;

    s.Media.contextDataMapping = {
    "a.media.name":"eVar2",
    "a.media.segment":"eVar3",
    "a.contentType":"eVar1",
    "a.media.timePlayed":"event3",
    "a.media.view":"event1",
    "a.media.segmentView":"event2",
    "a.media.complete":"event7",
    "a.media.milestones":{
    25:"event4",
    50:"event5",
    75:"event6"
    }
    };

    s.Media.monitor = function (s,media){

        if ((media.event == "MILESTONE") && (media.eventFirstTime)) {
         if (media.milestone == 25) {
              s.prop51 = media.name+ " : " +"25%";
              fireRequest = true;
         }
         if (media.milestone == 50) {
              s.prop51 = media.name+ " : " +"50%";
              fireRequest = true;
         }
         if (media.milestone == 75) {
              s.prop51 = media.name+ " : " +"75%";
              fireRequest = true;
         }
         if (fireRequest) {
              fireRequest = false;
              sendRequest();
         }
    }

        if(media.event=="OPEN") {
            s.prop50="Home page"
            sendRequest();
            s.prop50=""

        }

        if(media.event=="CLOSE") {
            s.prop51=media.name+ " : " +"100%"
            sendRequest();
            s.prop51=""

        }

        function sendRequest(){
            s.Media.track(media.name);
        }
    }

===我为测试而创建的代码====

 package
 {
import flash.display.Sprite;
import com.omniture.AppMeasurement;


public class testAppMeasurement extends Sprite
{   
    private var s:AppMeasurement = new AppMeasurement();

    private var testMediaName:String = 'testMediaName';


    public function testAppMeasurement()
    {

        addChild(s);

        s.account = "jdoe";

        s.debugTracking = true;
        s.trackLocal = true;

        s.pageName = "Test Page Name";
        s.pageURL = "";
        s.charSet = "UTF-8";
        s.currencyCode = "USD";

        s.Media.autoTrack=true;//false;
        s.Media.segmentByMilestones=true;
        s.Media.trackMilestones="25,50,75";
        s.Media.trackVars="eVar2,eVar3,eVar1,events,prop51,prop50";
        s.Media.trackEvents="event1,event2,event3,event4,event5,event6,event7";

        s.trackClickMap = true;
        s.movieID = "";

        s.visitorNamespace = "corp1";
        s.trackingServer = "corp1.d1.sc.omtrdc.net";
        var tracked25:Boolean
        var tracked50:Boolean
        var tracked75:Boolean
        var fireRequest:Boolean

        s.Media.trackUsingContextData = true;

        s.Media.contextDataMapping = {
            "a.media.name":"eVar2",
            "a.media.segment":"eVar3",
            "a.contentType":"eVar1",
            "a.media.timePlayed":"event3",
            "a.media.view":"event1",
            "a.media.segmentView":"event2",
            "a.media.complete":"event7",
            "a.media.milestones":{
                25:"event4",
                50:"event5",
                75:"event6"
            }
        };


        s.Media.monitor = function (s,media){

            if ((media.event == "MILESTONE") && (media.eventFirstTime)) {
                if (media.milestone == 25) {
                    s.prop51 = media.name+ " : " +"25%";
                    fireRequest = true;
                }
                if (media.milestone == 50) {
                    s.prop51 = media.name+ " : " +"50%";
                    fireRequest = true;
                }
                if (media.milestone == 75) {
                    s.prop51 = media.name+ " : " +"75%";
                    fireRequest = true;
                }
                if (fireRequest) {
                    fireRequest = false;
                    sendRequest(); //------> works good
                }
            }

            if(media.event=="OPEN") {
                s.prop50="Home page";
                sendRequest();  //------> works good
                s.prop50="";

            }

            if(media.event=="CLOSE") {
                s.prop51=media.name+ " : " +"100%"
                sendRequest();  //------> Not working and error occured on flash debug player
                s.prop51="";

            }
        }

        s.prop51 = 'prooop';
        s.events = 'event1';
        s.Media.open(testMediaName, 10,'player');
        s.Media.play(testMediaName, 0, 0);


    }


            private function sendRequest():void{
                s.Media.track(testMediaName);
            }


        }
    }

0 个答案:

没有答案