4

I am trying to write a Adobe air native extension to catch mouse wheel on android.

Android is getting the mouse wheel event when I am testing it as a native application.

But when I try to package that code as a native extension, I am not getting the event.

I follow this tutorial.

Could I add a listener to the current view?

Am I missing 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();
    }
}
Shvilam
  • 236
  • 4
  • 11
  • 27
  • I think that the key to solve that problem is getting the view of that hold the flash player. – Shvilam Mar 02 '14 at 19:09
  • " when I am testing it not as a native application". about this "not as a native application" or should it be "not as a native extension" ? i am accepting like it is NOT AS a native extension(or it AS a native app).. so it could be because of many reasons. maybe your ANE packaging is failing. to test it please create simple hello world ANE ...or did you add that service you have created in ane into your air/android manifest?.also i am sure you are using FlashRuntimeExtension java lib otherwise how could air communicate with android. so you have to be more clear to get an answer – Ömer Erden Mar 05 '14 at 01:06
  • @Bolzano I have build many native extension. And I quit sure that It not same thing travails as not using FlashRuntimeExtension I have created a test function to make sure that this extension is working? Thanks if you have an idea it will be great – Shvilam Mar 05 '14 at 06:27
  • ok i've just made guess . because the problem you were specified was it is working when it is native but ane is not working. there is no log. no code. how could we know the missing parts. – Ömer Erden Mar 05 '14 at 21:42
  • Thanks agin @Bolzano I have added the code I hop that Will help – Shvilam Mar 06 '14 at 10:10

1 Answers1

0

There is a MOUSE_WHEEL listener for Air.

I would just use

stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent);

to listen for mouse wheel event. should work fine.

ALL Mouse events should work on Android Native.

also use 'delta' to set the number of lines that that each notch on the mouse wheel represents. check out: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/InteractiveObject.html#event:mouseWheel also

Sean Carroll
  • 107
  • 1
  • 14