1 Reply Latest reply on Jun 19, 2006 2:17 PM by Peter Lorent

    Function scope problem

    I tried
      Hi all,

      I am using a class-based system for all my actionscript, but am having trouble getting the following code to work properly, and I am pretty certain it is a scope issue.

      public function setNavButtons(prevStart:Number,prevEnd:Number,nextStart:Number,nextEnd:Number){

      var owner = this;

      if (prevStart != undefined){

      mcPropertiesNav.btnBack.onRelease = function():Void{
      owner.reloadView(prevStart,prevEnd);
      };

      }

      if (nextStart != undefined){

      mcPropertiesNav.btnNext.onRelease = function():Void{
      owner.reloadView(nextStart,NextEnd);
      };
      }
      }

      I've traced it out and know that when I use the reloadView method, the prevStart and prevEnd parameters are being passed in as undefined. Does anyone know how I would reference these variables within the onRelease functions?

      Thanks in advance
      Robert