2 Replies Latest reply on Nov 30, 2006 11:47 PM by Peter Lorent

    How do you do anything with XML in OO?

    Flashpuke23423
      I have below in my class

      myxml.onLoad = function() {
      //reference the XML text here
      //can't refence any variables in my class from this inline function, you can only access clips on the stage/root
      //what the hell am I suppose to do
      //why can't this function be made synchronous without some major hack
      }
        • 1. Re: How do you do anything with XML in OO?
          injpix Level 3
          That isn’t just a function. It’s an event handler. You need to reference your clips one wave up (its parent mc). Try adding one of the following as a prefix to what you are trying to connect to;

          this._parent
          this._parent._parent

          But you shouldn’t be having any problems accessing ‘myxml’ properties inside this event handler. Post more code.
          • 2. Re: How do you do anything with XML in OO?
            Peter Lorent Level 2
            Inside callback handlers the class members are out of scope. You can solve this in several ways. One of them is using a local reference to the class:

            var thisObj=this;
            myxml.onLoad = function() {
            thisObj.yourclassmember....

            Another one is using the Delegate Class (hit F1 in Flash and search for Delegate). And you can use the events of a class in a much more easier way by just defining methods with the same name. Just look at how you use a listener.

            Now, first of all, you can do a whole lot of things with XML in Flash. Secondly, Flash doesn't suck. But some people seem to hate books and help-files and just ventilate their frustrations on forums. Grow up.