我试图允许用户使用Slider为远程用户Camera设置亮度,对比度,色调和饱和度(这只会影响正在调整首选项的本地用户)。我在这里没有看到这样的课程:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#所以我使用下面的库来设置元素" remoteVideo" (远程摄像机)无论用户对亮度,对比度,色调和饱和度的要求如何。我收到color.brightness.remoteVideo(0,BrightnessSlider.value)的语法错误; (以及对比度,色调和饱和度),表示(此线上的多个标记.1119:通过fl.motion.adjustcolor& - 未定义属性remoteVideo访问未定义属性brightess,自定义以来明确定义RTMFP视频聊天工作\编译正常,没有下面的代码:
(原始源代码,如果有帮助,我的修改如下:https://github.com/MonaSolutions/MonaClients/blob/master/VideoPhone/src/VideoPhone.mxml)
//亮度对比色调饱和度的库
import flash.display.Sprite;
import fl.motion.AdjustColor;
import flash.filters.ColorMatrixFilter;
import fl.events.SliderEvent;
import flash.external.ExternalInterface;
//亮度对比色调饱和度的变量
private var color:AdjustColor = new AdjustColor(); //This object will hold the color properties
private var filter:ColorMatrixFilter; //Will store the modified color filter to change the video
// FIXED 函数
private function BrightnessLevel(e:Event = null):void
{
color.brightness = BrightnessSlider.value;
var mMatrix:Array = color.CalculateFinalFlatArray();
filter = new ColorMatrixFilter(mMatrix);
remoteVideo.filters = [filter];
status("Setting brightness to: " + BrightnessSlider.value + "\n");
}
private function ContrastLevel(e:Event = null):void
{
color.contrast = ContrastSlider.value;
var mMatrix:Array = color.CalculateFinalFlatArray();
filter = new ColorMatrixFilter(mMatrix);
remoteVideo.filters = [filter];
status("Setting contrast to: " + ContrastSlider.value + "\n");
}
private function HueLevel(e:Event = null):void
{
color.hue = HueSlider.value;
var mMatrix:Array = color.CalculateFinalFlatArray();
filter = new ColorMatrixFilter(mMatrix);
remoteVideo.filters = [filter];
status("Setting hue to: " + HueSlider.value + "\n");
}
private function SaturationLevel(e:Event = null):void
{
color.saturation = SaturationSlider.value;
var mMatrix:Array = color.CalculateFinalFlatArray();
filter = new ColorMatrixFilter(mMatrix);
remoteVideo.filters = [filter];
status("Setting saturation to: " + SaturationSlider.value + "\n");
}
//用于亮度对比度色调饱和度的滑块
<s:NavigatorContent label="ADJUST COLORS" enabled="{currentState != LoginNotConnected}">
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:VGroup>
<s:HGroup>
<s:Panel width="247" height="67.5" backgroundColor="0xA0A0A0"
title="Brightness">
<s:layout>
<s:VerticalLayout paddingLeft="8"/>
</s:layout>
<s:HSlider id="BrightnessSlider" width="220"
change="BrightnessLevel(event)" maximum="100" minimum="-100"
showDataTip="false" value="0"/>
</s:Panel>
<s:Panel width="247" height="67.5" backgroundColor="0xA0A0A0"
title="Contrast">
<s:layout>
<s:VerticalLayout paddingLeft="8"/>
</s:layout>
<s:HSlider id="ContrastSlider" width="220" change="ContrastLevel(event)"
maximum="100" minimum="-100" showDataTip="false" value="0"/>
</s:Panel>
</s:HGroup>
<s:HGroup>
<s:Panel width="247" height="67.5" backgroundColor="0xA0A0A0" title="Hue">
<s:layout>
<s:VerticalLayout paddingLeft="8"/>
</s:layout>
<s:HSlider id="HueSlider" width="220" change="HueLevel(event)"
maximum="180" minimum="-180" showDataTip="false" value="0"/>
</s:Panel>
<s:Panel width="247" height="67.5" backgroundColor="0xA0A0A0"
title="Saturation">
<s:layout>
<s:VerticalLayout paddingLeft="8"/>
</s:layout>
<s:HSlider id="SaturationSlider" width="220"
change="SaturationLevel(event)" maximum="100" minimum="-100"
showDataTip="false" value="0"/>
</s:Panel>
</s:HGroup>
</s:VGroup>
</s:NavigatorContent>
答案 0 :(得分:3)
根据AdjustColor的文档,每个属性(亮度,对比度,色调,饱和度)都是数字。所以这一行:
color.brightness.remoteVideo(0, BrightnessSlider.value);
正在尝试从remoteVideo
访问属性color.brightness
,这是一个数字。它告诉你,Number上没有“remoteVideo”属性。
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/motion/AdjustColor.html
编辑: 这样的事情可能会或可能不会起作用:(我没有测试过这个)
color.brightness = BrightnessSlider.value;
var mMatrix:Array = color.CalculateFinalFlatArray();
filter = new ColorMatrixFilter(mMatrix);
remoteVideo.filters = [filter];
您可以通过实例化一次并只更新其矩阵属性来避免不断创建新的过滤器。
private var color:AdjustColor = new AdjustColor(); //This object will hold the color properties
private var filter:ColorMatrixFilter = new ColorMatrixFilter(); //Will store the modified color filter to change the video
private function BrightnessLevel(e:Event = null):void
{
status("Setting brightness to: " + BrightnessSlider.value + "\n");
color.brightness = BrightnessSlider.value;
applyFilter();
}
private function ContrastLevel(e:Event = null):void
{
status("Setting contrast to: " + ContrastSlider.value + "\n");
color.contrast = ContrastSlider.value;
applyFilter();
}
private function HueLevel(e:Event = null):void
{
status("Setting hue to: " + HueSlider.value + "\n");
color.hue = HueSlider.value;
applyFilter();
}
private function SaturationLevel(e:Event = null):void
{
status("Setting saturation to: " + SaturationSlider.value + "\n");
color.saturation = SaturationSlider.value;
applyFilter();
}
private function applyFilter():void
{
filter.matrix = color.CalculateFinalFlatArray();
remoteVideo.filters = [filter];
}