我想知道openlaszlo 4.9中getMCRef()。attachAudio()的等价物。之前我使用此方法将音频输入到视图以根据音频替换。但在最近的版本中,我尝试将它附加到精灵,但它不起作用。 有什么想法吗?
答案 0 :(得分:1)
此代码段应该可以帮到您,它将向您展示如何在OpenLaszlo 4.9.0中从OpenLaszlo SWF8,SWF9和SWF10运行时访问Flash麦克风和Camera对象:
<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>
&lt; when property =“$ as3”&gt;&lt;! - SWF9,SWF10 - &gt;
<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>
&LT; /时&GT;
&lt; when property =“$ as2”&gt;
<!---
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>
&LT; /时&GT;
&LT; /类&GT;
有关其属性和方法的完整详细信息,请参阅Flash麦克风和相机对象的Flash文档。此外,这不是在OpenLaszlo中访问麦克风和相机的官方方式,但我使用它们是因为并非所有属性都可以从OpenLaszlo相机和mic API获得,如果您想使用官方API,请参阅官方类文档, :
http://www.openlaszlo.org/lps4.9/docs/reference/ - “音频视频”文件夹