识别在闪光灯元件上的鼠标单击

recognize mouse click over a flash element

本文关键字:鼠标 单击 闪光灯 识别      更新时间:2023-09-26

这是一个真正的虽然。

我已经编写了这个 javascript 来连接 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外部接口发送它改变了我的方法。我用了

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

它有效。