Detecting event.button of MouseEvent for non-standard buttons - firefox-addon

I allow users to record mouse combintations for my add-on. However I'm curious what happens when a 4th or 5th button is pressed? Will event.button be 3 and 4? I'm hoping it is.
function detect(e) {
console.log('button pressed = ', e.button); //e.button is 0 for left, 1 for right, 2 for middle/wheel button
}
document.addEventListener('click', detect, false);
if e.button is not 3 or 4 is there a way to get it to be?

In theory, you could get this from MouseEvent.buttons. In practice, however... Well, see the Gecko Notes section of the docs for yourself.

Related

XLForm multi level selectors

I'm working on a very old iOS project that is using XLForm. I have to support a dynamic screen flow such as this attached
As XLForms is no longer on active development, I thought of asking the question here.
I've tried using XLFormOptionsObject and using a formSegueIdentifier to fully go custom but has not been that much helpful. If anyone has experience on a similar type of implementation using XLForms, any advice is really appreciated.
Side question;
I can intercept the Screen's C selection on Screen B using formRowDescriptorValueHasChanged, but how do I then manually pass that back to Screen A to update it's value?
Screen A
- Select Option > (tap pushes to Screen B)
Screen B
- Option 1 (tap selected option 1, pops and updates screen A row value)
- Option 2 (Same as option 1)
- Grouped Options > (tap goes to screen C)
- Option 3 (Same as option 1)
...
Screen C
- Option 1 from Grouped options (tap selects option 1, pops Screen C & B to go to A and updates screen A's row value)
- Option 2 from Grouped options (same as above)
...

Xcode/Objective-C implementing a players turn toggle

I'm new to the whole VCM programming structure and more specifically to objective-c.
Right now i'm working on an iOS app that is like the game "connect 4." This Xcode project is my practice project that i've been using to play around/learn how to make iOS apps so there are several files and lots of commented out code, so Ill try my best to provide the necessary content from my project.
App State:
Right now I have a 10x10 grid of blue square/buttons. I'm still in the early stages of implementing the functionality of the game. Rather than making each square its own button, I created 10 frames and 10 buttons. Each row is a single button, which is broken up into 10 squares.
I currently have the squares change their color to red and become disabled once clicked. If I click multiple times.. the squares turn red when pressed. Heres a screenshot example run:
What Im wanting to do:
I want to build off of what I have, but not exactly sure how to keep track of which "players turn" it is. For example.. I want the first clicked square to turn red, representing player1's move. I want the second click to turn the button, say green, representing player2's move.. then the next move will be player 1's move.
I know Ill have to make sure the button is/was ENABLED and valid before switching which players turn it is.
How should I go about doing this? This is more of a general question, but I'll provide needed code snippets if necessary. Thanks!
In your .h file add an integer (variable)
int Turn = 1;
In your .m file you can do:
if(Turn == 1)
{
// Player one is playing
Turn = 2;
}
else if(Turn == 2)
{
// Player two is playing
Turn = 1;
}

iPhone Safari keyboard to say next vs go

I have a website that is optimized to work on iOS devices. But the problem is that the keyboard always says Go as user fills the form. How do I get the keyboard to say Next until the last entry on the form, where it should say Go? Or alternatively, how do I disable the Enter button entirely?
Again, this is a website. It works everywhere websites work: in browsers. Except I have having this particular problem in Safari on mobile devices.
while changing the input type gives you some control of the keyboard layout the return key label in IOS cannot be customized.
Other than changing it to say Search there are no customizations available. You can disable the functionality of the button using something like this injQuery:
$("#myForm input").live("keyup", function(evt) {
if (evt.keyCode === 13) {
$("#myForm").trigger("submit");
}
});

AS3/Air Shift focus from one text field to the next in ios

I am using Flash Pro cs6, AS3, Air3.8.. And I am using textfield for input. I am trying to make it so when the user presses "Done" it shifts to the next field. I am finding conflicting information about this on all the forums, including this one. I did search but never found a fix..
I am definitely receiving the events, and I tried adding a line that identifies the keycode, which has confirmed it is receiving keycode 13. I actually made it put the keycode into the field I want the focus to shift to successfully.. It just refuses to put focus on that field..
The code I am using is stated in the docs that it will not work in iOS.. BUT it DOES work further along on the same page of script, as well as on two other ones... I have:
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyhandler);
function keyhandler(event:KeyboardEvent){
if(event.charCode == 13)
{
stage.removeEventListener(KeyboardEvent.KEY_DOWN,keyhandler);
stage.focus = null;
stage.focus = nextTextField;
}
}
I tried that while adding the listener to the text field first, then changed it to the stage, neither work.. I tried "requestsSoftKeyboard" and several other ways I have seen posted that supposedly work in iOS, but they didn't work.. There are other functions that use the same stage.focus to null, followed by stage.focus to MyTextField and they work, but they are initiated by pressing a button on the stage, NOT a button on the soft keyboard. The code there that works is just a standard if statement:
if (TextField == "")
{
stage.focus=null;
stage.focus=TextField;
}else if (NextTextField == "")
{
stage.focus = null;
stage.focus = NextTextField;
}else if (TextFieldAfterThat == "")
{
stage.focus = null;
stage.focus = TextFieldAfterThat;
}
That continues through all fields and always goes to the right one with the soft keyboard open, cursor blinking, and ready to type.. every time. I know the listeners are received from the soft keyboard "Done" because a function to capitalize the words works, and when I added code to confirm the keycode it worked. I also have found access to that value using "charcode" AND "keycode".. I do not know what the difference is, but both returned 13 and neither worked for me..
There is another place I use the same code to make a TextField active and set the focus after the user presses a radio button, and those all work every time.
I am not sure what the difference is coming from pressing "Done" vs. pressing an object on the stage, but it refuses to set the focus with the done button.
Anyone have any ideas or made this work before?
I had success assingning focus to a StageText in iOS like this:
stageText.assignFocus();
StageText offers many advantages over TextField because it shows a native text input. The only disadvantage I know is that you can't use custom fonts.
Here's the documentation, and a tutorial.
I haven't experimented with the "Done" key, but I did what you are trying to achieve with "Enter" key and it worked. Also take note that in iOS the "Done" key is meant to hide the keyboard, so that could be why you are having these problems..
With component FPTextField you can listen to the event click DONE. In this video, compared StageText and FPTextField: http://www.youtube.com/watch?v=BKYaoLtEmCU
Use ane library FPNativeUI: http://flashpress.ru/blog/ane/native-ui/?lang=en

jQuery transition effects not working and need improvement

I am trying to build a Windows 8 Metro style page which has a bunch of unordered lists which hide and show list items every few seconds, each with different animation effects. So I am trying to build a few different types of transition effects that I can use.
If you have a look at my jsfiddle (or see below for code) you can see that I have a few effects working (fade and slide up/down) but my explode and fold effects don't work.
Why is explode and fold not working?
Update: explode and fold are now working, thanks to dsundy for pointing out my stupidity, but still hoping for some help with...
Also, although slide left/right is working, is it possible to make the new item slide in at the same time so there is not a long gap between one LI sliding left and the other sliding in from the right?
With explode and fold is it possible to make the new LI appear underneath the outgoing LI?
Any suggestions for any more interesting transistions?
$(el).hide("explode", { pieces: 4 }, 1000, function () {
$(n).show("explode", { pieces: 4 }, 1000);
});
$(el).hide("fold", { }, 1000, function () {
$(n).show("fold", { }, 1000);
});
Explode and fold aren't working because you don't have click functions for those buttons.

Resources