我想知道OpenLaszlo4.9中getMCRef().attachAudio()的等价物。之前,我使用此方法将音频输入获取到一个视图,以根据音频进行置换。但在最近的版本中,我尝试将其附加到精灵上,但它不起作用。有什么想法吗?
发布于 2012-09-26 03:03:10
这段代码应该可以让你上手了,它向你展示了如何在OpenLaszlo 4.9.0中从OpenLaszlo SWF8、SWF9和SWF10运行时访问闪光灯麦克风和摄像头对象:
<class name="mediamanager">
<when property="$as3"><!-- SWF9, SWF10 -->
<passthrough>
import flash.media.*;
</passthrough>
<!---
Gets a reference to the camera.
@returns object: reference to the camera object.
-->
<method name="getMicrophone">
return flash.media.Microphone.getMicrophone();
</method>
<method name="getNumMics">
return flash.media.Microphone.names.length;
</method>
<method name="getMicNames">
return flash.media.Microphone.names;
</method>
</when>
<when property="$as2"><!-- SWF8 -->
<!---
Gets a reference to the camera.
@returns object: reference to the camera object.
-->
<method name="getMicrophone">
return Microphone.get();
</method>
<method name="getNumMics">
return Microphone.names.length;
</method>
<method name="getMicNames">
return Microphone.names;
</method>
</when><passthrough>
import flash.media.*;
</passthrough>
<!---
Gets a reference to the camera.
@returns object: reference to the camera object.
-->
<method name="getCamera">
return flash.media.Camera.getCamera();
</method>
<method name="getNumCams">
return flash.media.Camera.names.length;
</method>
<method name="getCamNames">
return flash.media.Camera.names;
</method> <!---
Gets a reference to the camera.
@returns object: reference to the camera object.
-->
<method name="getCamera">
return Camera.get();
</method>
<method name="getNumCams">
return Camera.names.length;
</method>
<method name="getCamNames">
return Camera.names;
</method>有关Flash麦克风和Camera对象的属性和方法的完整详细信息,请参阅Flash文档。此外,这不是在OpenLaszlo中访问麦克风和摄像头的官方方式,但我使用它们是因为并非所有属性都可以从OpenLaszlo摄像头和麦克API获得,如果你想使用官方API,请参阅官方类文档,网址为:
http://www.openlaszlo.org/lps4.9/docs/reference/ -“音视频”文件夹
https://stackoverflow.com/questions/12534729
复制相似问题