As3 iPad softkeyboard keycode listen - actionscript-3

I would like to listen for user to Click the 'DONE' button to do my form submission. I am using Textfiled not StageText. Is there a way you can listen to user Click on it.
Cheers
Bill

You can listen for FlexEvent.ENTER on the TextInput - it gets fired when user closes soft keyboard by clicking 'done'
To listen for soft keyboard closing in general, add SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE listener to TextInput
See http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9a274c00-8000.html#WS19f279b149e7481c-66e67e6c13313699023-8000 for full info.

I have done couple testing, looks like keycodeEvent dose works. 'Done' is equal as 'Enter'. the code is '13'

Related

Adding a limit to how often you can press a button in as3

I'm coding a game for Android on Flash using AS3. My problem is that when I shoot a rocket or bullet at an enemy the user can repeatedly press the virtual button (on screen), this defeats the object of the game. Is there any way to limit how often a user can press this button so it can be pressed every half second or so? Many Thanks. (will provide code upon request if needed)
In the event handler that handles the button press, remove the listener.
This alone would disable the button.
Additionally, start a Timer.
Upon completion of the timer, re-add the listener for the button press, which allows pressing the button again, but only after the timer completed.

Why do I have to click the movie for my character to respond?

My movie has 3 frames, first one is the welcome screen with the play button, and after I press it and jumped to frame2 I have to click the movie for my character/player to respond and move by arrows. Same happens if I go back to frame2 from my game-over screen placed on frame3.
I use gotoAndPlay(); to navigate frames, naturally.
if it's something having to do with my code from frame2 i will post what it is required. I'd like to know why is that happening and how to fix it. THANKS!
Clicking your character gives it focus.
Only* what has focus receives keyboard events.
If you register the listener for the keyboard event on your character object, you have to click it first, before it receives those events.
However, the KeyboardEvents bubble up the display list and eventually reach the top most container which is the stage. This gives you two options:
Handle the focus yourself by assigning the object that should have focus to the stage.focus property. This is basically doing what the clicking does in your current situation.http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#focus
register your listeners at the stage
The user simply needs to click anywhere on the flash stage to add keyboard focus. Normally, a good way of achieving this is by using a start button, or something similar, for that first bit of mouse/keyboard focus.

Detecting earphone button press

I am developing a VOIP app based on the VoipChatterbox sample app project and I need to manipulate the headset button click.
I see that, during an active call, when I press the button on the earphone, I get a CallEndRequested event and I need to call NotifyCallEnded within 5 seconds.
But I need a different behavior for my app. I need to simply turn the microphone off / on (toggle behavior) when the user presses the headset button. (This requirement might seem odd, but that's what make sense in the context of my application). How can I achieve this behavior?
To summarize :
Is there any other event to understand that user has pressed the earphone button?
Is there a way to override the behavior that NotifyCallEnded should be called in five seconds when CallEndRequested event is fired?

SWFAddress, Back button

Can SWFAddress "sense" when a user has pressed the browser back button?
I know it can fire off EXTERNAL_EVENTS, but...does it do this for specific buttons?
Not really, the only awareness that swfaddress has of the user pressing the back button is that the address in the browser's location bar changes (represented by the window.location object in javascript). It detects that change by checking the window.location object on a regular interval.
When the window.location object changes, but swfaddress didn't trigger the address change, it fires an EXTERNAL_CHANGE event. This could be caused by the user typing in a new anchor into the location bar, hitting the back/forward buttons, or several other things. There's no way to do something like putting an event listener on the browser's back button.

KeyUp event of one button navigating to Enter event of other button

I have a keyUp event in button1 and EnterEvent in button2
When i press button1 and use my up arrow automatically control is navigating to Enter Event of button2 after entering into the KeyUp event of button1
Feels something fishy; Please help !!
Just to be clear, the KeyUp event doesn't refer specifically to the Up key on your keyboard. It is an event that triggers anytime you release any key. The keyboard events are KeyDown (when you push any key down), KeyPress (after KeyDown), and KeyUp (when you let go of the key). If you hold down a key, the KeyDown and KeyPress events trigger repeatedly until you let go, at which point KeyUp fires. (Note: pressing the Enter key on a control that is set as Default or pressing the Esc key on a control that is set as Cancel will NOT trigger any of the Key events for those controls.)
Also, the Enter event doesn't refer to the Enter key, it refers to anytime you enter that control, whether by clicking your mouse into it or moving to it via the keyboard.
In light of all of this, here's what looks to be happening:
You press and release the Up Arrow on your button1, triggering button1's KeyUp event. The focus then moves to button2 (because you pressed the Up arrow key, a navigation key) and triggers the Enter event of button2 (because you just entered button2).
From MSDN
"The Enter event occurs before a control actually receives the focus from a control on the same form."
sounds like its doing the right thing, when you press the up arrow focus is being switched to the next button (Button2) which is causing the Enter event to fire.