4 Replies Latest reply on Feb 10, 2011 8:45 AM by Inderjit

    Enable smoothing on VideoDisplay

    Yue_Hong Level 1

      Hi,

       

      When playback a video in Flex air application, the video looks pixel and the edges is not smooth. I have do some searching for example, but all examples are for Flex 3 with MX videodisplay, not spark videodisplay. I tried it and I get the error message "Error exist in the project: SWF Loader". I don't have SWF loader in that project.

       

      Here is my code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                             xmlns:s="library://ns.adobe.com/flex/spark"
                             xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:custom="custom.*">
          <fx:Script>
              <![CDATA[
                  import mx.controls.Alert;
                 
                  import org.osmf.events.TimeEvent;

       

                  protected function videodisplay1_completeHandler(event:TimeEvent):void
                  {
                      Alert.show("The Video Playback completed.");
                  }

       

              ]]>
          </fx:Script>
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <!--<s:VideoDisplay source="video/00_02_setup.mov" complete="videodisplay1_completeHandler(event)" right="0" left="0" top="0" bottom="0"/>-->


          <custom:SmoothVideoDisplay source="video/00_02_setup.mov" smoothing="true"/>
      </s:WindowedApplication>

       

      ------------------------------------------------------------------------------------------ ------------------

      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;
              }
             
          }
      }

       

       

      How can I solve the problem?  How can I have the good video quality playback in flex? Thanks.