Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to make a function call

Posted on 2009-02-23
3
Medium Priority
?
440 Views
Last Modified: 2012-05-06
I was wondering how can I make a call based on the code snippet. I want to "onClick" of a button call a function that will set these variables (s.events and s.Media.track) but I'm not sure how the scope of variables work and how to pass them into a function. I'm not a Flash developer. :)

private function somePageClick(event:MouseEvent):void {

 s.events="event5";
 s.Media.track(media.name);

}
import com.omniture.ActionSource;
var s:ActionSource;
function configActionSource() {
 
        s = new ActionSource();
 
        s.account = "comdev";
 
        s.pageName = "MyVideoPageName";
        s.pageURL = "";
 
        s.charSet = "UTF-8";
        s.currencyCode = "USD";
 
        s.trackClickMap = true;
        s.movieID = "Example 1";
        s.Media.autoTrack= true;
        s.Media.trackWhilePlaying = true;
        s.Media.playerName = "EA Player Name2"
        s.Media.trackSeconds=5;
        s.Media.trackVars="events,prop1,prop2,prop3,prop4,prop5,prop6,prop7,prop8,prop9,prop10,prop11,prop12,eVar1,eVar2,eVar3";
        
        s.Media.trackEvents="event1,event2,event3,event4,event5";
 
        s.prop1="LABLE/BUSINESS_UNIT";
        s.prop2="STUDIO_NAME";
        
       s.events="event1,event2";
                
        s.debugTracking = true;
        s.trackLocal = true;
 
        s.visitorNamespace = "eaeacom";
        var s.dc:Number=112;
 
 
        addChild(s);
}
configActionSource();
s.Media.monitor = function (s,media) {
        
        if(media.event=="OPEN") {
                s.events="event1";
                s.eVar1="evar1Value";
                s.prop1="LABLE/BUSINESS_UNIT";
        }
        
        var tracked25:Boolean=false;
        var tracked35:Boolean=false;
        var tracked50:Boolean=false;
        var tracked60:Boolean=false;
        var tracked75:Boolean=false;
        var tracked85:Boolean=false;
        
        if ((!tracked25) && (media.percent >= 25)) {
                s.events="event2";
                s.prop2="STUDIO_NAME";
                s.eVar2="evar2Value";
                
                s.Media.track(media.name);
                tracked25=true;
        }
        
        if ((!tracked35) && (media.percent >= 35)) {
                
                s.Media.track(media.name);
                tracked35=true;
        }
 
        if ((!tracked50) && (media.percent >= 50)) {
                s.events="event3";
                s.prop3="SITETYPE";
                s.eVar3="evar3Value";
        
                s.Media.track(media.name);
                tracked50=true;
        }
        
        if ((!tracked60) && (media.percent >= 60)) {
                        
                s.Media.track(media.name);
                tracked60=true;
        }
                
        if ((!tracked75) && (media.percent >= 75)) {
                s.events="event4";
                //Change value of prop1 one
                s.prop1="NEWLABLE/BUSINESS_UNIT";
                s.Media.track(media.name);
                tracked75=true;
        }
        
        
        if ((!tracked85) && (media.percent >= 85)) {
                s.events="event4";
                //Change value of prop1 one
                s.prop1="CHANGED LABLE/BUSINESS_UNIT";
                //Changed values being reported
                s.Media.trackVars="events,prop1,eVar1";
                s.Media.track(media.name);
                tracked85=true;
        }
        
        if(media.event=="CLOSE") {
                s.events="event5";
                s.Media.track(media.name);
        }
}

Open in new window

0
Comment
Question by:894359
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 23731718
just add an eventListener to the button to call your function




myButton.addEventListener(MouseEvent.CLICK, doRegister);


function somePageClick(evt:Event) {
       s.events="event5";
 s.Media.track(media.name);

}
0
 

Author Comment

by:894359
ID: 23740966
Just didn't know how to source the media.name variable?
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 23742249
where is this button in terms of the code you supplied.
what happens when you trace it - are you getting undefined or other error messages?

you may need to zip it all up and upload it.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question