With the XML list of movies in hand, it's time to create a Flex application that extends the Simplemovie.mxml player with The list of movies. This upgraded Flex application was shown in Listing 7.
Listing 7. Mytube1.mxml
<?xml version= "1.0" encoding= "Utf-8"?> <mx:application xmlns:mx= "Http://www.adobe.com/2006/mxml" Absolute "creationcomplete=" Moviexmldata.send () "> <mx:httpservice method=" Get "url=" http://localhost:8080/
movies.php "id=" Moviexmldata "result=" Ongetmovies (event) "/> <mx:Script> import mx.rpc.events.ResultEvent;
Import Mx.controls.VideoDisplay;
Import mx.controls.List;
Import Mx.rpc.http.HTTPService;
Import mx.collections.ArrayCollection;
[bindable] private var movies:arraycollection = new ArrayCollection (); Public Function Ongetmovies (event:resultevent): void {var firstmovie:string = Event.result.movies.movie[0].sourc
E.tostring ();
Videoplayer.source = Firstmovie;
movies = Event.result.movies.movie;
Movielist.selectedindex = 0; Public Function onprevious (): void {if (Movielist.selectedindex = 0) Movielist.selectedindex = movies.length
-1;
else Movielist.selectedindex-= 1; Videoplayer.source = this.movieList.seLectedItem.source.toString ();
The Public Function onplay (): void {Videoplayer.source = this.movieList.selectedItem.source.toString ();
Videoplayer.play (); Public Function OnNext (): void {if (Movielist.selectedindex >= (movies.length-1)) Movielist.selectedin
Dex = 0;
else Movielist.selectedindex = 1;
Videoplayer.source = This.movieList.selectedItem.source.toString (); Public Function OnChange (): void {Videoplayer.source = This.movieList.selectedItem.source.toString ();} </MX:SCR ipt> <mx:hbox width= "100%" paddingleft= "ten" paddingtop= "a" paddingright= "ten" > <mx:VBox> <mx:vide Odisplay width= "height=" id= "Videoplayer" complete= "OnNext ()"/> <mx:hbox width= "100%" horizontalAlign= "Center" > <mx:button label= "<<" click= "onprevious ()"/> <mx:button label= "Play" click= "Onp Lay () "/> <mx:button label=" >> "click=" OnNext () "/> </mx:HBox> </mx:vbox> width= "100%" height= "<mx:list" id= "Movielist" dataprovider= "{movies}" change= "OnChange" () " labelfield= "title" ></mx:List> </mx:HBox> </mx:Application>