You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by derChris <ch...@goal-games.de> on 2013/09/09 12:51:16 UTC

Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Hi,

 I have problems getting an Event when the "Enter" - Button on a softKeyboar
is clicked on iOs (iPod Touch 5G).

The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...

The only Event I get "sometimes" is the Event.CHANGE or
TextOperationEvent.CHANGE...

But is there a way to get a better Event when I want to close the
SoftKeyboard when enter is pressed (without displaying a lineBreak or remove
the lineBreak manually)...???

Thanks in advanvce...

Christian 



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
... but this works only with empty textInput and pressing return...

if the textInput has text you need to click 2 times the return button...

... WHY???





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2780.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
Actually the best way I found is the following:

package XYZ
{
	import flash.events.Event;
	import flash.events.FocusEvent;
	import flash.events.TextEvent;

	import mx.events.FlexEvent;

	import spark.components.TextArea;

	public class TextAreaClosingSoftKeyboardOnEnter extends TextArea
	{
		public function TextAreaClosingSoftKeyboardOnEnter()
		{
			super();
			addEventListener(TextEvent.TEXT_INPUT, handleChange);
                        // This is for clicking somewhere outside the
TextArea
			addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, handleMouseFocusChanged);
		}

		private function handleChange(event:Event):void
		{
			if(text.indexOf("\r") != -1 || text.indexOf("\n") != -1)
			{
				text = text.replace(/[\r\n]/g, "");
				closeSoftKeyboard();
				event.preventDefault();
				return;
			}
		}

		private function closeSoftKeyboard():void
		{
			stage.focus = null;
		}

		protected function handleMouseFocusChanged(event:FocusEvent):void
		{
			if(!event || !stage)
			{
				return;
			}
			if(!(event.relatedObject is TextArea))
			{
				closeSoftKeyboard();
			}
		}

		public function dispose():void
		{
			removeEventListener(Event.CHANGE, handleChange);
                        removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE,
handleMouseFocusChanged);
		}

	}

}




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2692.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by Alex Harui <ah...@adobe.com>.
TextArea has two skins.  The default uses stageText and may be partly
responsible for this problem you are facing.  The other uses a textfield
and supports multiple lines, but the softkeyboard may look a little
different.  It should, though, give you better control over the text.

On 9/12/13 12:28 AM, "derChris" <ch...@goal-games.de> wrote:

>I can' use the TextInput as I need multiple lines. I just don't wont no
>explicit line breaks by the user. And I want to close the SoftKeyboard
>when
>"enter" on the SoftKeyboard is pressed...
>
>Christian
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event
>-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2686.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
I can' use the TextInput as I need multiple lines. I just don't wont no
explicit line breaks by the user. And I want to close the SoftKeyboard when
"enter" on the SoftKeyboard is pressed...

Christian



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2686.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by Alex Harui <ah...@adobe.com>.
Do you have to use TextAreaSkin?  Can you use the skin that uses TextField
instead?

On 9/11/13 3:06 AM, "derChris" <ch...@goal-games.de> wrote:

>See
>http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9
>a274c00-8000.html
>
>derChris wrote
>> "When the user interacts with the default soft keyboard for the
>>TextInput
>> and TextArea controls, the keyUp and keyDown events are dispatched only
>> for a small subset of keys. To capture individual keypresses for all
>>keys,
>> use the change event."
>
>The strange thing on this is that the "return" / "line break" is only
>recognized in combination with chars... when I hit the enter a few times I
>also don't get the change event...
>
>Christian
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event
>-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2667.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
See
http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9a274c00-8000.html

derChris wrote
> "When the user interacts with the default soft keyboard for the TextInput
> and TextArea controls, the keyUp and keyDown events are dispatched only
> for a small subset of keys. To capture individual keypresses for all keys,
> use the change event."

The strange thing on this is that the "return" / "line break" is only
recognized in combination with chars... when I hit the enter a few times I
also don't get the change event...

Christian



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2667.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
I think I also tried that... today I can't test it as I don't have the device
but at night I'll test it ...

But I am almost sure it also doesn't work...

