我想知道这是否可行,如果是的话可能还有一些代码示例。我想让演示者在现场地址时能够在他离开时按下按钮。然后,此按钮将在客户端触发jpg或某种形象,表示他目前正在离开并且还要让演示者的麦克风静音?任何人都有任何想法如何在FMIS 4和AS3中实现这一点?
答案 0 :(得分:0)
是的,这是可行的。有一些代码要编写。这是一个细分:
<强> [编辑] 强>
添加一些代码以阐明如何使用NetStream.send()
:
演示者代码:
private function onAwayButtonClick(event:Event):void
{
stream.send("toggleAwayImageDisplay"); // stream is a NetStream you created elsewhere
mic.gain = 0; // mic is the Microphone you attached to the stream
}
订阅者代码
创建NetStream时,使用client属性,以便它知道在哪里找到我们上面指定的函数“toggleAwayImageDisplay”:
private function someMethodThatCreatesNetStream(netConnection:NetConnection):void
{
stream = new NetStream(netConnection);
// you could use any object here, as long as it has the method(s) you are calling
stream.client = this;
// this might be nicer, you can reference functions from any class this way
// the key in this client object is a function name
// the value is a reference to the function
// var client:Object =
// { toggleAwayImageDisplay: toggleAwayImageDisplay,
// doSomethingElse: anotherObject.doSomethingElse };
// stream.client = client;
// be careful about memory leaks though :)
}
private function toggleAwayImageDisplay():void
{
// now show or hide the image
}