Sunday, 25 April 2010

Video smoothing in AS3

This is an issue I found that has made serious difficulties to developers  about video playback. If you have a video file in flv format, and it has a size that is smaller than the stage where you want to show it in, Flash pixelizes the video. This is the default behaviour of Flash when playing video. 

There's a workaround but it's a direct one, as it was in AS2.

In AS2 you would do like this:

myVideoObject.smoothing = true | false

In AS3 you have to get to the "smoothing" in other way. Like this:
 
videoLoader.getVideoPlayer(videoLoader.activeVideoPlayerIndex).smoothing = true; 
 
 Where videoLoader is the FLVPlayback component that you insert with ActionScript.