Flex :: Have A Button Not Fire On Space Key If It Has Focus?
Jun 11, 2009
The behavior I'm trying to prevent is after a user clicks on a button, the button retains focus, and then if the user hits the space key, the button fires again. So I thought it could be solved either by setting the focus elsewhere, or by having the button ignore the space key. I've tried adding the following keyDown event listener on the button, but it didn't work.
private function btn_keyDown(event:KeyboardEvent):void {
// try to ignore spaces, i.e. don't click on SPACE when it has focus
if (event.keyCode == Keyboard.SPACE) {
}
}
I tried changing focus by doing the following, at the end of the function that's called when the button is clicked:
The empty space of a canvas does not fire events. My problem is I have a canvas in an application that shows a diagram consisting of different figures, but the canvas empty places do not trigger the events that I need, as the rollover. How I can make my canvas trigger events even in the empty spaces? I have set the background Color, mouseEnabled, color, border, alpha, opaqueBackground, etc, and nothing works. I'm using Flex 4, and I have to use only a mx:Canvas.
Here is the event listener registration: canDiagram.addEventListener(MouseEvent.ROLL_OVER, function(event:MouseEvent):void{if(actualCursor != null){CursorManager.setCursor(actualCursor,2,-10,-10);}},true); canDiagram.addEventListener(MouseEvent.ROLL_OUT, function(event:MouseEvent):void{CursorManager.removeAllCursors();},true);
How do I detect the enter key being pressed on my button and fire the click event handler? (For example on a TextInput field there is an 'enter' event).
I'm trying to set focus on a specific button when the app launches (or later based on certain events), so that the user can simply hit return to press the button. None of the following approaches work however.
protected function group1_creationCompleteHandler(event:FlexEvent):void { //btnBrowse.setFocus(); focusManager.setFocus(btnBrowse); }
My button doesn't have a blue focus ring around it, even though it has focus. I've got a component with a RadioButtonGroup and a Button. After a selection is made in the RadioButtonGroup, focus is switched to the Button. I added click="focusManager.setFocus(myCloseButton)" on the VBox.
After, a radioButton is selected, if the user clicks the spacebar the Button fires. So, as I understand it focus was switched to the button. But, the button doesn't get a blue focus ring surrounding it. How do I get the focus ring? I have visible="false". I turn them to visible, after some effects are finished. So, don't let that throw you.)
I have a series of editable text areas in which I want to be able to add a variable on the click of a button.
If I click the button the textarea loses focus and so I cant code which textarea I need to add the variable into. Can anyone think of a way of keeping focus on the textbox, inserting the variable and then allowing the user to carry on typing.
I've been playing around with the setFocus function trying to get this to work with no success.
Here is a snippet of my code:
public function addFirstName(myText:string):void{ myText = myText + "<<firstname>>"; } <mx:TextArea id="txt1" change="text1=txt1.text" text="{text3}" editable="true"/>
I have a game with two joysticks and I use the dispatchEvent command to send the fire button event. What would be a good way to send the number of the joystick to check who pressed the fire button. A bit dirty way would be to save just the number in root or in my main class.
I have a Flash-based SWFUpload upload button in a HTML page. I am trying to style that button. SWFUpload provides a Javascript setup interface to the Flash button's settings. I don't have Flash myself, so I have to work with the pre-compiled SWF file.
I wanted to use the currentStateChange event in my application but whatever code being called in this event was not executed so I thought may be there's something wrong with my code so I tried testing it on one of the examples in adobe live docs.So I took this example here
And all what I did is placing an alert in both events currentStateChange and currentStateChanging of panel One and I didn't get the alerts when clicking on the panel.I also tried replacing the inline code with a call to a function that makes the alert also nothing happened.
So I had a requirement to add an undo function to my app and I discovered this nifty ChangeWatcher class, but it's not doing exactly what I want and I'm hoping someone knows how.ChangeWatcher seems to monitor assignments to the variable reference. So when I say:
myXML = <xml/>
it fires off it's function just fine and dandy, but when I say: myXML.appendChild(thisOtherXMLVar)
I get nothing, even though the variable changes the reference doesn't so ChangeWatcher doesn't fire off the function.how to get ChangeWatcher to pick up on all changes to a variable?
I'm an experienced AS developer, but this is something very basic about flex that I can't figure out. In the class below, I'm not sure why the function imageLoaded would not be executed when the image loads a url. Is there a race condition happening here? The application is completely loaded by the time this object is created and setPicture is called. How can I get the Event.COMPLETE event to fire properly in this case?The line and Log.info functions are conveniences for me, and they definitely work. Here's my MXML definition:
I am looking for an event which is fired (if any) after a chart is rendered (visible in UI) in Flash, we are using Flex SDK 3.0. We have to capture the screenshot after the chart is rendered, current implementation adds a huge delay in update_complete event callback, this is slowing down the whole job of generating images. I tried to use EXIT_FRAME event, but this doesn't seem to serve the purpose.
What's happening is that the user fills out a form in the HTML Viewer, then when they click the submit button I want to be notified of the page change.
If they land on URL A, then they'll be shown one message. If they land on URL B, they'll be shown another.
My problem is that I'm not sure how to make the MouseEvent.MOUSE_OVER work, to recognize that the mouse is still ON the area and so pubsBox should continue to move 10 pixels to the left every second. I understand that i have to use a Timer, but what I'm concerned about is the fact that I can't get Flex to recognize that the mouse is still OVER "wrapper" and continue firing the event.
I've got a canvas within which I have a list. The renderer for this list calls upon a "Text" field, with the "link" element of this field set to a function. The "htmlText" of the field is set dynamically to a mixture of words and links. Basically the function checks to see which tag within the htmlText has been clicked and performs an event accordingly.However, you have to click the link twice for anything to happen. Whilst debugging the code I noticed that the function referenced by the "link" element isn't actually even called until the 2nd click.
set some filters on the bitmap after it has been loaded.During development (Debug mode), everything worked and the even has been fired just fine.But now I switched to Release mode and the complete event doesn't fire anymore.To load the image, I set the source property of the image to an URL that points to a PNG image. That does still work in release mode, so the image appears correctly.It's just that the "complete" event doesn't fire, no matter what I try.
when i have this line active(the red one) it gives me automatic focus, so no clicking to be able to detect key input so i got that going for me which is nice BUT when i have it active(not commented out) i get this big yellow line which goes away when i click it(seeBelow)
I'm trying to create a fairly simple interface where the user can theoretically move up and down four vertical menu buttons with the cursor keys, selecting the option they prefer with the enter key. Obviously this requires focusing on a different button every time they move up or down, but I'm damned if I can figure out how to do this
With the Google Maps Flash API, I want to add an event listener which fires when the Marker is added to the Map using map.addOverlay(); Event.ADDED_TO_STAGE is not fired, though it seems logical. What are the alternatives?
The entire box at the top is a Flex application. The box on the left with the list of pinball machines is a VBox. As you can see, if you try to scroll with your mousewheel, it doesnt respond. The reason this is shut off is because I found that if it's turned on, when you scroll up/down, the whole page goes with it. So if you scroll down four or five times, the application goes out of sight.I tried finding a solution to this when I programmed this last year but wasnt able to find any answers.if there's a way to make Flex grab the focus of the mousewheel and not let the browser move as well?