CHAPTER 13
460
The search code starts with the onSearch method, which sends a request to the YouTube search service.
The XML returned from the service is parsed in the onSearchResult method. That method sets the
dataProvider on the List object to show the thumbnails of the videos that were found.
The download starts when the user double-clicks an item in the search list. From there, the
downloadVideo method is called. This method gets the HTML page for the requested video and finds the
JavaScript portion that contains the details necessary for the PHP proxy request. This information is
parsed out in the onHTMLReturn method.
The onHTMLReturn method makes a request for the thumbnail and the video, which are both stored in the
local directory. Once the downloads are complete, the updateVideoList is called. That method looks at
the local directory to see what videos are available and updates the list of thumbnails on the right-hand
panel of the display.
When the user double-clicks a local video, the VideoDisplay object is given the URL of the local file and
playback begins.
Summary
Flash and Flex are already key components of successful Web 2.0 applications. The ability to view video,
reliably connect to services, and work across platforms even on the desktop is indispensable to Web 2.0
developers. Hopefully, this chapter has given you a taste of the kinds of things that Flex can be used for in
this context. I can’t wait to see where you take it from here.
Get AdvancED Flex 4 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.