본문 바로가기

OM

동영상 플레이어


moviePlayer.mxml====================================================================================

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="0xffffff" initialize="getMovieList.send()">
 
 <mx:Script>
  <![CDATA[
   import mx.events.VideoEvent;
   
   [Bindable]
   private var videoSource:String = "http://shallaazm.tistory.com/attachment/fk36.flv";
   
   private function playHeadUpdate(event:VideoEvent ):void{
    pgbPlayHead.label = int(video.playheadTime)+"/"+int(video.totalTime)+"초";
    pgbPlayHead.setProgress(video.playheadTime, video.totalTime);
   }
   
   private function stateChangeHandler(event:VideoEvent ):void{
    txtState.text = event.state.toUpperCase();
   }
   
   private function changeMovie():void{
    videoSource = movieListDg.selectedItem.src;
    video.play()
   }
   
   private function gotoShallaazm():void{    
   
   }
   
  ]]>
 </mx:Script>
 
 <mx:Style>
  Application{
   fontSize: 12;
  }
 </mx:Style>
 
 <mx:HTTPService id="getMovieList" url="http://shallaazm.tistory.com/attachment/fk39.xml" useProxy="false"/>
 
 <mx:Panel x="0" y="0" width="467" height="377" layout="absolute" title="moviePlayer" horizontalScrollPolicy="off" verticalScrollPolicy="off">
  <mx:VideoDisplay id="video"
   x="10" y="10" width="320" height="240"
   source="{videoSource}"
   volume="{volume.value}"
   playheadUpdateInterval="300"
   autoPlay="false"
   playheadUpdate="playHeadUpdate(event)"
   stateChange="stateChangeHandler(event)"
  />
  <mx:Label x="10" y="258" text="File Download"/>
  <mx:Label x="10" y="296" text="Play Time"/>
  <mx:ProgressBar x="111" y="258" width="219" source="video"/>
  <mx:ProgressBar id="pgbPlayHead" x="111" y="296" width="219" mode="manual" label="Ready..."/>
  <mx:Button x="338" y="10" label="Play" width="99" id="btnPlay" click="video.play()"/>
  <mx:Button x="338" y="40" label="Pause" width="99" id="btnPause" click="video.pause()"/>
  <mx:Button x="338" y="70" label="Stop" width="99" id="btnStop" click="video.stop()"/>
  <mx:DataGrid id="movieListDg" x="338" y="126" width="99" height="124" dataProvider="{getMovieList.lastResult.movieList.item}" itemClick="changeMovie()">
   <mx:columns>
    <mx:DataGridColumn headerText="List" dataField="name"/>
   </mx:columns>
  </mx:DataGrid>
  <mx:HSlider id="volume" x="338" y="100" width="99"
   minimum="0" maximum="1" value="0.8" liveDragging="true"
   toolTip="volume"
  />
  <mx:Text id="txtState" x="338" y="258" width="101"/>
  <mx:LinkButton x="338" y="283" label="linkTo" color="#ffffff" height="44" width="99" click="gotoShallaazm()"/>
 </mx:Panel>
 
</mx:Application>

=====================================================================================================

movieList.xml========================================================================================

<?xml version="1.0" encoding="utf-8"?>
<movieList>
 <item name="test_01" src="http://shallaazm.tistory.com/attachment/fk36.flv"/>
 <item name="test_02" src="http://shallaazm.tistory.com/attachment/fk37.flv"/>
 <item name="test_03" src="http://shallaazm.tistory.com/attachment/fk38.flv"/>
 <item name="test_04" src="http://shallaazm.tistory.com/attachment/gk34.flv"/>
</movieList>

=====================================================================================================

'OM' 카테고리의 다른 글

영어 학습 컨텐츠  (0) 2008.02.22
keyUtil  (0) 2008.02.09
타자게임  (0) 2008.02.09
달력을 이용한 다이어리  (0) 2008.02.08
달력  (0) 2008.02.07
D-day 구하기 2  (0) 2008.02.07
D-day 구하기 1  (0) 2008.02.05
아날로그 시계  (0) 2008.02.04
디지털 시계  (0) 2008.02.03