Thursday, August 19, 2010

Video player(Flex)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#4E4D4D, #4E4D4D]" creationComplete="sendreques.send();" height="932" >
<mx:Script>
    <![CDATA[
        import mx.events.VideoEvent;
        import mx.rpc.events.ResultEvent;
        import mx.collections.ArrayCollection;
       
        [Bindable]
        public var arraycolle:ArrayCollection=new ArrayCollection();
       
        public function collectionvideo(evt:ResultEvent):void
        {
            arraycolle=evt.result.videolist.video;
        }
        public function selectflvfile(evt:Event):void
        {
            displayimg.source="assets/"+ evt.target.selectedItem.src;
        }
        public function playflim():void
        {
            displayimg.play();
        }
       
        public function pauseflim():void
        {
            displayimg.pause();
        }
       
     public function videoDisplay_playheadUpdate():void{
    prograssimg.setProgress(displayimg.playheadTime, displayimg.totalTime);
}
  ]]>
</mx:Script>

<mx:HTTPService id="sendreques" url="assets/vidiofile.xml" result="collectionvideo(event);"/>
   <mx:Panel x="918" y="28" width="250" height="747" layout="absolute">
   
        <mx:TileList x="25" itemClick="selectflvfile(event);" y="10" id="tileimage" dataProvider="{arraycolle}" labelField="book" width="185" height="668">
        <mx:itemRenderer>
            <mx:Component>
                <mx:Image source="{data.book}" width="150" height="150"/>
            </mx:Component>
        </mx:itemRenderer>
        </mx:TileList>
    </mx:Panel>
    <mx:Panel x="27" y="28" width="848" height="747" layout="absolute" backgroundColor="#161515">
<mx:Image source="assets/images/req7nqmi.jpg" width="807" height="705"/>
        <mx:VideoDisplay  x="179.5" y="10" width="584" height="286" id="displayimg" playheadUpdate="videoDisplay_playheadUpdate()"/>
        <mx:Panel x="107" y="624" width="563" height="73" layout="absolute" backgroundColor="#D4CECE">
            <mx:Button x="10" y="6" label="Play" fillAlphas="[1.0, 1.0, 1.0, 1.0]" fillColors="[#E0DFDF, #D5D5D5, #CACACA, #595757]" borderColor="#808181" themeColor="#868788" width="64" click="playflim();"/>
            <mx:Button x="468" y="6" label="Pause" fillAlphas="[1.0, 1.0, 1.0, 1.0]" fillColors="[#E0DFDF, #D5D5D5, #CACACA, #595757]" borderColor="#808181" themeColor="#868788" click="pauseflim();"/>
            <mx:ProgressBar x="89.75" y="16" mode="manual" label=" " id="prograssimg" width="363.5" height="13"/>
    </mx:Panel>
   
    </mx:Panel>
</mx:Application>

XML File

<?xml version="1.0" encoding="utf-8"?>
<videolist>
<video>
<src>Animal_Face_Off_Anaconda_vs._Jaguar.flv</src>
<title>Billie Jean</title>
<book>assets/images/book_1.jpg</book>
</video>
<video>
<src>Spy_vs_Spy_-_Defection.flv</src>
<title>Smooth Criminal</title>
<book>assets/images/image_po.jpg</book>
</video>
<video>
<src>flowplayer.flv</src>
<title>Dangerous</title>
<book>assets/images/image_eye.jpg</book>
</video>
<video>
<src>Spy_vs_Spy_-_Defection.flv</src>
<title>Dangerous</title>
<book>assets/images/book_1.jpg</book>
</video>
<video>   
<src>puzzle.flv</src>
<title>Dangerous</title>
<book>assets/images/book_1.jpg</book>
</video>
<video>
<src>Animal_Face_Off_Anaconda_vs._Jaguar.flv</src>
<title>Dangerous</title>
<book>assets/images/book_1.jpg</book>
</video>
</videolist>

Notes:

Your Icon images and FLV files keep in this format


           








Output:


No comments:

Post a Comment