[英]Flash Microphone Event Resize
我最近一直在学习和学习Flash AC3,目的是为我的网站制作一个小型录音机。 我一直在使用谷歌和搜索引擎,并在这里和那里得到不同的答案,但仍然不能完全正常工作。
我遇到的问题是,Flash插件为215x50像素。 我知道除非它是215x138像素,否则Flash Player安全面板将不会自动打开。
我设计了一种解决方法,即如果调用安全性时以及打开安全性时,我将调整Flash对象的DIV大小,即使用名为ResizeFlash的javascript函数,将其大小调整为215x138,然后在用户输入选择是否允许使用麦克风。
现在,我已经花了几天的时间挠头,因为我确实获得了下面的代码,并且确实调整了DIV的大小,但没有调整DIV的大小。 我想我可能在错误的地方致电了ResizeFlash(???)。 我还不熟悉,可能在哪里出错。
我一直在重新排列代码,看是否行得通,我会得到一些时间,它的确调整为215x138,打开“安全面板”,然后调整为215x50,但是录制却无法开始,就好像我陷入了循环中。
我希望有人可以花一些时间来浏览一下这段代码,并向我展示正确的处理方式。 非常感谢你!
这是代码:
public function Main():void
{
recButton.stop();
submitButton.enabled = false; // These reset everything, maybe in wrong place??
activity.stop();
addListeners();
mic = Microphone.getMicrophone();
if (mic == null)
{
// no camera is installed
}
else if (mic.muted)
{
// user has disabled the access in security settings
mic.addEventListener(StatusEvent.STATUS, onMicStatus, false, 0, true); // listen out for their new decision
Security.showSettings('2'); // show security settings window to allow them to change security settings
}
else
{
// you have access
mic.setUseEchoSuppression(true); //... also this might be in wrong place?
// .. I would like this to always be on
}
}
private function addListeners():void
{
recButton.addEventListener(MouseEvent.MOUSE_UP, startRecording);
submitButton.addEventListener(MouseEvent.MOUSE_UP, onSend);
recorder.addEventListener(RecordingEvent.RECORDING, recording);
recorder.addEventListener(Event.COMPLETE, recordComplete);
activity.addEventListener(Event.ENTER_FRAME, updateMeter);
}
function onMicStatus(event:StatusEvent):void
{
if (event.code == "Microphone.Unmuted")
{
mic.removeEventListener(StatusEvent.STATUS, onMicStatus);
ExternalInterface.call('ResizeFlash', '215', '50'); // When the user presses allow, resize the div back to 215x50
}
}
private function startRecording(e:MouseEvent):void
{
recorder.record();
e.target.gotoAndStop(2);
recButton.removeEventListener(MouseEvent.MOUSE_UP, startRecording);
recButton.addEventListener(MouseEvent.MOUSE_UP, stopRecording);
}
private function stopRecording(e:MouseEvent):void
{
recorder.stop();
e.target.gotoAndStop(1);
recButton.removeEventListener(MouseEvent.MOUSE_UP, stopRecording);
recButton.addEventListener(MouseEvent.MOUSE_UP, startRecording);
}
我知道我里面的东西顺序错误。 我感谢任何评论。
如您所建议的那样,在麦克风的状态事件处理程序中将应用重新调整为215x50的大小可能为时过早。
只是预感,但是当用户单击Flash安全性面板中的“允许”单选按钮时,将立即调度该状态事件。 面板仍处于打开状态。 实际上,如果您将其保持打开状态并单击“允许/拒绝”之间,则每次都会将其分发...
安全面板启动后,有些事情您将无法执行。 我想知道是否使用ExternalInterface
(调整应用程序大小)是否属于这个范围。
我建议以下内容:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.