Flex :: Force Component To Redraw It's Focus?
Mar 23, 2011
Suppose I have a component and want to change it's focus color at runtime. Here's an example for you (I've excluded any buttons and such to prevent component from losing it's focus, cause in that case it changes it's color perfectly):
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script><![CDATA[
private function init():void {
[Code].....
What do I want: How to make this focus to be redrawn without magic (I've tried all the methods, starting with "validate", I've tried calling updateDisplayList() on entire application, I've tried to call styleChanged .
View 1 Replies
Similar Posts:
Jan 10, 2011
I have an app w/ a login screen. When the user hits "enter", the state changes to "login" & a child component is triggered to load (though the child stays invisible at the moment). The child contains many functions that the user needs upon logging in (ie their screenname & settings are retrieved from a database). The following is included in 'Parent':
<local:comp id="localComp" includeIn="login" includeInLayout="false" visible="false"/>
<mx:Button label="login" click="currentState='login'"/>
<mx:Button label="logout" click="currentState='Default'"/>
My problem is when a user logs out (state changes to 'Default') & then logs back in (state changes back to 'login') the child doesn't get "triggered" again & the functions w/in the child don't reload. Is there a way to force my child to refresh?
Note: While it would be easier to just move the child's functions to the parent it is complex...I moved these functions to the child to make it easier to follow
UPDATE: I even tried adding an "exitState" to my state:
<s:State name="login" exitState="removeElement(localComp)" />
This doesn't work either, as I get an error: "RangeError: Index 0 is out of range."
UPDATE: Even though you are allowed to call a child's function from a parent, my problem is that the child needs to be "created" in order to not show errors. It makes no sense to me why the flex team would make something like removing & adding children so complicated.
View 3 Replies
Jan 8, 2010
I'm using a scrollpane component. Within it I have textfields with html text links. All works OK, but I have to click a link twice in order for it to work - the first click seems to "focus" the scrollpane component and then every click afterwards works OK. What's weird is other mouseevents - i.e. rollover/rollout - are working OK without clicking.Is there anyway to force focus to the component so I don't have to click twice?
View 0 Replies
Jun 11, 2010
I have a tree control with a custom item renderer. The item renderer has different states that should be set while an item is being dragged over the item renderer. I understand from reading this post [URL] that the 'right way' to do this is to override the 'getCurrentState' method and append some text. I do that.
Now in my tree control I handle the drag over event and get a reference to the itemrenderer that is being dragged over and I set the boolean 'dragOver' property to true. Now I just need to force my itemRenderer to redraw. I can't figure that out. A workaround, is to just set the currentState of the itemRenderer.
how can I force my itemRenderer to refresh? (and I've tried calling validateNow, invalideDisplayList/Properties/Size, to no avail)
<?xml version="1.0" encoding="utf-8"?>
<s:MXTreeItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code]....
View 1 Replies
Dec 7, 2011
Is there a way to instantaneously force a redraw? I am using a Timer and I want it to update the screen between frames.
View 3 Replies
Dec 27, 2011
When the list item label is changed, the list doesn't redraw until I hover the mouse over changed item. I've tried invalidate & redraw but they didn't work:
//myList is an instance of mx.controls.List component
myList.getItemAt(0).label = 'New Label';
myList.invalidate();
myList.redraw(false);
How to force the list to redraw in this case?
View 1 Replies
Sep 1, 2011
It pulls a library item out of the library and puts it on stage programmatically. No big deal, except that in order to get the image displayed on the screen to actually update, I had to removeChild() and then addChild() it back. Is there another way to force the screen to redraw?
[Code]....
View 2 Replies
Oct 3, 2011
I am trying to write the code for making a text input control in flex. As the user enters the value in text input control and then if he removes the typed characters to make the text input blank, then I print error message via StringValidator. But I want the focus to be set on that text input only until the user enters anything. How can I achieve that?
View 2 Replies
Feb 18, 2010
I want to create a dialog or alert box, where a DisplayObject would take and force the focus, until an okay button or something releases the lock.
View 3 Replies
Nov 28, 2011
I'm currently building a Flex 4.5 mobile project including several views and custom written MXML components that can be incorporated dynamically into those views.How do I determine which component currently has focus, namely has been activated by the user tapping on it? The background for this is a global search function in the main application. Depending on the results of this search, fields in the custom components are set. Given that I don't want all components in a view to listen to the outcome of that search function, I have to check which one is currently active.I'm trying to bind the selected object (the result from the search function) to the active component.
View 1 Replies
Mar 26, 2010
I created a custom component that is a s:SkinnableContainer. I want the background and other items to fade out when this component is visible. Something similar to what happens when calling Alert.show(..) so the Alert box is in focus and everything else is faded out.
View 2 Replies
Oct 29, 2011
I have a custom TextInput that listens for the FocusEvent.FOCUS_IN and FocusEvent.FOCUS_OUT events:
textDisplay.addEventListener(FocusEvent.FOCUS_IN, onFocusInHandler);
textDisplay.addEventListener(FocusEvent.FOCUS_OUT, onFocusOutHandler);
My onFocusInHandler function basically removes a "promptview" that tells the user to type in a value, with the onFocusOutHandler doing the opposite.
For example, if the TextInput text was backspaced to a blank value and the user clicks out of the TextInput box, it would show a "Please enter a value" light-gray prompt in the TextInput.
This works fine until the user clicks our custom "Clear" button. The clear button sets the text to "", and I can tell the FocusEvent.FOCUS_OUT is received because the prompt text is set to visible (its not being set anywhere else). The problem is, the cursor remains in the box as if it still has focus, so if the user immediately starts typing, both the prompt text "Please enter a value" and the user-entered text appears over the gray text, which looks pretty ugly and unreadable.
Why does the TextInput receive the FocusEvent.FOCUS_OUT event if it's not actually losing focus?
View 1 Replies
May 21, 2010
I need to be able to make the flash player lose focus to the browser by actionscript alone (when the user clicks a button) or whatever, but from within the flash player, not from the user actually clicking outside of the flash player.These are embedded flash files with allowScriptAccess="never", so I can not use ExternalInterface at all to call browser js to window.focus or whatever.
View 0 Replies
Apr 13, 2011
I need some help forcing Flex3 to resize my TitleWindow component after an event.
My resize MXML looks like this:
<mx:Resize id="rs1" duration="1000"
heightTo="{radioVBox.y + radioVBox.height + 110}" />
How do I force it to resize after an event? I want to force the TitleWindow's height to change after the event in myFunc1 ends. private function myFunc1():void {
[Code]...
View 2 Replies
Sep 2, 2008
I am attempting to reskin the AS3 Slider component to have arelatively "tall" draggable thumb graphic. However, the sliderthumb always seems to be forcibly scaled down to 13x13 regardlessof the size of the graphic. I'm currently using the drag-and-dropcomponent on workspace method, and double-clicked the livepreviewto change the skin pieces.I've tried resizing the contents of the SliderThumb_*Skin(upSkin, downSkin, ...) symbols, the Slider component itself on thestage, and even the placeholders on the double-click skin organizersheet. The height of the thumb object is not directly accessible(seems to be private). The translated position of the 13x13 thumbrelative to the symbol center is preserved correctly... but thesize seems to be stuck at 13x13.
Is there a workaround for this? I've searched and found a fewFlex solutions having to do with overriding a measure() method orextending the class to hard-code a different height, but none ofthe corresponding classes (e.g. one site recommended extendingmx.controls.sliderClasses.SliderThumb) seem to be accessible withinthe Flash AS3 implementation of the components.
View 2 Replies
May 11, 2010
I have two columns: the left one is a Canvas containing an mx:Tree and the right one is a Canvas containing a Canvas (to allow for scrolling) of some custom Sprites that go along with the tree nodes on the left. I made the right Canvas scrollable (horizontal and vertical) and I want the vertical scroll to also scroll the left Canvas so that the tree nodes line up with their representations on the right. The scrolling portion works fine and when I embed with wmode="window" there are no problems. Unfortunately, the customer requires dynamic HTML to overlap the Flash at times and when using wmode="opaque" or "transparent", there are issues. The scrolling still works, per se, but Flash does not seem to redraw either Canvas appropriately. The Canvases become out of sync and artifacts often remain on the right side.I catch a scroll event on the right column and update the scroll position on the left column like so:
public function onTimelineScroll(scrollEvent:ScrollEvent):void {
leftColumn.verticalScrollPosition = rightColumn.verticalScrollPosition;
}
[code].....
View 1 Replies
May 11, 2010
I have a problem with redrawing in flex 4. I have a spark titleWindow, and if i drag it faster, it looks like it's mask is one frame late after the component. it's easily visible with 1pixel thin border, because it becomes invisible even with slower movement.
You can try it here (what is not my page, but it's easier to show you here than uploading example):[URL]..
If you move in direction up, you see disappearing top border. in another directions it's not that sensitive as it has wide shadow, and it's not very visible on shadow. On my computer i see it on every spark TitleWindow i have found on google, although it's much less visible with less contrast skins, without borders or with shadows.
View 2 Replies
Apr 20, 2011
I'm removing an UIComponent but parts of it last being visible. It redraws only when I move mouse around or something. I tried to do validateNow() on its parent, tried to do setTimeout(validateNow, 100) but it doesn't help. When I call it by setTimeout it seems these artifacts shown more rarely but it doesn't solve a problem in all cases. Please guide me someone to read about validateNow(), how it works and how to make these things correctly.
The code is below:
protected var bubble: SpeechBubble;
// creation
bubble = new SpeechBubble();
[Code]....
View 3 Replies
Aug 4, 2010
My flex application gets some parameters from URL when the application opens for the first time(ex: layout=<1,2,3,4> ). Based on layout(1,2,3,4) value I have to change the layout. However the problem is the application is already drawn(Layout is initialized) by the time the control reaches the point where it reads the values from the URL. I was wondering how can I redraw once I read the values from URL. Some thing like refresh.
View 1 Replies
Jul 13, 2010
I've got a small action-script chart, that's meant to be live updating, and also be able to support more than 10000 points of data. The way it's currently set up it doesn't need to redraw the whole chart if the new line we wish to add doesn't extend that chart's boundaries. Yet it does, the redraw regions show the whole chart as being redrawn as opposed to the single line i need to add. When the chart gets a new piece of data from the javascript it does the following.(some stuff has been stripped for clarity.[code] Is there any better way to do that, that won't redraw the whole screen? Is my coding pattern wrong for this type of update?
View 1 Replies
Dec 20, 2010
I'm trying to capture the redraw event for some MovieClip / Sprite objects that are in a Scroll area.Ideally, should be able to capture the event when Flash Player itself redraws the objects as can be seen with "Show Redraw Regions" in FP Debug.I've tried to use the Event.RENDER to capture this, but it even fires when the object is not visible / redrawn.
View 1 Replies
May 19, 2010
Is there a simple way to force all the child components of a Flex app to redraw when that app is resized?
For instance, I have a HDividedBox with percentHeight and percentWidth set to 100. On the left hand side of the divided box is a data grid and on the right side is a number of text inputs. The divided box is not added to the view stack until after the user logs on.
If I resize the app before the HDividedBox is added then the box takes up the full size of the app, whatever that may be. However if i resize the app after the box appears then the box retains the same dimensions it does when it was first added.
I would have expected that on the resize of the app then all the children would redraw (the application component itself appears to).
View 1 Replies
Jul 27, 2009
I am working on a selector that uses 2 list boxes. Standard stuff, you can move items from the left box with arrow buttons to the right box. However I can't seem to get the annoying green "halo" to go away whenever one of the boxes is selected. I have tried
lstbox._focusrect = false;
lstbox.enabled = false;
lstbox.setStyle("themeColor", "Sample");
Nothing seems to stop that highlight box from popping up. Funny thing is it doesn't pop up in the IDE only when I view the movie online in production.
View 1 Replies
Mar 19, 2010
Is it possible to set focus on a text input component that contains text without selecting the text? I want to be able to focus on the component and have the cursor flashing after the last letter in the field.I am currently using:myTi.setFocus();That correctly focuses myTi but it also selects all of the text currently in the field. What would I need to add to just have a cursor flashing at the end of the characters currently in myTi?
View 1 Replies
Jan 31, 2010
I have a project where a big part of the UI a notebook, where the user enters text in a number of fields, for which it uses a series of TextInput components.Once the notebook is filled in the user switches to a screen where the inputs are disabled and they compare what they wrote to a 'model answer'.The problem is that the last TextInput to have focus at the time of disabling retains it - it appears disabled (greyed out etc) but if you type the letters appear in the field.I have tried variations on Selection.setFocus(null), and it seems that Selection.getFocus() returns null/undefined, but can still type into it. I can't select any of the other textfields, and clicking on other interactive elements - bottons etc doesn't seem to want to remove focus either.
UPDATE - Just to make sure there wasn't something crazy happening particular to this project, if I make a nude flash movie with a textInput and a button, then make the button set theTextInput.enabled = false, I can still type into the field. I can't see any way that's a feature.
View 2 Replies
Feb 4, 2010
script for get Previous focus manager component.I know the script for get next focus focusmanager.getNextFocusManagerComponent();
View 0 Replies
Apr 4, 2009
I'm trying do a simple experiment here, coz I'm stuck with manage Focus because of the component.I'm trying :1. Put an Input Text to the stageYep, the focus works fine. If u click the input text>>the input text get focus, while u click the stage area outside the input text>>the input text lose focus , and so on.2. I put some component, i put a List comp.The focus just go mad, when u click the Input Text, then click stage/another object, the focus doesn't want to leave the Input text.How's that possible? There's no script totally.
View 2 Replies
Dec 5, 2010
I burnt so much time on a costume made component which extends NumericStepper.Adobe should be ashamed.. The flash component quality is poor.Now I'm at stage that all I try to do is to disable the numericStepper's focus rectangle.I haven't found a thing that works, all of the solutions I came across were Flex related.To clarify : this is a pure flash ac3 project.. no flex involved.
View 2 Replies
Mar 2, 2009
- I have two textArea components on the stage
- I need to figure out what textArea component is in focus when clicking on it
How do i make it so that it can figure out the instance name of the text area component in focus so i can preforme some code? I tried the following code but it doesn't seem to work.
[Code]....
View 3 Replies
Jun 23, 2011
I have a component "child" which has a cancel button. Now this component is placed in a state called "newChildComp" I also have another component called "parent". In the parent component, i have a button that dispatches an event. Here is the event code:
[Code].....
so, basically,i am checking to see if the cancel button component in the Child component, while i am still in the parent Compoent, was clicked, if it was clicked, call the cancelButtonHandler. The problem is by the time the addNewChild handles the event, that cancel button was still null. My question is how do i solve this without using the itemCreationPolicy on the cancel button?
View 1 Replies