Hi Alex

I'm using Flex SDK 4.5A (problem also occurs on 4.6)
The flash player is version 11.3.372.94 on windows 8 64 bit and as far as I
know IE have gone the same route as flash and rolled their own version of
the flash player inside the browser.

Metro officially supports flash sites that comply with their conditions as
set out here (
http://msdn.microsoft.com/en-us/library/ie/jj193557%28v=vs.85%29.aspx )

Microsoft's official policy on invoking the keyboard is that it must be
under the control of the user and can not be problematically invoked. The
way to invoke the keyboard is one of the following from this page (
http://msdn.microsoft.com/en-us/library/windows/apps/hh465404.aspx ) :

Accessibility properties from UI Automation (UIA)
User tap
Focus changes

from their docs : *UI Automation is the mechanism through which developers
communicate whether or not a particular UI element can receive text input.
You must ensure that the appropriate accessibility properties are set in
your apps so that the touch keyboard will know to appear when focus lands
on a specific UI element.*
*
*
Their own windows provided controls do this automatically otherwise inside
of your html you need to add the following:
<div contentEditable="true" role="textbox">

So  that's how it works in html. I haven't found any documentation of help
on forums explaining how they decide when to bring up the keyboard in a
flash situation.

As you suggested I made an AS only site to see what works and what doesn't.
a normal sprite doesn't invoke the keyboard, neither does a sprite with a
mouse click listener. A normal textField doesn't invoke the keyboard but a
textfield with type set to TextFieldType.INPUT does invoke the keyboard
(which makes sense)

So somehow microsoft (I'm guessing) are inside of flash detecting what kind
of component recieved focus and if it's a editable textfield then it does
bring up the keyboard.

The intriguing thing is that for some reason when a spark textInput /
RichEditableText is set to displayAsPassword = true it DOES bring up the
keyboard so perhaps somewhere in the framework setting that flag causes the
component to somehow be perceived as a input component which quite strange
to me since I can't see why setting that condition would make any
difference.

Here's my test code:


package
{
import flash.display.Graphics;
import flash.display.Sprite;
 import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
 import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
 import flash.text.TextFieldType;
 public class CleanAsProject extends Sprite
 {
public function CleanAsProject()
{
 stage.scaleMode = StageScaleMode.NO_SCALE; //this stuff is required since
I'm working in flash builder and if you you don't put it in your graphics
scale is whack
 stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.HIGH;
 init();
}
 private function init():void
{
drawSprite(); // Does not invoke Metro soft Keyboard
 drawSpriteWithEventHandler(); // Does not invoke Metro soft Keyboard
drawTextField(); // Does not invoke Metro soft Keyboard
 drawInputTextField(); // successfully invokes Metro soft Keyboard
}
 private function drawTextField():void
{
var textField:TextField = new TextField;
 addChild(textField);
textField.x  = 100;
textField.y = 300;
 textField.height = 50;
textField.text = 'click me';
}
 private function drawInputTextField():void
{
 var textField:TextField = new TextField;
addChild(textField);
textField.x  = 100;
 textField.y = 350;
textField.height = 50;
textField.text = 'input text into me';
 textField.type = TextFieldType.INPUT;
textField.background = true;
}
 private function drawSpriteWithEventHandler():void
{
 var textInputEH:Sprite = new Sprite();
textInputEH.x  = 100;
 textInputEH.y = 200;
var g:Graphics = textInputEH.graphics;
g.beginFill(0x44ff00, 1);
 g.drawRect(0,0,200,80);
g.endFill();
addChild(textInputEH);
 textInputEH.buttonMode = true;
textInputEH.addEventListener(MouseEvent.CLICK, function
(event:MouseEvent):void
 {
trace(event.currentTarget);
} );
 }
  private function drawSprite():void
{
var textInput:Sprite = new Sprite();
 textInput.x  = 100;
textInput.y = 100;
var g:Graphics = textInput.graphics;
 g.beginFill(0xff9900, 1);
g.drawRect(0,0,200,80);
g.endFill();
 addChild(textInput);
}
 }
}


On 19 September 2012 07:59, Alex Harui <aha...@adobe.com> wrote:

> **
>
>
> I would break it down to an AS-only test where you set focus to a Sprite
> and see if you get the keyboard.
>
> Which version of player are you using?  Is metro officially supported?
>
>
>
> On 9/18/12 1:11 PM, "Wouter Schreuders" <wschreud...@gmail.com> wrote:
>
>
>
>
>
>
> Hi Alex
>
> The problem occurs with the spark RichEditableText therefore
> also textInput (not for MX:textInput). I set up a little test inside of
> windows 8 metro where traced out all the events for both a normal textInput
> and a textInput with displayAsPassword="true" and they are firing identical
> events. The one with displayAsPassword="true" invokes the keyboard
> perfectly everytime. I've also extended the RichEditableText class and
> overwritten some of the methods that are dependant on the displayAsPassword
> flag to see if that makes any difference but no luck.
>
>
> On 18 September 2012 21:50, Alex Harui <aha...@adobe.com> wrote:
>
>
>
>
>
>
> Spark or MX?  If Spark, then maybe they can’t handle non-TextFields
> getting focus?
>
>
>
>
> On 9/17/12 8:33 AM, "Wouter Schreuders" <wschreud...@gmail.com <
> http://wschreud...@gmail.com> > wrote:
>
>
>
>
>
>
> Hi All
>
> I'm busy testing our application in the windows 8 store app browser and
> I've noticed that the keyboard automatically appears when you click on a
> flash text input but not when you click on a flex text input. I'm guessing
> that MS are doing some kind of event detection which invokes the onscreen
> keyboard but that they didn't do the same thing for flex text inputs. I've
> also checked it seems that one cannot invoke the keyboard manually with
> javascript.
>
> Has anyone run into this problem before and found a solution? I've also
> noticed that it DOES bring up the keyboard if you have set
> displayAsPassword="true" for some reason.
>
> Has anyone got any idea why this is happening and how I can work
> around/solve it?
>
> Thanks
>
> Wouter
>
>
>
>
>
>
> --
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
>
>  
>

Reply via email to