Mouse event in Adobe Air for Android (attempt to write Adobe Native Extension)

I am trying to write an internal extension for Adobe to catch a mouse wheel on an android.

Android receives the mouse wheel event when I test it as a native application.

But when I try to pack this code as my own extension, I do not receive the event.

I follow this tutorial .

Can I add a listener to the current view?

Did I miss something else?

Is there a mouse wheel extension for mouse wheel in android?

    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();
    }
}
+4
source share
1 answer

There is a MOUSE_WHEEL listener on the air.

I would just use

stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);

. .

Android Native.

'delta' , . : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:mouseWheel

0

Source: https://habr.com/ru/post/1529131/


All Articles