Prev | Current Page 31 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

The organization
of an XML file is known as parsing and involves placing each part of the XML file into a variable. To
parse and format the XML, we need to get into the nitty-gritty and manipulate the XML through
ActionScript. This is getting into developer territory a bit, so we have provided the code. It can be found
in the Chapter 1 folder of the book??™s code download, available on www.friendsofed.com. The file is
called RSSFormattingCode.txt. Although this is code that would normally be created by your developer,
it is interesting to have a look at it, especially if you are the kind of designer who also works with code.
25. Copy the code from the text file into your project in the Source view, above the HTTPService
line we just added, as shown in Figure 1-25. Any script that you place in the MXML goes inside
of tags.
The file with the full script can be found in Chapter1Code.rtf in the code download for this book.
In a nutshell, what this code does is take the information coming in from the feed, pull out the pieces
that it wants (specifically the title and summary), and stitch them together within a text variable,
adding some text formatting along the way.
Let??™s break it out a bit further. The entire ActionScript is contained within the tags; this
helps keep the code organized and separated from the MXML. We create an array called xmlData,
which holds all of our entries, and then create a for loop that pulls the title and summary of each post
into variables called currTitle and currSummary.


Pages:
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
mieszkania szczecin Golec uOrkiestra 3 Koraliki sypialnia Caraudio