3 Replies Latest reply on Aug 10, 2008 1:12 PM by octagonatron

    Help me understand a basic principle of scripting

    octagonatron Level 1
      So basically right now im defining functions i need to use across the application outside of functions, example:
      ------------------------------------------------------------------------------------------ ------------------
      var urlReq:URLRequest= new URLRequest("music.mp3");
      var s:Sound= new Sound();

      private function initApp():void
      {
      s.addEventListener(Event.ID3, onID3InfoReceived);
      s.load(urlReq);
      }
      ----------------------------------------------------------------------------------------- -------------------

      however this seems sloppy to me and i get warnings from Flex, I need to use these vars in other functions in the application but if i define them within a function then i cannot access them again, can someone please show me the ideal way of handling this problem?