1 Reply Latest reply on Sep 7, 2006 10:11 AM by derobinson

    how to pass variable in a function

      I would like to ask how to pass the value "char" into the "onSoundComplete" function? many thanks! many thanks!

      _root.playVO = function(pageNum, char){
      var myVO:Sound = new Sound();
      myVO.loadSound("vo/vo" + pageNum + ".mp3", true);
      _root.myVO.onSoundComplete = function(char){
      _root.attachMovie("indicator", "indicator", _global.curLevel++);
      _root.indicator.clickIndicator_btn.onRelease = function(){
        • 1. Re: how to pass variable in a function
          derobinson Level 1
          I don't think you can pass variables into the onSoundComplete handler function. But you don't really need to as you've written the code. You're passing it into the playVO function so it should be availble to the onComplete handler (which you've written inside playVO) without having to restate it. As long as you pass it in when calling playVO (e.g. playVO(myVar);)

          Hope that helps!