سؤال

I want to know the equivalent for getMCRef().attachAudio() in openlaszlo 4.9. Earlier i used this method to get the audio input to a view to displace based on the audio. But in the recent version i tried attaching it to the sprite but it's not working. Any ideas?

هل كانت مفيدة؟

المحلول

This code snippet should get you started, it shows you how to access the Flash Microphone and Camera object from OpenLaszlo SWF8, SWF9 and SWF10 run-time in OpenLaszlo 4.9.0:

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

<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="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>       

</when>

<when property="$as2">

 <!---
 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>

</when>

</class>

See the Flash documentation for the Flash Microphone and Camera object for full details of their properties and methods. Also, this is not the official way to access the Microphone and Camera in OpenLaszlo, but I used them because not all the properties were available from the OpenLaszlo camera and mic API, if you want to use the official API see the official class documentation at:

http://www.openlaszlo.org/lps4.9/docs/reference/ - "Audio Video" folder

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top