视频网站的制作例子四
Jun 13, 2016 am 09:58 AM
create
list
the
time
with
xml
例子
製作
網
影片
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 is shown in Listing 7.
Listing 7. mytube1.mxml
<?xml version="1.0" encoding="utf-8"?> <application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete="movieXmlData.send()"> <httpservice method="get" url="http://localhost:8080/movies.php" id="movieXmlData" result="onGetMovies( event )"></httpservice> <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].source.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(); } public function onPlay() : void { videoPlayer.source = this.movieList.selectedItem.source.toString(); videoPlayer.play(); } public function onNext() : void { if ( movieList.selectedIndex >= ( movies.length - 1 ) ) movieList.selectedIndex = 0; else movieList.selectedIndex += 1; videoPlayer.source = this.movieList.selectedItem.source.toString(); } public function onChange() : void { videoPlayer.source = this.movieList.selectedItem.source.toString(); } </script> <hbox width="100%" paddingleft="10" paddingtop="10" paddingright="10"> <vbox> <videodisplay width="400" height="300" id="videoPlayer" complete="onNext()"></videodisplay> <hbox width="100%" horizontalalign="center"> <button label="<<" click="onPrevious()"></button> <button label="Play" click="onPlay()"></button> <button label=">>" click="onNext()"></button> </hbox> </vbox> <list width="100%" height="340" id="movieList" dataprovider="{movies}" change="onChange()" labelfield="title"></list> </hbox> </application>
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章
擊敗分裂小說需要多長時間?
3 週前
By DDD
倉庫:如何復興隊友
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前
By 尊渡假赌尊渡假赌尊渡假赌
公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗?
3 週前
By 王林

熱門文章
擊敗分裂小說需要多長時間?
3 週前
By DDD
倉庫:如何復興隊友
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 週前
By 尊渡假赌尊渡假赌尊渡假赌
公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗?
3 週前
By 王林

熱門文章標籤

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)