Make a simple flv player with Flex3.0

Source: Internet
Author: User

This morning, my former high school classmate asked me to teach him to write an FLV player with Flex. Online should also have a lot of tutorials, but after dinner after lunch, feel that they write well, after all, they rarely write a tutorial on their blog, so they wrote ... If there is a mistake, please point out. Here's a simple tutorial I wrote today on my blog:

With AS2.0 to do a lot of FLV player, Flex 3.0 early and out, try to do an FLV player.  Write out with Flex3.0, I think, the product can be flex, or AIR (early Apollo). Well, not much to say, a sneak peek:
---------------------------------------------------------------------------

<?xml version= "1.0" encoding= "Utf-8"?>
<mx:application xmlns:mx= "Http://www.adobe.com/2006/mxml" layout= "Absolute" >
<mx:Script>
<! [cdata[
Import mx.events.SliderEvent; Here is the import required class, with the import keyword, there is nothing to say
Import mx.events.VideoEvent;
Customize a Playingmove () function: When a movie is played, the value of the Hslider control with the id "MY_HS" is the movie's playback time, and the maximum is the total length of the movie
Private Function Playingmove (event:videoevent): void{
My_hs.value = Flvideo.playheadtime;
My_hs.maximum=flvideo.totaltime;
}
Custom Hs_onchange () function: When the user drag the Hslider control to change its value, the movie's playhead is at its value, that is, the playback time is at its value
Private Function Hs_onchange (event:sliderevent): void{
Flvideo.playheadtime = Event.value;
}
]]>
</mx:Script>
<mx:videodisplay id= "Flvideo" playheadupdate= "Playingmove (event)" x= "y=" "width=" "343", height= "245"/>
<mx:button label= "Play" click= "flvideo.source= ' targetmovie.flv '" x= "223" y= "322"/>
<mx:hslider minimum= "0" id= "my_hs" change= "Hs_onchange" (event) "x=" 176 "y=" 302 "/>"
</mx:Application>

--------------------------------------------------------------------------
which
<mx:VideoDisplay> Tag Properties Playheadupdate= "Playingmove" indicates: When the movie is playing, perform the playingmove () function;
<mx:Button> tags within the property click= "flvideo.source= ' targetmovie.flv '" indicates that when the user clicks the button, the id "Flvideo" Videodisplay control plays the Targe tmovie.flv film.
<mx:HSlider> Properties Change= "Hs_onchange" indicates that the Hs_onchange () function is executed when the user delays the Hslider control and causes its value to change.
---------------------------------------------------------------------------
The detailed explanation is written on the above, the earnest look will understand.
If there is any wrong place, please ask the experts to guide ....
If you have any questions, you can leave a message to my blog. I will update the content every day, your message I will definitely reply.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.