READ  

Craig Swann & Gregg Caines: XML in Flash

04.11.2002

[47] The XML object has a simple property called status that returns another number matching a corresponding error code if an error did occur. In the "XML.status" section of Appendix A, "The XML Object", we'll go into more detail on the subject of error codes. For now, however, it's enough to know that you want a value of 0 for your status, otherwise something has gone wrong. To see the status property for the loaded document, add the following line before the call to toString():

output += "The status is "+this.status+"\n";

[59] In Flash ActionScript, as well as other object-oriented programming languages, overriding an object prototype is a powerful way to define methods that are accessible to all instances of that particular object prototype. For instance, you could create a custom method that flips the horizontal alignment of any movieClip object. To do this, you would write the following code:

movieClip.prototype.flipX() = function{this._xscale *= -1;}

This line of code now makes the flipX() method available to all movieClip objects in the movie - whether they already exist or not. You can now simply access this method by using the following code:

myMovieClip.flipX();

 

READ