9 Replies Latest reply on Feb 6, 2009 3:27 PM by kglad

    class scope issue?

    brian914 Level 1
      I am trying to write a class that activates my buttons. I can't seem to make the onRollOver call a function. Why is that? What am I doing wrong?

      Thank you for any help with this!



      class HomeMain extends MovieClip
      {
      //Button Variables
      private var home_btn0:MovieClip;
      private var home_btn1:MovieClip;
      private var numOfBtns:Number = 2;
      private var whichOne:Number;

      public function HomeMain(Void)
      {
      activateBtns();
      }

      private function activateBtns():Void
      {
      for(var i:Number = 0; i < numOfBtns; i++)
      {
      var ref:MovieClip = this["home_btn" + i];
      ref.id = i;
      ref.onRollOver = function():Void {
      rollOverActions(this.id);
      }
      }
      }

      private function rollOverActions(whichOne):Void
      {
      trace("over");
      }
      }