这确实是一个。
我已经编写了这个 javascript 来连接我的 site 中 javascript 中的操作和 flash 应用程序中的操作。 . Flash 应用程序是一个显示实时指数的栏。 但它有 4 行 。用户可以通过按下来选择要显示的行 向上或向下箭头。 我试图通过用
识别 x 和 y 来识别用户是否单击了这些按钮之一e.pageX and e.pageY
这应该可行(而且确实可行!),因为闪光灯始终位于底部(固定位置) 问题是它在 FF 中有效,但在 chrome 或 IE 中无效。
代码是
$('body').click(function(e){
var arrowWidth = 15;
var arrowHeight = 12;
x_left = $("body").width() * 0.88 - 30;
x_right = $("body").width() * 0.88;
y_down_bottom = $(window).height() -2//screen.height; //$
y_down_top = y_down_bottom - arrowHeight;
y_up_bottom = y_down_bottom - arrowHeight-2;
y_up_top = y_up_bottom - arrowHeight-4;
if (e.pageX > x_left && e.pageX < x_right ){
if (e.pageY>=y_down_top && e.pageY<=y_down_bottom ){
//pressed down
.............
}
}
编辑:
最佳答案
感谢 carnio,我改变了方法,通过 flash 外部接口(interface)发送它。 我用过
import flash.external.*; // for sending up and down arrows events to javascript
还有这个关于新闻上下事件
//update javascript
// The name of a JavaScript function to call
var callJasFunction:String = "GetBtnTicker";
//parameter
var msg:int = page;
// The return value after calling JavaScript
ExternalInterface.call(callJasFunction, msg);
而且有效。
关于javascript - 识别鼠标点击 Flash 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11122300/