AdobeAIR for Android中的鼠标滚轮事件(尝试编写Adobe本机扩展)
我正试图编写一个AdobeAIR本机扩展来捕捉android上的鼠标滚轮 当我将Android作为本机应用程序进行测试时,它会出现鼠标滚轮事件 但是,当我尝试将代码打包为本机扩展时,我没有得到事件 我明白这一点 我可以在当前视图中添加一个侦听器吗 我还缺什么吗 android中的鼠标滚轮是否有鼠标滚轮扩展AdobeAIR for Android中的鼠标滚轮事件(尝试编写Adobe本机扩展),android,actionscript-3,air,mousewheel,air-native-extension,Android,Actionscript 3,Air,Mousewheel,Air Native Extension,我正试图编写一个AdobeAIR本机扩展来捕捉android上的鼠标滚轮 当我将Android作为本机应用程序进行测试时,它会出现鼠标滚轮事件 但是,当我尝试将代码打包为本机扩展时,我没有得到事件 我明白这一点 我可以在当前视图中添加一个侦听器吗 我还缺什么吗 android中的鼠标滚轮是否有鼠标滚轮扩展 public class OpenAppANE extends Activity implements FREExtension, OnTouchListener {
public class OpenAppANE extends Activity implements FREExtension, OnTouchListener {
public void startMouseEvent()
{
LinearLayout touchLayout = new LinearLayout(this);
// set layout width 30 px and height is equal to full screen
LayoutParams lp = new LayoutParams(30, LayoutParams.MATCH_PARENT);
touchLayout.setLayoutParams(lp);
// set color if you want layout visible on screen
// touchLayout.setBackgroundColor(Color.CYAN);
// set on touch listener
touchLayout.setOnTouchListener(this);
// fetch window manager object
WindowManager mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
// set layout parameter of window manager
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(30,
// width of layout 30 px
WindowManager.LayoutParams.MATCH_PARENT, // height is equal to full screen
WindowManager.LayoutParams.TYPE_PHONE, // Type Phone, These are non-application windows providing user interaction with the phone (in particular incoming calls).
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, // this window won't ever get key input focus
PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.LEFT | Gravity.TOP;
Log.i("TAG", "add View");
mWindowManager.addView(touchLayout, mParams);
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
Toast.makeText(appContext, "inside onGenericMotionEvent" , Toast.LENGTH_SHORT ).show();
}
}
有一个鼠标滚轮收听空气 我会用
stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);
侦听鼠标滚轮事件。应该行得通
所有鼠标事件都应在Android本机上运行
也可以使用“delta”
设置鼠标滚轮上每个凹口代表的行数。
检查:另外我认为解决这个问题的关键是获得持有flash播放器的视图。“当我不是作为本机应用程序进行测试时”。关于这个“不是作为本机应用程序”还是“不是作为本机扩展”?我接受它,好像它不是本机扩展(或本机应用)。。所以这可能是因为很多原因。也许你的电子包装失败了。要测试它,请创建简单的hello world电子版…或者您是否将您在电子版中创建的服务添加到您的air/android清单中?此外,我确信您正在使用FlashRuntimeExtension java lib,否则air如何与android通信。所以你必须更清楚地知道answer@Bolzano我构建了许多本机扩展。我退出了,确保它和不使用FlashRuntimeExtension不一样吗?我创建了一个测试函数来确保这个扩展正常工作?谢谢,如果你有主意的话,那就是greatok,我只是猜测一下。因为您指定的问题是,当它是本机的时候,它正在工作,但是ane不工作。没有日志。没有密码。我们怎么能知道丢失的部分呢。谢谢agin@Bolzano,我添加了我希望能有所帮助的代码