I'm building a simple game in which you control the character with W A S D keys. When you die, you go to another frame that says you died and has a button to play the game again. When I click the button, it goes to the frame 1 again, but the keyboard events don't work unless I click once more on the screen. How can I solve this? Thanks in advance.
On your frame1 try adding an active listiner to set the focus:
activate="this.setFocus()"
I couldn't get your question clearly. If once you click on that button it is working correctly right. If the way which i have understood is correct there might be problem on your looping or condition. please let me know your coding here, I will try to resolve. else check yourself the looping or condition on the frame1 or where you wrote your keybord event listener. I hope it will be usefull else please let me know i will give you another solution.
Related
We have a webapplication, which works fine when using the finger to touch for actions. We just got a apple pencil but that does not click the buttons or links, we can write using that in the textarea's, but any button click does not work. I tried to search for a probable solution, but could not figure our any directions. Any idea of what could be causing that will be very helpful.
One thing I was able to figure out, if I add the event onmousedown rather than onclick, all the events work, but I do not want to change the whole website code from onclick to onmousedown if there is another easier way of doing this. Thank you for any input !
I could not find a proper solution for this. But I have tried this and this seems like working find
$(window).bind('touchstart', function(e) {
e.target.click();
});
My flash file (Attached Below), has buttons that doesn't work. There are no compiling error, but my NextFrame button, PrevFrame button and HomeButton are only working if I click on the first button (There are four buttons).
If i choose the other buttons, my prevFr, NextFr, and Home button are not working. Here I attach the link to my sample file.
Thank you for everyone trying to help.
https://drive.google.com/file/d/0BxvhVI-ULexWa0dSeEc5bVFFX1k/view?usp=sharing
Hi i have been rewritten my code and applied in one frame Please check this file...I hope this one will be helpful with clear solutions....And inside this function func i have written if instead of that use else if...
Thank you..
https://drive.google.com/open?id=0B6f5z55WOf3pdXVkd1hfU21Uc3c
I want to remove focus and selection on a textfield, if the user types ESC or ENTER, or focuses somewhere else. Thus I do this:
stage.focus = null;
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
textField.mouseEnabled = false;
The problem is that, if the mouse is over the editable text field, the mouse is in IBEAM mode (caret cursor) and remains in IBEAM mode, even after the commands above, untill I slightly move the mouse, at which point it returns to the AUTO state.
I want to force the mouse to update itself and satisfy the AUTO state but no matter how much I try to make sure the textfield is disabled, it won't dissapear on its own, only after I move the mouse a bit.
Simplest answer from your comment:
So I was fidling with your suggestion and for the luls, used Mouse.hide() and then Mouse.show() and it worked. Removed the hide() and it works just with Mouse.show()! Guess it refreshes the mouse cursor. No blink, works perfectly <3
My original answer:
This is sort of a workaround but shouldn't be too difficult to implement. Hopefully someone comes along with a native API solution.
Run your code you posted
Then make cursor invisible
Then place your custom cursor at the mouse position (optional if you don't mind the cursor just disappearing)
On MouseEvent.MOUSE_MOVE remove your custom cursor, and make the cursor visible again.
I doubt you need me to write this code for you, but if you think this method would work for you, and you have a problem implementing this technique, let me know.
If you're worried about different systems having different mouse icons and then suddenly getting your custom one for a split second, the easy solution there is to just always use your custom cursor. You can design it to look exactly as you like; either mimic Windows OS or make it unique.
I basically have 50 buttons and 50 scenes. Each scene has a corresponding button that is "correct". When a user clicks the correct button, I want it to go to the next scene AND also make that button not-clickable anymore. I have everything functioning except for the not-clickable part and this is an issue because whenever i click on a state that already has been selected as the right answer, it'll jump me back to the question that was supposed to follow it. I'd show my code, but it is just 50 buttons and a buttonClick function and that's it.
Thanks in advance.
You could call
yourButton.removeEventListener(MouseEvent.CLICK,yourFunction);
or you could call
yourButton.mouseEnabled = false;
yourButton.mouseChildren = false;
Hard to help without any code.
When I click on stage outside the opened DropDownList, somehow the close event does not dispatch. How can I force it to dispatch this event after clicking anywhere outside the DropDownList?
Or Let me ask my question through another way:
Imagine we have 2 states and when clicking outside the opened DropDownList, the state 1 will change to state 2. During this process how can be sure DropDownList closed completely and close event dispatched? And if not force it to close!
P.S 1: DropDownList.closeDropDown(true); does not force it to dispatch close event too!
P.S 2: Sorry didn't share any code, I have all of them in separated classes and was hard to share them here :D But I think in total the problem is understandable. I want force my DropDownList to dispatch close event whenever I'm clicking outside it.
do a manual dropdownlist.dispatchEvent( new Event( Event.Change ) ); :D
Through the stateChangeCompleteHandler tried this:
DropDownList.dispatchEvent(new DropDownEvent(DropDownEvent.CLOSE));
P.S: TanQ #Discipol for his point