Christian



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2666.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by Stephen C <st...@stephenjc.com>.
have you tried listening for all keyboard events on the stage?

stage.addEventListener(KeyboardEvent.KEY_DOWN, e.CallBack);

Thank You,
Stephen C
-All of my email addresses go to the same place
-Save Paper, think before you print
-PGP Public Key<https://docs.google.com/file/d/0B0JeFeQj5XjkZC0talFuRExyc0E/edit?usp=sharing>


On Tue, Sep 10, 2013 at 4:52 AM, derChris <ch...@goal-games.de>wrote:

> That would fit - but it don't work... (as "KeyboardEvent" also don't
> work and the text-Events - change - sometimes don't work for the
> "Enter"-Key)...
>
> Maybe all of this is a result that "spark.skins.mobile.TextAreaSkin" is
> using StageText...
>
> But SOMETHING has to work...or not...???
>
> Christian
>
>
> Am 09.09.2013 17:43, schrieb Lee Burrows [via Apache Flex Users]:
> > Not sure if it fits your requirements but have you tried listening for
> > FlexEvent.ENTER instead?
> >
> > On 09/09/2013 11:51, derChris wrote:
> >
> > > Hi,
> > >
> > >   I have problems getting an Event when the "Enter" - Button on a
> > softKeyboar
> > > is clicked on iOs (iPod Touch 5G).
> > >
> > > The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...
> > >
> > > The only Event I get "sometimes" is the Event.CHANGE or
> > > TextOperationEvent.CHANGE...
> > >
> > > But is there a way to get a better Event when I want to close the
> > > SoftKeyboard when enter is pressed (without displaying a lineBreak
> > or remove
> > > the lineBreak manually)...???
> > >
> > > Thanks in advanvce...
> > >
> > > Christian
> > >
> > >
> > >
> > > --
> > > View this message in context:
> >
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
> > > Sent from the Apache Flex Users mailing list archive at Nabble.com.
> > >
> >
> >
> > --
> > Lee Burrows
> > ActionScripter
> >
> >
> >
> > ------------------------------------------------------------------------
> > If you reply to this email, your message will be added to the
> > discussion below:
> >
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2643.html
> >
> > To unsubscribe from Getting "Enter"-Clicked event / Flex Mobile / iOs
> > / spark.skins.mobile.TextAreaSkin, click here
> > <
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2618&code=Y2hyaXN0aWFuLmtpZWZlckBnb2FsLWdhbWVzLmRlfDI2MTh8LTg0MTkyNDg0NQ==
> >.
> > NAML
> > <
> http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
>
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2657.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
That would fit - but it don't work... (as "KeyboardEvent" also don't 
work and the text-Events - change - sometimes don't work for the 
"Enter"-Key)...

Maybe all of this is a result that "spark.skins.mobile.TextAreaSkin" is 
using StageText...

But SOMETHING has to work...or not...???

Christian


Am 09.09.2013 17:43, schrieb Lee Burrows [via Apache Flex Users]:
> Not sure if it fits your requirements but have you tried listening for
> FlexEvent.ENTER instead?
>
> On 09/09/2013 11:51, derChris wrote:
>
> > Hi,
> >
> >   I have problems getting an Event when the "Enter" - Button on a 
> softKeyboar
> > is clicked on iOs (iPod Touch 5G).
> >
> > The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...
> >
> > The only Event I get "sometimes" is the Event.CHANGE or
> > TextOperationEvent.CHANGE...
> >
> > But is there a way to get a better Event when I want to close the
> > SoftKeyboard when enter is pressed (without displaying a lineBreak 
> or remove
> > the lineBreak manually)...???
> >
> > Thanks in advanvce...
> >
> > Christian
> >
> >
> >
> > --
> > View this message in context: 
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
> > Sent from the Apache Flex Users mailing list archive at Nabble.com.
> >
>
>
> -- 
> Lee Burrows
> ActionScripter
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2643.html 
>
> To unsubscribe from Getting "Enter"-Clicked event / Flex Mobile / iOs 
> / spark.skins.mobile.TextAreaSkin, click here 
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2618&code=Y2hyaXN0aWFuLmtpZWZlckBnb2FsLWdhbWVzLmRlfDI2MTh8LTg0MTkyNDg0NQ==>.
> NAML 
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2657.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by Lee Burrows <su...@leeburrows.com>.
Not sure if it fits your requirements but have you tried listening for 
FlexEvent.ENTER instead?

