Skip to main content
ciaoamigos1973
Inspiring
December 19, 2015
Question

StageText: FocusEvent.MOUSE_FOCUS_CHANGE not working!

  • December 19, 2015
  • 5 replies
  • 1369 views

In Android event.preventDefault () does not work with stageText and  FocusEvent.MOUSE_FOCUS_CHANGE . Prevent closing soft keyboard not working well.! Adobe air: 20.0.0.215 Flash cc Landascape Rendere mode Direct. Help meeeee

This topic has been closed for replies.

5 replies

piyushb89979246
Adobe Employee
Adobe Employee
January 4, 2016

Hi,

"flagNoExtractUI" is for Stage Text object only.

Only FocusEvent.FOCUS_IN and FocusEvent.FOCUS_OUT has been added to StageText objects. FocusEvent.MouseFocusChange will not work.

Also if you call this

private function showOut(e:FocusEvent) { 

  trace ("Out"

  trace(e.cancelable);  // It returns false

  e.preventDefault();  // e.preventDefault() does not work 

  myTextField0.assignFocus(); 

  } 

e.cancellable returns false, so you cannot prevent its default behaviour.

So to support your requirement  that preventDefault() function work for this event FocusEvent.FOCUS_OUT.

Please log an external bug and feature request in Bugbase here. Home‌.

Also we recommend anyone who is effect by this issue give it a vote and leave a comment on how it impact your work and development so that we can adjust accordingly.

ciaoamigos1973
Inspiring
January 4, 2016

FocusEvent.MouseFocusChange  was added to stageText. https://bugbase.adobe.com/index.cfm?event=bug&id=4057869 But only he works with IOS.

piyushb89979246
Adobe Employee
Adobe Employee
January 4, 2016

I have logged an internal bug for the same . Will keep you posted.

-Piyush

ciaoamigos1973
Inspiring
December 31, 2015

Can I get a response from Adobe?

MOUSE FOCUS CHANGE working on IOS and does not work with Android. You can fix?

Colin Holgate
Inspiring
December 29, 2015

Some of the things you're listening for don't occur with StageText objects. You can listen for the SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE, and then assignFocus to the other StqgeText object.

When I did StageText I worked in a different way. All of the fields the user sees when getting to the page are regular Dynamic TextFields, filled in with whatever the entry was last time. Then when a field is touched I create a StageText object, same rect as the TextField, and hide the TextField. When there is a FocusOut or a SOFT_KEYBOARD_DEACTIVATE event, I close down the StageText object and put its contents into the Dynamic TextField. There's nowhere in my code that have have to do any preventdefault.

ciaoamigos1973
Inspiring
December 29, 2015

Already tried .... does not work with the new "flagNoExtractUi"

When you click on an item textfield keyboard opens to full screen.

To prevent the keyboard in full screen, you have to click first on StageText.

Unfortunately "assignFocus ()" only works when the keyboard is closed.

ciaoamigos1973
Inspiring
December 28, 2015

Still nothing .. all on holiday?

I really need to fix it, any ideas?

ciaoamigos1973
Inspiring
December 20, 2015

NEWS????????

piyushb89979246
Adobe Employee
Adobe Employee
December 21, 2015

Can you please share your sample code @ bagri@adobe.com. Are you using some ANE in your project?

One more thing, recently AIR  (20.0.0.112) support "flagNoExtractUi" on Android in Landscape mode for Stage Text objects by using which you can disable the fullscreen input mode.

-AdobeAIR

Piyush


ciaoamigos1973
Inspiring
December 21, 2015

I am now using Stage Text objects (AIR 20.0.0.112), because supports "flagNoExtractUi".

StageText has two big problems:

1) In Android, the event "FocusEvent.MOUSE_FOCUS_CHANGE" is never called ...

2) If I use the event "FocusEvent.FOCUS_OUT" it is impossible to call preventDefault (). (Not working).

Adobe Air today has not a "text object" working as one expects.

Fields of impute are important in all apps, please correct the problem to prevent the behavior of the keyboard.

Here are two examples:

var ratioY=stage.stageHeight/480

var ratioX=stage.stageWidth/800

var ViewPortRectangle:Rectangle

var _inputNative:StageText

ViewPortRectangle=new Rectangle(Math.round(354* ratioX),  Math.round((433 * ratioY)) ,  Math.round(382 * ratioX),  Math.round(46 * ratioY));

_inputNative= new StageText();

_inputNative.stage=stage;

_inputNative.returnKeyLabel="go"

_inputNative.maxChars=130

_inputNative.fontSize =24;

_inputNative.addEventListener(Event.COMPLETE, Render);

_inputNative.viewPort =ViewPortRectangle;

function Render(e:Event):void

{

  _inputNative.removeEventListener(Event.COMPLETE, Render);

  _inputNative.addEventListener( FocusEvent.FOCUS_IN, showF )

  _inputNative.text="Insert"

}

// in stagtext

function showF(e:FocusEvent=null) {

  _inputNative.removeEventListener( FocusEvent.FOCUS_IN, showF )

  _inputNative.addEventListener(FocusEvent.FOCUS_OUT, showOut )

  if (_inputNative.text == "Insert" ) {

  _inputNative.text=""

  }

}

//out stagetext - the event is called

function showOut(e:FocusEvent) {

  trace ("Out")

  e.preventDefault();  // e.preventDefault() does not work

  _inputNative.assignFocus();

}

Second Example:

var ratioY=stage.stageHeight/480

var ratioX=stage.stageWidth/800

var ViewPortRectangle:Rectangle

var _inputNative:StageText

ViewPortRectangle=new Rectangle(Math.round(354* ratioX),  Math.round((433 * ratioY)) ,  Math.round(382 * ratioX),  Math.round(46 * ratioY));

_inputNative= new StageText();

_inputNative.stage=stage;

_inputNative.returnKeyLabel="go"

_inputNative.maxChars=130

_inputNative.fontSize =24;

_inputNative.addEventListener(Event.COMPLETE, Render);

_inputNative.viewPort =ViewPortRectangle;

function Render(e:Event):void

{

  _inputNative.removeEventListener(Event.COMPLETE, Render);

  _inputNative.addEventListener( FocusEvent.FOCUS_IN, showF )

  _inputNative.text="Insert"

}

// in stagtext

function showF(e:FocusEvent=null) {

  _inputNative.removeEventListener( FocusEvent.FOCUS_IN, showF )

  _inputNative.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, showOut )

  if (_inputNative.text == "Insert" ) {

  _inputNative.text=""

  }

}

//out stagetext - event never called

function showOut(e:FocusEvent) {

  trace ("Out")

  e.preventDefault();  // e.preventDefault() does not work

  _inputNative.assignFocus();

}@@@

@bagri@adobe.com