Chapter Recursive Approach
This chapter highlights improved programming concepts. It focuses on event-driven code and recursion in the abstract, then as used in ActionScript and as applied to the example code we have been developing. We also try a few approaches to text filtering for whitespace removal, and we face some problems of extracting data from XML. In doing so we build a graphic browser for XML- one that functions as an interactive probe into the data structure. The browser extends earlier work we did on a...
ActionScript Vvq
if this.nodeType 1 trace Element this.nodeName if this.nodeType 3 trace text this.nodeValue trace attr- gt name this.attributes name for var i 0 i lt this.childNodes.length i this.childNodes i .trace this.trace And here is something very beautiful. All that odious onLoad code, with its childNodes of childNodes of childNodes, has disappeared. In fact, except for a check of the success flag demonstrated later , the onLoad functionality has disappeared into the trace function. And this gives us...
Conclusion Bef
Using PHP, we have created a simple XML parser on the server. In doing so we went beyond the simple DOM parser and learned event-driven techniques. Our parser read in a simple XML file and generated a response. On the client side, too, we are now able to both read and write XML. We can even use the XML.sendAndLoad function, which exchanges the XML object in memory with the server. A two-way XML data exchange is functioning smoothly Both sides can receive, alter, and retransmit an XML object. We...
Conclusion Dsx
We now have a very sweet little object. All the code is on a single frame. All the graphics are on the other frame. It is completely independent. It works at any level of the object hierarchy. All the action is driven by events It is instantiated at some point in this example it starts when the movie starts, but that is certainly not necessary. This event causes the XML to be created and the load to begin. Then the load itself causes the object's display of its data or its error messages. We...