On 09/09/2013 11:51, derChris wrote:
> Hi,
>
>   I have problems getting an Event when the "Enter" - Button on a softKeyboar
> is clicked on iOs (iPod Touch 5G).
>
> The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...
>
> The only Event I get "sometimes" is the Event.CHANGE or
> TextOperationEvent.CHANGE...
>
> But is there a way to get a better Event when I want to close the
> SoftKeyboard when enter is pressed (without displaying a lineBreak or remove
> the lineBreak manually)...???
>
> Thanks in advanvce...
>
> Christian
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>


-- 
Lee Burrows
ActionScripter


Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
... and I want to close the SoftKeyBoard when the 
"Enter-Button"/"return" is clicked...






--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2627.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by derChris <ch...@goal-games.de>.
I want multiline entry... but I don't won't explicit line breaks...

Christian

Am 09.09.2013 14:45, schrieb Maurice Amsellem [via Apache Flex Users]:
> If you don't want to allow multi-line entry,  why not using spark 
> TextInput instead ? It works exactly as you describe, and you can 
> further customize the label of the Enter key.
>
> Maurice
>
> -----Message d'origine-----
> De : derChris [mailto:[hidden email] 
> </user/SendEmail.jtp?type=node&node=2625&i=0>]
> Envoyé : lundi 9 septembre 2013 12:51
> À : [hidden email] </user/SendEmail.jtp?type=node&node=2625&i=1>
> Objet : Getting "Enter"-Clicked event / Flex Mobile / iOs / 
> spark.skins.mobile.TextAreaSkin
>
> Hi,
>
>  I have problems getting an Event when the "Enter" - Button on a 
> softKeyboar is clicked on iOs (iPod Touch 5G).
>
> The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...
>
> The only Event I get "sometimes" is the Event.CHANGE or 
> TextOperationEvent.CHANGE...
>
> But is there a way to get a better Event when I want to close the 
> SoftKeyboard when enter is pressed (without displaying a lineBreak or 
> remove the lineBreak manually)...???
>
> Thanks in advanvce...
>
> Christian
>
>
>
> -- 
> View this message in context: 
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2625.html 
>
> To unsubscribe from Getting "Enter"-Clicked event / Flex Mobile / iOs 
> / spark.skins.mobile.TextAreaSkin, click here 
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2618&code=Y2hyaXN0aWFuLmtpZWZlckBnb2FsLWdhbWVzLmRlfDI2MTh8LTg0MTkyNDg0NQ==>.
> NAML 
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618p2626.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

RE: Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Posted by Maurice Amsellem <ma...@systar.com>.
If you don't want to allow multi-line entry,  why not using spark TextInput instead ? It works exactly as you describe, and you can further customize the label of the Enter key.

Maurice 

-----Message d'origine-----
De : derChris [mailto:christian.kiefer@goal-games.de] 
Envoyé : lundi 9 septembre 2013 12:51
À : users@flex.apache.org
Objet : Getting "Enter"-Clicked event / Flex Mobile / iOs / spark.skins.mobile.TextAreaSkin

Hi,

 I have problems getting an Event when the "Enter" - Button on a softKeyboar is clicked on iOs (iPod Touch 5G).

The TextArea is using the skin "spark.skins.mobile.TextAreaSkin"...

The only Event I get "sometimes" is the Event.CHANGE or TextOperationEvent.CHANGE...

But is there a way to get a better Event when I want to close the SoftKeyboard when enter is pressed (without displaying a lineBreak or remove the lineBreak manually)...???

Thanks in advanvce...

Christian 



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Getting-Enter-Clicked-event-Flex-Mobile-iOs-spark-skins-mobile-TextAreaSkin-tp2618.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.