Products

Products
Viewing By Entry / Main
March 12, 2008

Flash Video AS3 Class Example

Created in Flash CS3 using Actionscript 3 to emulate a Youtube type player, extra controls not included here. A .mov file was first compressed into a .flv file using the Flash CS3 Video Encoder and placed in an assets folder of the video player project. The StreamingVideoPlayer AS3 class is imported into the Flash project's action frame and a video object is instantiated as a display object. The new video player object is then added to a movie clip on stage using addChild(). The parameters for the class instantiation is a server location, the .flv file location, the video duration, and the video deminsions desired. The video is placed on the stage with player controls from the StreamingVideoPlayer class.

The StreamingVideoPlayer class is contained in a package and extends the Sprite class. The netConnection uses it's onNetStatus to first make sure a connection is made to the server before proceeding to connect to the video stream. The video stream is then added to a Video object and added as a child to the parent. The video is then played, paused, and seeked to half way through where a Play Video button is added with an event handler to call a video play function. When the video is played, a removeChild() is used to remove the button. When the video is stopped, the function to reinitialize back to start with the button again is called, allowing the user to play again.

View entire entry and code here.

Comments

There are no comments for this entry.


Copyright © 2005-2006 Clint Willard. All rights reserved.
Aura skin for Clint Willard's BlogCFC inspired by Brooks Bilson's Bolg.
All trademarks property of their owners.