Question : Statement must appear within on handler????

I have the following code attached to a button, but I get this error when I publish it:

Statement must appear within on handler
     this.onRelease = function(){
////////////////////////////////////////


this.onRelease = function(){
//create the value object to pass to analytics facade
      var valueObj = new Object();
trace("entering call");
//create the callback object
      var callback=new Object();
      callback.scope = this;
      callback.func = function(){
            trace("onGetURL function worked");
}

valObj.s_pageName = "My : Downloads";
valObj.s_event = "navigation selected";
_level0.myAnalyticsFacade.registerView(valObj, callback);
}

on (release) {
      gotoAndPlay("trailer");
}

Answer : Statement must appear within on handler????

buttons use this method
on(release){
//code here
}
on(rollOver){
//code here
}
etc
on the clip itself, like an mc uses
onClipEvent(enterFrame){
}
on the clip itself
replace your function header with
on(release){
//create the value object to pass to analytics facade
     var valueObj = new Object();
trace("entering call");
//create the callback object
     var callback=new Object();
     callback.scope = this;
     callback.func = function(){
          trace("onGetURL function worked");
}

valObj.s_pageName = "My : Downloads";
valObj.s_event = "navigation selected";
_level0.myAnalyticsFacade.registerView(valObj, callback);
}

and you won't get that error

Billystyx
Random Solutions  
 
programming4us programming4us