5 Replies Latest reply on Apr 1, 2008 7:00 AM by kglad

    Global variable help

    Clockwork_Killa
      Im trying to load variables from an XML file and then use those variables to attach a video to a netStream. The problem is netStream doesnt work inside a function (at least I cant get it to) and I cant access the variables outside of the function.
      What I need is a way to either define or alter a variable inside an onLoad function and then be able to call that variable outside of the function.
      Something like this:
      quote:

      var myVariable="hello";
      onLoad=function(){
      myVariable="goodbye"
      }
      trace(myVariable);

      ^When I trace I want the output to be goodbye rather than hello

      I have tried using _root.myVariable and _global.myVariable but when I trace either I get undefined or I get the original value of the variable and not the new value.
      Any ideas?
      Thanks