all groups > flash actionscript > november 2006 >
You're in the

flash actionscript

group:

How do you do anything with XML in OO?


How do you do anything with XML in OO? Flashpuke23423
11/30/2006 11:34:38 PM
flash actionscript:
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
//what the hell am I suppose to do
//why can't this function be made synchronous without some major hack
}
Re: How do you do anything with XML in OO? LuigiL
12/1/2006 12:00:00 AM
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.


Re: How do you do anything with XML in OO? myIP
12/1/2006 3:12:11 AM
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.
AddThis Social Bookmark Button