[flexcoders] Re: Application container failed to capture KeyboardEvent
Thanks Alex. That works! When I switch to another application and then switch back, my all flash application loses the focus and no event fires at all unless I click somewhere in it. Is there any way around it? Tie --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: No children of the Application have focus, so there are no events to capture. If you listen to the stage, you'll see everything. The app is not the top-level displayobject so your handlers will not pick up events from popups either. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of zhongtie Sent: Saturday, November 24, 2007 6:22 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Application container failed to capture KeyboardEvent My simple flex app somehow doesn't respond to key event, but mouse events work fine. Any ideas? Thanks, Tie --- src code --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml layout=absolute keyDown=onEvent(event) mouseDown=onEvent(event) mx:Script ![CDATA[ protected function onEvent(e:Event):void { trace(e.type); } ]] /mx:Script /mx:Application
[flexcoders] Application container failed to capture KeyboardEvent
My simple flex app somehow doesn't respond to key event, but mouse events work fine. Any ideas? Thanks, Tie --- src code --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute keyDown=onEvent(event) mouseDown=onEvent(event) mx:Script ![CDATA[ protected function onEvent(e:Event):void { trace(e.type); } ]] /mx:Script /mx:Application
[flexcoders] LocalConnection Bug?
I tried to send an XML object over LocalConnection, and noticed if this XML doesn't have any child node, the other side will only see an empty one. For example: lc.send(lc_id, fn, new XML(a b='1'/)) lc_id.fn() will see an . However if we send ab/b/a, things work well. Is this a LocalConnection bug? Any workaround? I am using flash9/AS3. I thought about toString() but since I may also send objects containing XML object, it will be hard to decide when to do this conversion to/from string. Any ideas? Thanks! Tim
[flexcoders] Re: TitleWindow missing all focus events??
Thanks, Roman. Actually you answered my another question: I have been trying to figure out why I cannot focus in the edit control inside the titlewindow :) Where did you learn those good tips about relatedObject ?!! I am still a little puzzled by how focusIn works. I realized I have to do these two lines before the focusIn/OutHandler gets invoked: this.addEventListener(FocusEvent.FOCUS_IN, focusInHandler); this.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); Does it mean by default, TitleWindow doesn't get FOCUS events dispatched to? Thanks again for your great help! Tim --- In flexcoders@yahoogroups.com, Roman Protsiuk [EMAIL PROTECTED] wrote: Overloading focusOutHandler/focusInHandler helps. You'll be able to handle FocusEvents there. Like in protected override function focusOutHandler(event : FocusEvent) : void { if (event.relatedObject == null || !contains(event.relatedObject)) { // event came from outside not from one of the children } super.focusOutHandler(event); } R. On 2/2/07, zhongtie [EMAIL PROTECTED] wrote: I pop up TitleWindows using PopupManager, and I change the titlebar colors based on if the titleWindow is active (topmost) or not. The problem is, I am NOT able to capture the focus event for TitleWindow (other controls, like TextArea, has no problems), nor does onFocusIn/onFocusOut overwrite work. Any idea?
[flexcoders] Container focus question
I tried to capture the TitleWindow focus, which I did, but somehow I can no longer focus in its RichEdit component. Attached is my code. Could anyone shred some light on it? Thanks! /*== Main application ==*/ ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns:user=* layout=absolute backgroundGradientColors=[#c6cdfd, #ee] mx:Script ![CDATA[ import mx.core.*; import mx.managers.PopUpManager; [Bindable] protected var _imX:int = 30; protected var _imY:int = 30; protected var _dist:int = 30; // create a new IM window, or bring the existing session to the front protected function newWin(e:Event):void{ var win:myWin = null; win = myWin(PopUpManager.createPopUp(this, myWin)); win.x = _imX; win.y = _imY; _imX += _dist; _imY += _dist; } ]] /mx:Script mx:Button label=New window top=20 height=60 width=180 fontSize=16 click=newWin(event) right=20/ /mx:Application /*== myWin.mxml ==*/ ?xml version=1.0 encoding=utf-8? mx:TitleWindow xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute width=504 height=378 fontWeight=bold backgroundAlpha=0.9 showCloseButton=true updateComplete=rteInput.setFocus() initialize=_init() title=my title window mx:Script ![CDATA[ import mx.controls.List; import mx.managers.PopUpManager; import mx.core.*; [Bindable] protected var _headerColors:Array = [[#AA, #EE],// blurred, [#A65904, #E68701] // focused ]; protected function _init():void { this.addEventListener(FocusEvent.FOCUS_IN, focusInHandler); this.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); } // $style: 0 - blurred, 1 - focused public function setFocusStyle($style:Number):void { setStyle(headerColors, _headerColors[$style]); } override protected function focusInHandler(event:FocusEvent):void { super.focusInHandler(event); setFocusStyle(1); } override protected function focusOutHandler(event:FocusEvent):void { super.focusOutHandler(event); setFocusStyle(0); } ]] /mx:Script mx:RichTextEditor id=rteInput bottom=10 height=318 left=5 right=10 enabled=true /mx:RichTextEditor /mx:TitleWindow
[flexcoders] TitleWindow missing all focus events??
I pop up TitleWindows using PopupManager, and I change the titlebar colors based on if the titleWindow is active (topmost) or not. The problem is, I am NOT able to capture the focus event for TitleWindow (other controls, like TextArea, has no problems), nor does onFocusIn/onFocusOut overwrite work. Any idea?
[flexcoders] I have an image inside a canvas container, and when I resize the canvas, the ima
I have an image in a canvas container, and when I resize the canvas, the image resizes as I expect. However, the image position doesn't change at all, unlike in a Flash applicaiton. For example, on a 300x300 canvas, I load an image of 100x100 at (100, 100). If I double the size of the canvas to 600x600, the image is automatically resized to 200x200, BUT still at (100, 100), instead of (200, 200)!! What will be the solution for this? Please help! Thanks in advance!! Tim Sample Code == Please replace your_image_here.jpg with any JPG file === == in the same dir=== = Attach Code ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ var zoomIn:Boolean = false; function onClick():Void { zoomIn = !zoomIn; if (zoomIn) { frame.width = 200; frame.height = 160; } else { frame.width = 400; frame.height = 320; } } ]] /mx:Script mx:Button label=zoom click=onClick()/ mx:Canvas width=400 height=320 id=frame backgroundColor=#99 mx:Image source=your_image_here.jpg x=100 y=100 width=50% height=50%/ /mx:Canvas /mx:Application Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12haa0tbn/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123550959/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Writing a Custom Data Provider
Hi, I am trying to write a custome data provider for my list control. My data is not an array, so I am trying to rewrite all those APIs. Here are some questions: 1. is modelChanged event subscription handled by the flex framework? In another word, do I need to do any thing besides calling dispatchEvent({target:this, type:modelChanged, eventName:...)? 2. Is there any good example I could follow? I tried this example (http://www.macromedia.com/support/documentation/en/flex/1/mixin/mixin3.html), but ran into many issues, such as: a. getParent() required by the compiler. It's not in the ASDoc, however; b. I saw many warnings in the log: Warning: getChildNodes is not a function Warning: __get__editable is not a function Warning: hasChildNodes is not a function Warning: getParent is not a function ... c. The GUI doesn't update itself unless I hover my mouse around. Any advice will be greatly appreciated! Tim -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: dynamically creating children suggestions?
That way for each different XML, backend Flex server needs to compile it into a new swf, which, in my experience, has been a not so fast process. Robert's screen is going to hang either way. But frankly, I don't have a solution :( tim --- In flexcoders@yahoogroups.com, JesterXL [EMAIL PROTECTED] wrote: If deferred instantation does nothing, and a Repeater doesn't solve your woes, then I'd look to doing some lower level things such as creating your own UIObjectDescriptors, and staggering the drawing algorithm to only process a certain amount of children to create per frame. Stepping back, why not have a server side process generate the MXML (since it's just XML to begin with and you are merely changign the format), have the server-side component (CF/Java) write out the MXML, and then use a Loader to hit the MXML file? 10 billion more ideas of course, Matt'll put the smack down when he finishes his tea and crepes. - Original Message - From: Robert Brueckmann To: flexcoders@yahoogroups.com Sent: Thursday, July 21, 2005 6:10 PM Subject: [flexcoders] dynamically creating children suggestions? I'm getting XML back from the database. The XML contains a bunch of elements, all containing children elements that tell me what type of component to display, i.e.: . FILTERSORT EFL_NAMEASSETS/EFL_NAME EFL_DESCAssets/EFL_DESC EFL_SORTY/EFL_SORT EFL_FILTERY/EFL_FILTER PRM_TYPE_ID2/PRM_TYPE_ID PRM_TYPE_NAMENUMBER/PRM_TYPE_NAME PUI_ID3/PUI_ID PUI_TYPEMULTILIST/PUI_TYPE FILTERSORTVALUELIST PRM EFL_VALUE= FFL_DESC= EFL_SEQ=0/PRM PRM EFL_VALUE=1 FFL_DESC=Cash and Equivalents EFL_SEQ=2/PRM PRM EFL_VALUE=50 FFL_DESC=Equities EFL_SEQ=3/PRM PRM EFL_VALUE=10 FFL_DESC=Fixed Income EFL_SEQ=4/PRM PRM EFL_VALUE=65 FFL_DESC=Futures EFL_SEQ=5/PRM PRM EFL_VALUE=99 FFL_DESC=Indices EFL_SEQ=6/PRM PRM EFL_VALUE=60 FFL_DESC=Options EFL_SEQ=7/PRM PRM EFL_VALUE=95 FFL_DESC=Private Placements EFL_SEQ=8/PRM PRM EFL_VALUE=75 FFL_DESC=Rights and Warrants EFL_SEQ=9/PRM PRM EFL_VALUE=70 FFL_DESC=Swaps EFL_SEQ=10/PRM /FILTERSORTVALUELIST /FILTERSORT FILTERSORT EFL_NAMEACCOUNT_NAME/EFL_NAME EFL_DESCAccounts/EFL_DESC EFL_SORTY/EFL_SORT EFL_FILTERY/EFL_FILTER PRM_TYPE_ID2/PRM_TYPE_ID PRM_TYPE_NAMESTRING/PRM_TYPE_NAME PUI_ID3/PUI_ID PUI_TYPETEXTFIELD/PUI_TYPE /FILTERSORT . So my flex app gets this XML chunk, I loop through the XML and based on certain parameters in the example XML above, and in each loop, I call createChild on a Form component I have in my MXML file and I build a form that displays to the user various filters they can set for the report they just selected. I'm dynamically generating DateFields, Textfields, Lists, and a custom Range component that I created whose MXML file looks like this: ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:mx=http://www.macromedia.com/2003/mxml; width=200 fontWeight=bold mx:Script ![CDATA[ public var operator:String = 1; function updateOperator(e) { operator = e.target.selectedItem.data; } ]] /mx:Script mx:LinkBar width=100% dataProvider={rangeStack} / mx:ViewStack id=rangeStack width=100% mx:HBox width=100% label=comparison mx:ComboBox id=operatorList change=updateOperator(event); selectedIndex=0 width=50 mx:dataProvider mx:Array mx:Object label=lt; data=1 / mx:Object label=lt;= data=2 / mx:Object label=== data=3 / mx:Object label=gt;= data=4 / mx:Object label=gt; data=5 / /mx:Array /mx:dataProvider /mx:ComboBox mx:TextInput id=compVal width=100% / /mx:HBox mx:HBox width=100% label=range mx:Label