1 Reply Latest reply on Feb 13, 2008 8:56 AM by Newsgroup_User

    function inside/outside an if condition

    Level 7
      Hi,

      I noticed that defining a funciton inside an if condition seems to act
      different than one defined before that. I tried to use an setInterval on
      a function, both in- and outside the if conditon.

      // this one does nothing
      if (1){
      function globalLoop(){
      trace("globalLoop")
      }
      lv1 = setInterval(globalLoop,100)
      }



      // this one does loop
      function globalLoop(){
      trace("globalLoop")
      }
      if (1){
      lv1 = setInterval(globalLoop,100)
      }


      Where is the difference, how does this behavior explain?