Avg. Rating 3.8

Problem

The class mx.controls.VideoDisplay does not allow you to change the smoothing property of the underlying Video object.

Solution

Extend the VideoDisplay object and using the mx_internal namespace, access the Video Object and set smoothing.

Detailed explanation

The mx.controls.VideoDisplay object offers a very useful way to quickly display FLV Videos. The only problem is it does not offer you the ability to turn on smoothing.


The VideoDisplay uses a mx.controls.videoClasses.VideoPlayer (which extends flash.media.Video) scoped to the mx.core.mx_internal namespace. To access this property, Create a new class that extends VideoDiplay, use the mx_internal namespace, and create the appropriate getter and setter.

This technique could also be used to manipulate the Video.deblocking property, but I have not included this because I have found little use for it.

I am fairly new to ActionScript, and there may be a better way to do this, but this works, and all you need to do is add a SmoothVideoDisplay in place of the VideoDisplay and set the smoothing property to what you want.
package custom
{
import mx.controls.VideoDisplay;
import mx.core.mx_internal;

use namespace mx_internal;

public class SmoothVideoDisplay extends VideoDisplay
{

private var _smoothing:Boolean = false;

public function SmoothVideoDisplay()
{
super();
}

[Bindable]
public function set smoothing(val:Boolean):void{
if (val == _smoothing) return;
_smoothing = val;
videoPlayer.smoothing = _smoothing;
}

public function get smoothing():Boolean{
return _smoothing;
}

}
}
Report abuse

Related recipes