Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 30 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
30
Dung lượng
562,21 KB
Nội dung
565 XML (DYNAMIC DATA) In this situation, another TIHHeop method can help you out. To make each title appear on its own line, append pkTIHOpnejc$% to the existing expression: pn]_a$tih@k_*behi*<pepha*pkTIHOpnejc$%%7 Swap pepha for the naha]oa@]pa attribute, as follows: pn]_a$tih@k_*behi*<naha]oa@]pa*pkTIHOpnejc$%%7 As shown in Figure 13-2, you’ll see release dates instead of titles in the Output panel. Figure 13-2. Any element’s attributes can be retrieved. What about looking at a list of the cast members? Viewing individual cast members is just as easy. Update the pn]_a$% function to look like this: pn]_a$tih@k_*behiW,Y*_]op*_d]n]_panW-Y%7 This pn]_a$% function instructs Flash to look at the first 8behi: element’s 8_]op: element, and then pull out that node’s second 8_d]n]_pan: element, which happens to be KheraKuh. For fun, and to see how easy E4X makes things for you, contrast the preceding intuitive reference with its ActionScript 2.0 equivalent: tih@k_*benop?deh`*benop?deh`*benop?deh`*_deh`Jk`aoW-Y. Which would you rather use? Moving back to the kinder, gentler world of ActionScript 3.0, update the pn]_a$% function as follows to see the whole cast of the third film: pn]_a$tih@k_*behiW.Y*_]op*_d]n]_pan%7 This time, you get elements again, complete with their tag markup, as shown in Figure 13-3. This is just like tracing tih@k_*behi earlier, where the Output panel showed 8behi: elements and their descendants. Figure 13-3. Accessing elements selects the elements themselves, as well as their children. 566 CHAPTER 13 Node types In the previous section, when you used the array access operator—tih@k_*behiW,Y*_]op* _d]n]_panW-Y—Flash gave you the immediate descendant of the 8_d]n]_pan: tag you specified, which was a text node (that is, just a string). Here, you’re looking at a list of element nodes and their text node descendants. If you want just the text nodes, you can use another TIHHeop method, `ao_aj) `]jpo$%, to retrieve what you’re after. You’ll see an example in just a bit. First, make sure you grasp the idea that when you see the expression 8_d]n]_pan:Lklaua8+_d]n]_pan:, you’re not just looking at one node; you’re looking at two. Both the tag (8_d]n]_pan:) and its content (Lklaua, in this case) comprise the element and text nodes mentioned earlier. The W3C XML recommendation actually specifies a dozen node types, but ActionScript 3.0 supports only a few of them: element, attribute, text, comment, and processing instruction. (And this is actually a relief, because knowing those few lets you easily pull out a tag’s content.) Add the `ao_aj`]jpo$% method to the end of your E4X expression to see it in action: pn]_a$tih@k_*behiW.Y*_]op*_d]n]_pan*`ao_aj`]jpo$%%7 Like attributes, text nodes don’t have any inherent formatting. To put each string on its own line, slap the pkTIHOpnejc$% method on the end: pn]_a$tih@k_*behiW.Y*_]op*_d]n]_pan*`ao_aj`]jpo$%*pkTIHOpnejc$%%7 The result is exactly the sort of thing you might use to populate a text field, as shown in Figure 13-4. Figure 13-4. Like attributes, text nodes are nothing more than strings. Remember that we are dealing with text in this example. Although the results may look rather plain, you can format and manipulate them in a number of ways, as outlined in Chapters 6 and 12. To see how the `ao_aj`]jpo$% method works, try it out at the end of the expression tih@k_*behi* _]op, like this: pn]_a$tih@k_*behiW.Y*_]op*_d]n]_pan*`ao_aj`]jpo$%%7 The result might surprise you: not just immediate descendants, but all descendants are shown (see Figure 13-5). The first child, 8_d]n]_pan:Lklaua8+_d]n]_pan:, appears at the top of the list. This includes the 8_d]n]_pan: element along with its own “offspring,” a text node. Next on display is the 567 XML (DYNAMIC DATA) first grandchild, Lklaua (the first child’s child). After that, the second child, the second child’s child (that is, the second grandchild), and so on. The list makes sense, but if you were expecting only a list of immediate children, well, now you know better. Figure 13-5. The descendants() method reveals all descendants. E4X filtering All right, we’ll give you one more illustration of E4X (we’ve saved the best for last). The lklaua*tih file included with this chapter’s Atan_eoa folder files has slightly different nqjjejcPeia attributes from those shown earlier in the chapter. Instead of a whole phrase, such as 2iej, these attributes show only numbers. Why? Because E4X allows you to evaluate comparisons, so you can filter content based on specific criteria. Let’s say you want to know which films have a running time longer than 6 minutes. Return again to our humble pn]_a$% function and update its parameter to the following: pn]_a$tih@k_*behi*$<nqjjejcPeia:2%%7 The result is a list of the 8behi: elements whose nqjjejcPeia attribute is greater than 2, along with all their children (see Figure 13-6). Figure 13-6. E4X allows filtering by way of comparison operators. 568 CHAPTER 13 The parentheses tell Flash that you’re intending to filter the returned TIHHeop instance. Inside the parentheses, the expression is a simple comparison, <nqjjejcPeia:2, which in plain English would be, “If you would be so kind, please tell us which 8behi: elements’ nqjjejcPeia attributes match this criterion.” Flash searches every 8behi: element in the bunch because nothing appears between the word behi and the dot that begins the next expression. What if you want only the title of these films? Try this: pn]_a$tih@k_*behi*$<nqjjejcPeia:2%*<pepha*pkTIHOpnejc$%%7 The trick to understanding this expression, as always, is to break it into its parts. On its own, each con- cept is usually easy enough to understand. These concepts—these subexpressions—are separated by dots. A blow-by- blow account of the preceding pn]_a$% goes like this: tih@k_*behi returns an TIHHeop instance composed of all the 8behi: elements in the tih@k_ instance. Of this list, the expression *$<nqjjejcPeia:2% filters only those 8behi: elements whose nqj) jejcPeia attribute is greater than the value 2. The subexpression *<pepha refines the results further by pulling only the pepha attribute. Finally, *pkTIHOpnejc$% invokes the TIHHeop*pkTIHOpnejc$% method to clean up the results. See the Hk]`TIH)A0TBehpanejc*bh] file in the Chapter 13 ?kilhapa folder for a working example of the preceding E4X filtering. Double dots and more True, we already said “one more illustration of E4X,” and that’s the preceding one. If you’re in a hurry to dispense with all this theory and jump head- first into a practical application, we tip our fedoras and invite you to make a beeline for the next section. But we figure at least a handful of you are wonder- ing if it’s possible to return film titles based on who appears in the cartoon. Let’s pop open a can of spinach and take a gulp. Open the Hk]`TIH)A0T>kjqoNkqj`*bh] file that accompanies this chapter, and click into frame 1 of the scripts layer. Most of the ActionScript should look familiar. The important part appears in lines 9 through 12, because it introduces three things: an operator called the descendant accessor (**), a new TIH method called l]najp$%, and the bkna]_d**ej statement: r]njk`a6TIH bkna]_d$jk`aejtih@k_**_d]n]_pan*$`ao_aj`]jpo$%99>hqpk%%w pn]_a$jk`a*l]najp$%*l]najp$%*<pepha%7 y The bkn a]_d**ej statement was introduced to ActionScript 3.0 thanks to the E4X specification. A similar ActionScript statement, bkn**ej, has been available for quite some time. You point bkn**ej at an object, and it loops through that object’s properties—however many properties there happen to be. But note that bkn**ej loops on the properties’ names, rather than the properties themselves. This can either be nifty or frustrating, depending on your needs. In contrast, the new bkna]_d**ej statement loops on an object’s actual properties, which is great for what we need in this particular endeavor. 569 XML (DYNAMIC DATA) To understand the mechanism of this E4X filtering, let’s start with a skeleton and slowly build up to the skin. Here are the bones: bkna]_d$okiaLnklanpuejokiaK^fa_p%w ++`kokiapdejc y The okiaK^fa_p in question is the hardest part of this equation, but based on what you’ve seen, it shouldn’t be impenetrable. This object is an TIHHeop instance determined by the expression tih@k_** _d]n]_pan*$`ao_aj`]jpo$%99>hqpk%. Up to this point, you would have used the longhand ver- sion to retrieve the same list. The longhand version looks like this: tih@k_*behi*_]op*_d]n]_pan*$`ao_aj`]jpo$%99>hqpk%7 This version is still as valid as ever. But the descendant accessor (the double dots) lets you skip past the intermediate nodes—behi and _]op—straight to the element you’re after. Pretty slick! Stepping through the subexpressions piece by piece, then, we get the following: tih@k_**_d]n]_pan: All 8_d]n]_pan: elements in the tih@k_ instance, no matter to which intermediate nodes they belong. *$`ao_aj`]jpo$%99>hqpk%: Of that list, a comparison of the descendants of each 8_d]n) ]_pan: element against a particular string. These descendants are text nodes that happen to represent character names, and the comparison looks for a match with the string >hqpk. The returned TIHHeop instance is the okiaK^fa_p from our skeleton. That gives us the following: r]njk`a6TIH7 bkna]_d$okiaLnklanpuejtih@k_**_d]n]_pan*$`ao_aj`]jpo$%99 ±>hqpk%%w ++`kokiapdejc y The replacement for our stand- in okiaLnklanpu is an TIH instance, stored in an arbitrarily named vari- able, jk`a. r]njk`a6TIH7 bkna]_d$jk`aejtih@k_**_d]n]_pan*$`ao_aj`]jpo$%99>hqpk%%w ++`kokiapdejc y All this means is that the bkna]_d**ej statement is going to make laps around the node list returned by the comparison expression. On each lap, it will update the value of that jk`a variable to the latest XML node it finds in that list. The jk`a variable becomes the XML object in question. It’s an XML refer- ence, which means you can work your recently acquired E4X magic on it. This is where the l]najp$% method comes into play. Remember that at this point, you’re dealing with an element node (8_d]n]_pan:) whose descendant matches the string >hqpk. As an TIH instance, the 8_d]n]_pan: node has access to the TIH*l]najp$% method, which pretty much works in the same way as the Ikrea?hel*l]najp property. The parent of 8_d]n]_pan: is 8_]op:, and the parent of 8_]op: is 8behi:. Given that point of view, the pepha attribute, referenced with the < symbol, makes sense: 570 CHAPTER 13 r]njk`a6TIH7 bkna]_d$jk`aejtih**_d]n]_pan*$`ao_aj`]jpo$%99>hqpk%%w pn]_a$jk`a*l]najp$%*l]najp$%*<pepha%7 y Namespaces In spite of everything you’ve just seen, there will come a day when you pull on your E4X wizard hat, roll up your oversized E4X wizard sleeves, wave the wand . . . and nothing happens. You won’t see anything in your TIHHeop instance. It won’t be because you’ve done anything wrong, only that you’ve omitted something: the acknowledgment of an occasionally present XML namespace. In XML, namespaces are a way to filter or label certain elements in order to control their visibility. Namespaces basically give elements a secret handshake, and you can’t see the elements unless you know it. XML documents don’t require namespaces, but many use them, including iTunes playlists, RSS feeds, and even Flash. In fact, let’s use a bit of XML content that was generated by the Commands ° Copy Motion as XML command. The Copy Motion as XML command provides a way to encode certain kinds of motion tweens into XML data, and its root element contains three namespaces. Here’s one exam- ple, which is available as ?kluIkpekj*tih in the Atan_eoa folder for this chapter: 8Ikpekj`qn]pekj9.0tihjo9bh*ikpekj*&tihjo6caki9bh]od*caki*& ±tihjo6behpano9bh]od*behpano*&: 8okqn_a: 8Okqn_abn]iaN]pa9.0t9-1,u9 ,o_]haT9-o_]haU9- ±nkp]pekj9,ahaiajpPula9ikrea_heloui^khJ]ia9Oui^kh-: 8`eiajoekjo: 8caki6Na_p]jchahabp9,pkl9,se`pd94,daecdp92,+: 8+`eiajoekjo: 8pn]jobkni]pekjLkejp: 8caki6Lkejpt9,*1u9,*1+: 8+pn]jobkni]pekjLkejp: 8+Okqn_a: 8+okqn_a: 8Gaubn]iaej`at9,psaajOuj_9pnqa+: 8+Ikpekj: In XML, namespaces are defined by tihjo attributes—in this case, in the 8Ikpekj: element. Of the three defined, two have identifiers (caki and behpano) and one doesn’t, which means it’s there but doesn’t have a name. Given what you know, and assuming the preceding XML is loaded into an TIH instance named tih@k_, you would expect to see the contents of the 8Okqn_a: element with an E4X expression like this: pn]_a$tih@k_**Okqn_a%7 The problem is that if you test that—you can use ?kluIkpekj*bh] in the Atan_eoa folder—you’ll find that the Output panel does not display anything. To get your data back, you’ll need to use the J]iaol]_a class, which is easy to do. Here’s how: 571 XML (DYNAMIC DATA) 1. In ?kluIkpekj*bh], click into frame 1 and open the Actions panel to view the full code and pn]_a$% function: r]ntih@k_6TIH9jasTIH$%7 r]nhk]`an6QNHHk]`an9jasQNHHk]`an$%7 r]nnam6QNHNamqaop9jasQNHNamqaop$?kluIkpekj*tih%7 hk]`an*hk]`$nam%7 hk]`an*]``ArajpHeopajan$Arajp*?KILHAPA(_kilhapaD]j`han%7 bqj_pekj_kilhapaD]j`han$arp6Arajp%6rke`w tih@k_9TIH$arp*p]ncap*`]p]%7 pn]_a$tih@k_**Okqn_a%7 y7 2. Enter the following new ActionScript just before the pn]_a$% function: r]njo6J]iaol]_a9jasJ]iaol]_a$bh*ikpekj*&%7 This declares a variable, jo, which is set to an instance of the J]iaol]_a class. This instance is fed the value portion of the XML document’s first ithjo attribute (bh*ikpekj*&) as a parameter. 3. At this point, that jo variable gives you a prefix you can use to unlock your data. Use the name qualifier operator (66) between the jo variable and the node it “unlocks.” r]njo6J]iaol]_a9jasJ]iaol]_a$bh*ikpekj*&%7 pn]_a$tih@k_**jo66Okqn_a%7 4. Test the movie, and your 8Okqn_a: element comes out of hiding, as shown in Figure 13-7. Figure 13-7. Using a Namespace instance can bring data back to light. If you look carefully at the results in the Output panel, you’ll see that the 8Okqn_a: element now con- tains additional attributes not in the original XML document. Those are the namespaces. Why they show up here is one of the mysteries of life. But at least you won’t be caught by surprise if you run into this sort of XML content. 572 CHAPTER 13 5. If you don’t know an tihjo attribute’s value before writing your ActionScript, you can use the TIH*j]iaol]_a$% method to grab the namespace currently in use. Replace the bh*ikpekj*& parameter you entered just a moment ago with the following: r]njo6J]iaol]_a9jasJ]iaol]_a$tih@k_*j]iaol]_a$%%7 pn]_a$tih@k_**jo66Okqn_a%7 6. Test again, and you’ll see the same Output panel content, even though ActionScript supplied the namespace information for you. Your turn: Draw shapes with XML Typically, XML documents are used to define MP3 playlists or images for a slide show. You’ll do just that sort of thing in Chapter 14. Here, to demonstrate the versatility of XML data, you will use it to draw shapes. Think of it as XML- driven alphabet soup, drawn by ActionScript. 1. Open the TIH@n]sejc*bh] file from the Atan_eoa folder for this chapter. Its partner is the `n]sejco*tih file located in the same folder, so open that in your favorite text editor. 2. In the Flash document, click frame 1 of the scripts layer and open the Actions panel to review the following partially completed ActionScript: r]ntih@k_6TIH9jasTIH$%7 r]nhk]`an6QNHHk]`an9jasQNHHk]`an$%7 r]nnam6QNHNamqaop9jasQNHNamqaop$`n]sejco*tih%7 hk]`an*hk]`$nam%7 hk]`an*]``ArajpHeopajan$Arajp*?KILHAPA(_kilhapaD]j`han%7 bqj_pekj_kilhapaD]j`han$arp6Arajp%6rke`w tih@k_9TIH$arp*p]ncap*`]p]%7 `n]sHappano$%7 y7 Everything should be familiar except for the `n]sHappano$% reference, which is a custom function you’re about to write. 3. Place your cursor at the end of the existing code, hit Enter (Return) a couple times, and then type the following new ActionScript: bqj_pekj`n]sHappano$%6rke`w r]nskn`6Olnepa9jasOlnepa$%7 ]``?deh`$skn`%7 r]nhappan?kqjp6ejp9tih@k_*happan*hajcpd$%7 r]nlkejp?kqjp6ejp7 r]ne6ejp7 r]nf6ejp7 This is the beginning of your function. The bqj_pekj keyword makes the declaration, and because this function doesn’t provide a return value, it’s typed as 6rke`. 573 XML (DYNAMIC DATA) Right off the bat, you have a number of variables. The first is a Olnepa instance, stored in a variable named skn`. Think of a sprite as a low- overhead version of a movieclip. In this case, it’s just a surface to draw on, and it has no need for a timeline of its own, which is what a Ikrea?hel instance would provide. The ]``?deh`$% method adds skn` to the main timeline’s display list, which ensures that your sprite will be visible when you start filling it with shapes. After that, you have a handful of variables used for counting: happan?kqjp is an integer (ejp) number that takes is value from the E4X expression tih@k_*happan*hajcpd$%7. So what does tih@k_*happan* hajcpd$%7 refer to? Take a look at the actual XML document, and you’ll see it right away: 8skn`: 8happan_d]n]_pan9B_khkn9,tBB,,,,: 8_kkn`ot9,u9,+: 8_kkn`ot9/,u9,+: 8_kkn`ot9/,u9-,+: 8_kkn`ot9-,u9-,+: 8_kkn`ot9-,u9.,+: 8_kkn`ot9.,u9.,+: 8_kkn`ot9.,u9/,+: 8_kkn`ot9-,u9/,+: 8_kkn`ot9-,u91,+: 8_kkn`ot9,u91,+: 8_kkn`ot9,u9,+: 8+happan: 8happan_d]n]_pan9H_khkn9,t,,BB,,: 8_kkn`ot9,u9,+: 8_kkn`ot9-,u9,+: 8_kkn`ot9-,u90,+: 8_kkn`ot9/,u90,+: 8_kkn`ot9/,u91,+: 8_kkn`ot9,u91,+: 8_kkn`ot9,u9,+: 8+happan: *** 8+skn`: The E4X reference to tih@k_*happan gives you an TIHHeop list of the 8happan: elements, and the hajcpd$% method tells you how many of those elements are contained by the root element, 8skn`:. The remaining variables in your function are also declared as ejp, but aren’t given values yet. 4. Type the following new ActionScript after the existing code: r]nhappan6Olnepa7 r]njk`a6TIH7 bkn$e9,7e8happan?kqjp7e''%w jk`a9tih@k_*happanWeY7 happan9jasOlnepa$%7 happan*cn]lde_o*hejaOpuha$-(,t,,,,,,%7 happan*cn]lde_o*^acejBehh$jk`a*<_khkn%7 574 CHAPTER 13 Here you have two more variables: happan and jk`a. The happan variable is declared as another Olnepa instance, and jk`a as another TIH instance. These variables will repeatedly update to different values, thanks to something called a bkn loop, which immediately follows. The bkn statement gives you a way to perform something more than once, and the setup occurs in three parts: The e variable is set to ,. A comparison expression will keep this loop going while the value of e is less than happan) ?kqjp, which you set in step 3. e will be incremented by - (that’s what '' does) every time the bkn loop runs another lap. So, what is this loop going to do? On every lap, it updates the jk`a variable to the E4X expression tih@k_*happanWeY. That may look new, but you’ve seen this. The only thing different is that the array access operator (WY) is being fed the value of e, rather than a hard- coded number. Once the value of jk`a is determined, the value of happan is set to a new Olnepa instance, and its cn]lde_ property is referenced. All sprites and movieclips have a cn]lde_o property, which points to an instance of the Cn]lde_o class associated with that particular sprite or movieclip. The Cn]lde_o class lets you draw things, and the last two lines configure the “pen.” First, its stroke width is set to - (very thin) and its color to ,t,,,,,, (black). Second, its fill is set to whatever color value is specified by the _khkn attribute of the current 8happan: element referenced by the jk`a variable (^acejBehh$jk`a*<_khkn%7). With the pen ready, you’re now prepared to draw. That’s where a second bkn loop comes in. 5. Type the following new ActionScript after the existing code: lkejp?kqjp9jk`a*_kkn`o*hajcpd$%7 bkn$f9,7f8lkejp?kqjp7f''%w happan*cn]lde_o*hejaPk$jk`a*_kkn`oWfY*<t(jk`a*_kkn`oWfY*<u%7 y Here, the lkejp?kqjp variable declared in step 3 is finally given a value. What value? Why, the number of 8_kkn`o: elements inside the current 8happan: element (again, as referenced by the jk`a variable). This second bkn loop runs its laps inside the first one. Basically, the bkn loop that uses e runs through the 8happan: elements, and the one that uses f runs through the 8_kkn`o: elements. All this inner loop does is invoke the hejaPk$% method as often as necessary, taking its x and y cues from the E4X expressions jk`a*_kkn`oWfY*<t and jk`a*_kkn`oWfY*<u, respectively. From right to left, you’re asking for the t (or u) attribute of the current 8_kkn`o: element of the current 8happan: ele- ment (as referenced by jk`a). In the XML document, these coordinates describe the points necessary to draw a rather blocky set of letters. 6. To complete the function, type the following ActionScript after the existing code: happan*cn]lde_o*aj`Behh$%7 happan*t9e&0,7 skn`*]``?deh`$happan%7 y skn`*t9op]ca*op]caSe`pd+.)skn`*se`pd+.7 skn`*u9op]ca*op]caDaecdp+.)skn`*daecdp+.7 y [...]... the absolute basics of XML use in Flash On the surface, it may not seem like much However, what we have presented in this chapter forms the foundationfor complex Flash projects ranging from video pickers, MP3 players, and portfolio sites, to e-commerce applications In this chapter, you have discovered the following: The relationship between an XML document and Flash CS4 How to retrieve and filter XML... the word FLASH in block letterforms, whose coordinates and fill colors were determined by an XML document, as shown in Figure 13-8 Figure 13-8 XML just provided the coordinates for some shapes 8 Close the SWF Here comes the cool part 9 Switch over to the XML document, rearrange the elements, and save the XML file For example, just for a laugh, you might want to delete all of the elements except for the... is selected for library assets, because those items are included in the movie’s first frame, in a behind-the-scenes way, even if you don’t place them there yourself (Flash does it for you automatically) This should explain to you why, when you hit certain websites, you’re slugged with an interminable wait, involving fingers drumming on the mouse or your desk and audible sighs as you wait for the movie... When he thanked Zhong Zhu for the lesson, Zhong said, “It’s really simple if you first master the process.” Mastering the creation of a Flash slide show is a lot like preparing that duck dish: it is all about process We are going to show you two ways of creating a slide show, but the process is essentially the same for both In fact, you’ll be using some of the same process for the MP3 and video players... content Flash has a potentially bad habit that drives people crazy In cases where everything in a movie is packed into the first few frames—and especially in single-frame movies—the SWF can take an awfully long time to display Why? Because Flash Player loads content one frame at a time, and when a SWF’s first frame is heavy, the rest of the movie suffers It’s even more interesting in cases where Export for. .. this: 575 CHAPTER 13 10 Close the Flash authoring environment altogether 11 Find the SWF you created just a moment ago— —and double-click it to test the movie without recompiling As shown in Figure 13-9, Flash laughs back And you just changed the content of a SWF, in a dramatic way, without changing a jot of ActionScript! 576 XML (DYNAMIC DATA) Figure 13-9 Thanks to XML, Flash has a sense of humor What... about is accomplished through the use of the class, new to ActionScript 3.0 and introduced in Flash CS3 (To be sure, ActionScript 2.0 and earlier also supported dynamic loading, but different approaches were required for different kinds of external files ActionScript 3.0 makes it more consistent, and therefore simpler.) You can use the class to load SWF files or image files (JPG, GIF, or PNG) into... loading The innards of the function are commented out for the time being, but you’ll see how they’re used soon In the function, a function tells the Output panel how many bytes have been loaded for the requested file 581 CHAPTER 14 Handling events is a bit different from what you’ve seen elsewhere in this book With movieclips and button symbols, for example, the method is referenced directly by way... so many numbers in Figure 14-1? That happens because Flash lets you simulate various modem speeds when you test downloads in the authoring environment After you launch the SWF (Control Test Movie), use the SWF’s File menu to select View Bandwidth Profiler—that opens the extra Flash Player pane—and then select View Simulate Download Doing so causes Flash to pretend the guru image is being requested from... Let’s see how you can reuse a single instance numerous times 583 CHAPTER 14 1 Open the file from the folder for this chapter Inside, you’ll see five layers in the main timeline, as shown in Figure 14-2: scripts, container (for the movieclip that holds the loaded images), text, buttons, and bg (for the background image stored in the library) Click around to get familiar with the FLA The button symbols . surface, it may not seem like much. However, what we have presented in this chapter forms the foundation for complex Flash projects ranging from video pickers, MP3 players, and portfolio sites, to. the word FLASH in block letterforms, whose coordinates and fill colors were determined by an XML document, as shown in Figure 13-8. Figure 13-8. XML just provided the coordinates for some shapes. . rearrange the 8happan: elements, and save the XML file. For example, just for a laugh, you might want to delete all of the elements except for the ones that draw A and H, and then swap them like