[flexcoders] Remote Objects not working with Modules
Hi guys, i am experiencing something weired. i have an application and i have broken it up into modules so as to reduce the size of the application so archive faster download speed for the app. anyhow, i use ColdFusion to retrieve, insert, edit and delete data from a database and when i use Remote Objects in modules there is no data retrieve or added, but when is use custom components method instead of modules with the very same code, the data can be inserted or retrieved. can someone please help me and clarify on how to successful use remote objects with modules to manipulate a database with ColdFusion as the back end. thanks
[flexcoders] Web Services and ObjectProxy question for the Flex Gurus
It seems like a common problem, I'm seeing tons of posts on the web, but no solid solution. I'm making a web service call which will return a complex data type, say Car. The Car has internal complex data types like Wheel, Door, etc. I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array. Most solutions on the web show how to add this one item to an array. What I want is the actual object to be of type Car. If I change the returntype for the web service to return a single Car object, then when it returns one, it works, but more than one, it returns an array of ObjectProxy objects. I could check if the returned object is a single object, then spin through each attribute and convert it to a car, but because the car has other objects within it, they too show up as ObjectProxy objects, so I'd hve to spin through the tires, the doors, etc. which in my case is a lot of attributes, just to deserialize the object. Is there a solution for a web service to either a) always return an array, even if it is an array of 1, or b) a way for the Flex code to correctly deserialize both an array of Cars and 1 Car? Thanks!
Re: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus
Are you generating the VO's on the client side? C From: flexcodemonkey michael_reg...@dell.com To: flexcoders@yahoogroups.com Sent: Thu, July 22, 2010 2:39:24 AM Subject: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus It seems like a common problem, I'm seeing tons of posts on the web, but no solid solution. I'm making a web service call which will return a complex data type, say Car. The Car has internal complex data types like Wheel, Door, etc. I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array. Most solutions on the web show how to add this one item to an array. What I want is the actual object to be of type Car. If I change the returntype for the web service to return a single Car object, then when it returns one, it works, but more than one, it returns an array of ObjectProxy objects. I could check if the returned object is a single object, then spin through each attribute and convert it to a car, but because the car has other objects within it, they too show up as ObjectProxy objects, so I'd hve to spin through the tires, the doors, etc. which in my case is a lot of attributes, just to deserialize the object. Is there a solution for a web service to either a) always return an array, even if it is an array of 1, or b) a way for the Flex code to correctly deserialize both an array of Cars and 1 Car? Thanks!
Re: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus
true this issue comes even with remote objects call , I exactly not get the solution , but put some check at the time of return ,if its object create an array or do the this on flex . Sajid From: claudiu ursica the_bran...@yahoo.com To: flexcoders@yahoogroups.com Sent: Thu, July 22, 2010 1:07:35 AM Subject: Re: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus Are you generating the VO's on the client side? C From: flexcodemonkey michael_regert@ dell.com To: flexcod...@yahoogro ups.com Sent: Thu, July 22, 2010 2:39:24 AM Subject: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus It seems like a common problem, I'm seeing tons of posts on the web, but no solid solution. I'm making a web service call which will return a complex data type, say Car. The Car has internal complex data types like Wheel, Door, etc. I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array. Most solutions on the web show how to add this one item to an array. What I want is the actual object to be of type Car. If I change the returntype for the web service to return a single Car object, then when it returns one, it works, but more than one, it returns an array of ObjectProxy objects. I could check if the returned object is a single object, then spin through each attribute and convert it to a car, but because the car has other objects within it, they too show up as ObjectProxy objects, so I'd hve to spin through the tires, the doors, etc. which in my case is a lot of attributes, just to deserialize the object. Is there a solution for a web service to either a) always return an array, even if it is an array of 1, or b) a way for the Flex code to correctly deserialize both an array of Cars and 1 Car? Thanks!
[flexcoders] Re: 2 PopUpButton questions: force opening upwards + red and black item colors
Thank you, but now I get the runtime error: TypeError: Error #1034: Type Coercion failed: cannot convert rende...@4c310a1 to mx.controls.menuClasses.IMenuItemRenderer. at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::deleteDependentSubMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2275] at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::hideAllMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2289] at mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1706] when I click at one entry. My Renderer.mxml: ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; mx:Text text={data.label} fontSize=16 fontWeight=bold/ /mx:VBox My Test.mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationPolicy=all mx:Style @font-face { src:url(C:\\WINDOWS\\Fonts\\times.ttf); fontFamily: myFont; /* card suits */ unicodeRange: U+2660-U+266B; } Menu { fontFamily: myFont; fontSize: 24; } /mx:Style mx:Script ![CDATA[ import mx.controls.*; private function createMenu():void { var bids:Array = [{label: Pass}]; for (var i:uint = 7; i = 10; i++) for (var j:uint = 0; j 4; j++) bids.unshift({label: i+♠♣♦♥.charAt(j%4)}); var menu:Menu = new Menu(); menu.dataProvider = bids; menu.itemRenderer = new ClassFactory(Renderer); menu.selectedIndex = 0; pub.popUp = menu; } ]] /mx:Script mx:Canvas width=100% height=100% /mx:Canvas mx:ApplicationControlBar width=100% mx:Spacer width=100%/ mx:PopUpButton id=pub creationComplete=createMenu();/ /mx:ApplicationControlBar /mx:Application Does it mean VBox is missing some method needed by IMenuItemRenderer? I'm just trying to get red + black entries Regards Alex
[flexcoders] Re: Remote Objects not working with Modules
I don't know what to tell you. My application has over 25 modules and every one of them uses remote objects successfully. Could you post a small example of what you are trying? --- In flexcoders@yahoogroups.com, ZIONIST stinas...@... wrote: Hi guys, i am experiencing something weired. i have an application and i have broken it up into modules so as to reduce the size of the application so archive faster download speed for the app. anyhow, i use ColdFusion to retrieve, insert, edit and delete data from a database and when i use Remote Objects in modules there is no data retrieve or added, but when is use custom components method instead of modules with the very same code, the data can be inserted or retrieved. can someone please help me and clarify on how to successful use remote objects with modules to manipulate a database with ColdFusion as the back end. thanks
[flexcoders] Re: Web Services and ObjectProxy question for the Flex Gurus
Michael, The Flex SDK can do what you want, but the default behavior is for it to unwrap collections and enclosing types which only contain one item. This default was not a good idea, IMO. Have you tried setting Operation.forcePartArrays true? http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/Operation.html#forcePartArrays You will need to obtain the mx.rpc.soap.Operation from the WebService first. You can alter the default behavior by writing a custom deserializer (which is a non-trivial task, made more difficult by the ASDoc being turned off.) For more information about Flex WebService, see my slide show and YouTube video at http://www.slideshare.net/mslinn/using-flex-with-enterprise-web-services Mike I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array.
[flexcoders] Re: ItemEditor | Multiple Components | Focus Issue
No, i have not borrowed the code for popup editorut yes i am using the popup editor. Please see the code for Pop up at http://ilikeflex.blogspot.com/ http://ilikeflex.blogspot.com/ Under 'Code for PopUp' But my itemEditEnd event handler code is below. private function onitemEditEnd(event:DataGridEvent):void { //trace(event.reason); var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid); event.preventDefault(); datGrid.destroyItemEditor(); } I cannot remove event.preventDefault(); because my datagrid column has nested datafield. renderer:CustomDataGridColumn dataField=periodPackage.id headerText=Period Package Code width=150 refDataType={RDSConstants.RSS_PERIOD_PACKAGE} labelFunction=ServiceLabelFunctions.labelPPCode isPopupEditor=true rendererIsEditor=true editorDataField=editValue itemRenderer=com.SpyGlassFieldEditor/ I am almost there.. Any clue... Secondly what should i look in event.target and event.relatedObject Thanks ilikeflex --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: I noticed your editor looks like it is a popup. Have you borrowed the code from the popup editor example as well? On 7/21/10 11:43 AM, Rajan ilikef...@... wrote: Actually itemEditEnd in the real sceanrio looks like below. Since i am uisng the nested datafield i am calling the event.preventDefault(); datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); So my dataprovider gets updated with the new value when i use the mouse but with the key board focus does not move from column1 to column2 Any pointers private function onitemEditEnd(event:DataGridEvent):void { var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid); if (event.reason == DataGridEventReason.CANCELLED) return; var selectedObject:Object=datGrid.dataProvider[event.rowIndex]; var customDataGridColumn:CustomDataGridColumn=datGrid.columns[event.columnIn\ dex] as CustomDataGridColumn; var field:String=datGrid.columns[event.columnIndex].dataField; var array:Array=field.split(.); if (customDataGridColumn.isPopupEditor) { event.preventDefault(); datGrid.destroyItemEditor(); return; } if (array != null array.length = 2) { event.preventDefault(); var object:Object=selectedObject[array[0]]; var textEnteredByUser:String; if (datGrid.itemEditorInstance is IEditorValue) { textEnteredByUser=IEditorValue(datGrid.itemEditorInstance).editValue; object[array[1]]=textEnteredByUser; } else { textEnteredByUser=TextInput(datGrid.itemEditorInstance).text; object[array[1]]=textEnteredByUser; } datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); } } --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Rajan ilikeflex@ wrote: Hi I have created simple test case to identify the issue. If i remove itemEditEnd then i have no issues with the focus. It works cleanly and focus moves from one column to another. But if add itemEditEnd then focus does not move from 1st column to 2 nd column. So event.preventDefault(); statement is the culprit. but i cannot remove this because in the real scenario i am using nested datafield. So how to make the focus move from colimn1 to column2. any pointers are higly appreciated. ?xml version=1.0? !-- itemRenderers\inline\CBInlineCellEditor.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; [Bindable] public var ac:ArrayCollection = new ArrayCollection( [{dateString:11/12/2006, contact:ABD DEF, dt: new Date(2003,10,23)}, {dateString:11/12/2007, contact:GHI, dt:new Date(2004,11,2)}, {dateString:10/10/2007, contact:JKL MNOP, dt:new Date(2007,4,14)}, {dateString:09/12/2007, contact:QRSTUV W XY Z, dt:new Date(2006,1,1)}]); private function onitemEditEnd(event:DataGridEvent):void { event.preventDefault(); } ]] /mx:Script mx:DataGrid id=myDG dataProvider={ac} variableRowHeight=true width=500 height=250 itemEditEnd=onitemEditEnd(event) editable=true mx:columns mx:DataGridColumn headerText=DateString dataField=dateString width=120 itemEditor=com.DateEditor editorDataField=text / mx:DataGridColumn headerText=Date dataField=dt width=120 itemRenderer=mx.controls.DateField rendererIsEditor=true editorDataField=selectedDate/ mx:DataGridColumn headerText=Contact dataField=contact width=80/ /mx:columns /mx:DataGrid /mx:Application Source Code for com.DateEditor is at http://blogcode.flexmonkeypatches.com/__FMP_datagrid_datefield_editor_as\ String/srcview/index.html --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Rajan ilikeflex@ wrote: I have put the following code in the
Re: [flexcoders] Re: ItemEditor | Multiple Components | Focus Issue
You might want to compare the popup editor example from my blog with your example On 7/22/10 6:59 AM, Rajan ilikef...@yahoo.com wrote: No, i have not borrowed the code for popup editorut yes i am using the popup editor. Please see the code for Pop up at http://ilikeflex.blogspot.com/ Under 'Code for PopUp' But my itemEditEnd event handler code is below. private function onitemEditEnd(event:DataGridEvent):void { //trace(event.reason); var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid); event.preventDefault(); datGrid.destroyItemEditor(); } I cannot remove event.preventDefault(); because my datagrid column has nested datafield. renderer:CustomDataGridColumn dataField=periodPackage.id headerText=Period Package Code width=150 refDataType={RDSConstants.RSS_PERIOD_PACKAGE} labelFunction=ServiceLabelFunctions.labelPPCode isPopupEditor=true rendererIsEditor=true editorDataField=editValue itemRenderer=com.SpyGlassFieldEditor/ I am almost there.. Any clue... Secondly what should i look in event.target and event.relatedObject Thanks ilikeflex --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: I noticed your editor looks like it is a popup. Have you borrowed the code from the popup editor example as well? On 7/21/10 11:43 AM, Rajan ilikef...@... wrote: Actually itemEditEnd in the real sceanrio looks like below. Since i am uisng the nested datafield i am calling the event.preventDefault(); datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); So my dataprovider gets updated with the new value when i use the mouse but with the key board focus does not move from column1 to column2 Any pointers private function onitemEditEnd(event:DataGridEvent):void { var datGrid:CheckBoxDataGrid=(eve! nt.currentTarget as CheckBoxDataGrid); if (event.reason == DataGridEventReason.CANCELLED) return; var selectedObject:Object=datGrid.dataProvider[event.rowIndex]; var customDataGridColumn:CustomDataGridColumn=datGrid.columns[event.columnIndex] as CustomDataGridColumn; var field:String=datGrid.columns[event.columnIndex].dataField; var array:Array=field.split(.); if (customDataGridColumn.isPopupEditor) { event.preventDefault(); datGrid.destroyItemEditor(); return; } if (array != null array.length = 2) { event.preventDefault(); var object:Object=selectedObject[array[0]]; var textEnteredByUser:String; if (datGrid.itemEditorInstance is IEditorValue) { ! textEnteredByUser=IEditorValue(datGrid.itemEdit! orI nstance).editValue; object[array[1]]=textEnteredByUser; } else { textEnteredByUser=TextInput(datGrid.itemEditorInstance).text; object[array[1]]=textEnteredByUser; } datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); } } --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Rajan ilikeflex@ wrote: Hi I have created simple test case to identify the issue. If i remove itemEditEnd then i have no issues with the focus. It works cleanly and focus moves from one column to another. But if add itemEditEnd then focus does not move from 1st column to 2 nd column. So event.preventDefault(); statement is the c! ulprit. but i cannot remove this because in the real scenario i am using nested datafield. So how to make the focus move from colimn1 to column2. any pointers are higly appreciated. ?xml version=1.0? !-- itemRenderers\inline\CBInlineCellEditor.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; [Bindable] public var ac:ArrayCollection = new ArrayCollection( [{dateString:11/12/2006, contact:ABD DEF, dt: new Date(2003,10,23)}, {dateString:11/12/2007, contact:GHI, dt:new Date(2004,11,2)}, {dateStr! ing:10/10/2007, contact:JKL MNOP, dt:new Date(20! 07,4,14)}, {dateString:09/12/2007, contact:QRSTUV W XY Z, dt:new Date(2006,1,1)}]); private function onitemEditEnd(event:DataGridEvent):void { event.preventDefault(); } ]] /mx:Script mx:DataGrid id=myDG dataProvider={ac} variableRowHeight=true width=500 height=250 itemEditEnd=onitemEditEnd(event) editable=true mx:columns mx:DataGridColumn headerText=DateString dataField=dateString width=120 itemEditor=com.DateEditor editorDataField=text / mx:DataGridColumn headerText=Date dataField=dt width=120 itemRenderer=mx.controls.DateField rendererIs! Editor=true editorDataField=selectedDate/ mx:DataGridColumn headerText=Contact dataField=contact width=80/ /mx:columns /mx:DataGrid /mx:Application Source Code for com.DateEditor is at http://blogcode.flexmonkeypatches.com/__FMP_datagrid_datefield_editor_asString/srcview/index.html --- In
Re: [flexcoders] Re: Remote Objects not working with Modules
I believe there are some known issues with having a shared RO in the main app and the VO class definitions in a module. Some of those issues hopefully got resolved in FP10.1. The recommended config is to have all the VO classes in the main app with the RO. On 7/22/10 5:05 AM, valdhor valdhorli...@embarqmail.com wrote: I don't know what to tell you. My application has over 25 modules and every one of them uses remote objects successfully. Could you post a small example of what you are trying? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , ZIONIST stinas...@... wrote: Hi guys, i am experiencing something weired. i have an application and i have broken it up into modules so as to reduce the size of the application so archive faster download speed for the app. anyhow, i use ColdFusion to retrieve, insert, edit and delete data from a database and when i use Remote Objects in modules there is no data retrieve or added, but when is use custom components method instead of modules with the very same code, the data can be inserted or retrieved. can someone please help me and clarify on how to successful use remote objects with modules to manipulate a database with ColdFusion as the back end. thanks -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Re: 2 PopUpButton questions: force opening upwards + red and black item colors
There might be easier ways to get multiline text with bold and fontsize 16. Setting wordWrap=true and some styles might just work. Otherwise, it is time to read up on how to create custom item renderers. You have to implement IMenuItemRenderer in your custom renderer. On 7/22/10 1:15 AM, Alexander Farber alexander.far...@gmail.com wrote: Thank you, but now I get the runtime error: TypeError: Error #1034: Type Coercion failed: cannot convert rende...@4c310a1 to mx.controls.menuClasses.IMenuItemRenderer. at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::deleteDependentSubMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2275] at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::hideAllMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2289] at mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1706] when I click at one entry. My Renderer.mxml: ?xml version=1.0 encoding=utf-8? mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; mx:Text text={data.label} fontSize=16 fontWeight=bold/ /mx:VBox My Test.mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationPolicy=all mx:Style @font-face { src:url(C:\\WINDOWS\\Fonts\\times.ttf); fontFamily: myFont; /* card suits */ unicodeRange: U+2660-U+266B; } Menu { fontFamily: myFont; fontSize: 24; } /mx:Style mx:Script ![CDATA[ import mx.controls.*; private function createMenu():void { var bids:Array = [{label: Pass}]; for (var i:uint = 7; i = 10; i++) for (var j:uint = 0; j 4; j++) bids.unshift({label: i+♠♣♦♥.charAt(j%4)}); var menu:Menu = new Menu(); menu.dataProvider = bids; menu.itemRenderer = new ClassFactory(Renderer); menu.selectedIndex = 0; pub.popUp = menu; } ]] /mx:Script mx:Canvas width=100% height=100% /mx:Canvas mx:ApplicationControlBar width=100% mx:Spacer width=100%/ mx:PopUpButton id=pub creationComplete=createMenu();/ /mx:ApplicationControlBar /mx:Application Does it mean VBox is missing some method needed by IMenuItemRenderer? I'm just trying to get red + black entries Regards Alex -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: ItemEditor | Multiple Components | Focus Issue
I looked at your sample but it does not contain nested properties.So event.preventDefault(); is not required and everything works fine. --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: You might want to compare the popup editor example from my blog with your example On 7/22/10 6:59 AM, Rajan ilikef...@... wrote: No, i have not borrowed the code for popup editorut yes i am using the popup editor. Please see the code for Pop up at http://ilikeflex.blogspot.com/ Under 'Code for PopUp' But my itemEditEnd event handler code is below. private function onitemEditEnd(event:DataGridEvent):void { //trace(event.reason); var datGrid:CheckBoxDataGrid=(event.currentTarget as CheckBoxDataGrid); event.preventDefault(); datGrid.destroyItemEditor(); } I cannot remove event.preventDefault(); because my datagrid column has nested datafield. renderer:CustomDataGridColumn dataField=periodPackage.id headerText=Period Package Code width=150 refDataType={RDSConstants.RSS_PERIOD_PACKAGE} labelFunction=ServiceLabelFunctions.labelPPCode isPopupEditor=true rendererIsEditor=true editorDataField=editValue itemRenderer=com.SpyGlassFieldEditor/ I am almost there.. Any clue... Secondly what should i look in event.target and event.relatedObject Thanks ilikeflex --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: I noticed your editor looks like it is a popup. Have you borrowed the code from the popup editor example as well? On 7/21/10 11:43 AM, Rajan ilikeflex@ wrote: Actually itemEditEnd in the real sceanrio looks like below. Since i am uisng the nested datafield i am calling the event.preventDefault(); datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); So my dataprovider gets updated with the new value when i use the mouse but with the key board focus does not move from column1 to column2 Any pointers private function onitemEditEnd(event:DataGridEvent):void { var datGrid:CheckBoxDataGrid=(eve! nt.currentTarget as CheckBoxDataGrid); if (event.reason == DataGridEventReason.CANCELLED) return; var selectedObject:Object=datGrid.dataProvider[event.rowIndex]; var customDataGridColumn:CustomDataGridColumn=datGrid.columns[event.columnIndex] as CustomDataGridColumn; var field:String=datGrid.columns[event.columnIndex].dataField; var array:Array=field.split(.); if (customDataGridColumn.isPopupEditor) { event.preventDefault(); datGrid.destroyItemEditor(); return; } if (array != null array.length = 2) { event.preventDefault(); var object:Object=selectedObject[array[0]]; var textEnteredByUser:String; if (datGrid.itemEditorInstance is IEditorValue) { ! textEnteredByUser=IEditorValue(datGrid.itemEdit! orI nstance).editValue; object[array[1]]=textEnteredByUser; } else { textEnteredByUser=TextInput(datGrid.itemEditorInstance).text; object[array[1]]=textEnteredByUser; } datGrid.destroyItemEditor(); datGrid.dataProvider.itemUpdated(event.itemRenderer.data); } } --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Rajan ilikeflex@ wrote: Hi I have created simple test case to identify the issue. If i remove itemEditEnd then i have no issues with the focus. It works cleanly and focus moves from one column to another. But if add itemEditEnd then focus does not move from 1st column to 2 nd column. So event.preventDefault(); statement is the c! ulprit. but i cannot remove this because in the real scenario i am using nested datafield. So how to make the focus move from colimn1 to column2. any pointers are higly appreciated. ?xml version=1.0? !-- itemRenderers\inline\CBInlineCellEditor.mxml -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script ![CDATA[ import mx.events.DataGridEvent; import mx.collections.ArrayCollection; [Bindable] public var ac:ArrayCollection = new ArrayCollection( [{dateString:11/12/2006, contact:ABD DEF, dt: new Date(2003,10,23)}, {dateString:11/12/2007, contact:GHI, dt:new Date(2004,11,2)}, {dateStr! ing:10/10/2007, contact:JKL MNOP, dt:new Date(20! 07,4,14)}, {dateString:09/12/2007, contact:QRSTUV W XY Z, dt:new Date(2006,1,1)}]); private function onitemEditEnd(event:DataGridEvent):void { event.preventDefault(); } ]] /mx:Script mx:DataGrid id=myDG dataProvider={ac} variableRowHeight=true width=500 height=250 itemEditEnd=onitemEditEnd(event) editable=true mx:columns mx:DataGridColumn headerText=DateString dataField=dateString width=120 itemEditor=com.DateEditor editorDataField=text / mx:DataGridColumn headerText=Date dataField=dt width=120
Re: [flexcoders] Re: Remote Objects not working with Modules
Hi I am using modules in my application and each modules has its own Remote object and I am using Spring Blazeds as Server side. post the errors, so you can get some help. Make sure you follow things related to Application current domain settings. kannan On Thu, Jul 22, 2010 at 8:29 PM, Alex Harui aha...@adobe.com wrote: I believe there are some known issues with having a shared RO in the main app and the VO class definitions in a module. Some of those issues hopefully got resolved in FP10.1. The recommended config is to have all the VO classes in the main app with the RO. On 7/22/10 5:05 AM, valdhor valdhorli...@embarqmail.com wrote: I don't know what to tell you. My application has over 25 modules and every one of them uses remote objects successfully. Could you post a small example of what you are trying? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.comflexcoders%40yahoogroups.com , ZIONIST stinas...@... wrote: Hi guys, i am experiencing something weired. i have an application and i have broken it up into modules so as to reduce the size of the application so archive faster download speed for the app. anyhow, i use ColdFusion to retrieve, insert, edit and delete data from a database and when i use Remote Objects in modules there is no data retrieve or added, but when is use custom components method instead of modules with the very same code, the data can be inserted or retrieved. can someone please help me and clarify on how to successful use remote objects with modules to manipulate a database with ColdFusion as the back end. thanks -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Re: Web Services and ObjectProxy question for the Flex Gurus
Thanks! I will look into all of this. Greatly appreciated for the pointers! - Michael --- In flexcoders@yahoogroups.com, Mike msl...@... wrote: Michael, The Flex SDK can do what you want, but the default behavior is for it to unwrap collections and enclosing types which only contain one item. This default was not a good idea, IMO. Have you tried setting Operation.forcePartArrays true? http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/Operation.html#forcePartArrays You will need to obtain the mx.rpc.soap.Operation from the WebService first. You can alter the default behavior by writing a custom deserializer (which is a non-trivial task, made more difficult by the ASDoc being turned off.) For more information about Flex WebService, see my slide show and YouTube video at http://www.slideshare.net/mslinn/using-flex-with-enterprise-web-services Mike I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array.
[flexcoders] Re: Web Services and ObjectProxy question for the Flex Gurus
Thanks for the replies. I'm not wanting an array. Yes, I could just stick the returned single ObjectProxy in an array, but now I have an undefined object inside of an array. This works if I'm taking the returned data and binding it to some control, but I'm actually needing tp parse the returned data in an intelligent way. I'd like to access the object directly as the VO, not a generic object, that is, typed to my VO, not ObjectProxy. I understand why it does this, it does this because it was expecting an array of VOs and when it only gets one, it can't deserialize it to the VO. The problem is, how to get it to work in both cases (single object returned, and array of objects). The VOs are defined on the client side.
[flexcoders] Re: 2 PopUpButton questions: force opening upwards + red and black item colors
I've tried another code and still get the error when I click the menu: TypeError: Error #1034: Type Coercion failed: cannot convert myrende...@47410a1 to mx.controls.menuClasses.IMenuItemRenderer. at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::deleteDependentSubMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2275] at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::hideAllMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2289] at mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1706] In my code I do implement all 5 methods listed at the http://livedocs.adobe.com/flex/3/langref/mx/controls/menuClasses/IMenuItemRenderer.html so I'm not sure, what is missing here? MyRenderer.mxml: ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; alpha=0.4 width=100% height=100% mx:Script ![CDATA[ import mx.events.*; import mx.controls.*; [Bindable] private var color:uint; override public function set data(value:Object):void { if(value != null) { super.data = value; lb.text = String(value.label); color = (lb.text.indexOf('♥') != -1 || lb.text.indexOf('♦') != -1) ? 0xFF : 0x00; } dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } // Internal variable for the property value. private var _menu:Menu; public function get menu():Menu { return _menu; } public function set menu(value:Menu):void { _menu = value; } public function get measuredBranchIconWidth():Number { return 50;} public function get measuredTypeIconWidth ():Number { return 50;} public function get measuredIconWidth ():Number { return 50;} ]] /mx:Script mx:Label id=lb color={color} / /mx:Canvas Test.mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationPolicy=all mx:Style @font-face { src:url(C:\\WINDOWS\\Fonts\\times.ttf); fontFamily: myFont; /* card suits */ unicodeRange: U+2660-U+266B; } Menu, Label { fontFamily: myFont; fontSize: 24; } /mx:Style mx:Script ![CDATA[ import mx.controls.*; private function createMenu():void { var bids:Array = [{label: Pass}]; for (var i:uint = 7; i = 10; i++) for (var j:uint = 0; j 4; j++) bids.unshift({label: i+♠♣♦♥.charAt(j%4)}); var menu:Menu = new Menu(); menu.dataProvider = bids; menu.itemRenderer = new ClassFactory(MyRenderer); menu.selectedIndex = 0; pub.popUp = menu; } ]] /mx:Script mx:Canvas width=100% height=100% /mx:Canvas mx:ApplicationControlBar width=100% mx:Spacer width=100%/ mx:PopUpButton id=pub creationComplete=createMenu();/ /mx:ApplicationControlBar /mx:Application
[flexcoders] Re: 2 PopUpButton questions: force opening upwards + red and black item colors
Now it works (not sure if dispathEvent needed though and why): ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; verticalScrollPolicy=off horizontalScrollPolicy=off implements=mx.controls.menuClasses.IMenuItemRenderer width=100% height=100% mx:Script ![CDATA[ import mx.events.*; import mx.controls.*; [Bindable] private var color:uint; override public function set data(value:Object):void { if(value != null) { super.data = value; lb.text = String(value.label); color = (lb.text.indexOf('♥') != -1 || lb.text.indexOf('♦') != -1) ? 0xFF : 0x00; } dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } // implement IMenuItemRenderer interface private var _menu:Menu; public function get menu():Menu { return _menu; } public function set menu(value:Menu):void { _menu = value; } public function get measuredBranchIconWidth():Number { return 100;} public function get measuredTypeIconWidth ():Number { return 100;} public function get measuredIconWidth ():Number { return 100;} ]] /mx:Script mx:Label id=lb color={color} / /mx:Canvas
[flexcoders] FlexNativeMenu crash in the LayoutManager
This is in Flex 3.2: We have a rare crash in one of our components. We have no repro case, but we were able to catch it in the debugger once and get a callstack. Ive included the callstack at the bottom of this message. The error is: -: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject called from: mx.managers.layoutClasses::PriorityQueue/removeLargestChild Trying to figure out how this could happen... No component on this page actually even uses FlexNativeMenu... So that's odd. But we do use it in other parts of our application. We use it declared in mxml and we use it declared in .as. But, we don't do anything strange with it, and certainly not on this page. Tried to do research on exactly what removeLargestChild does, and why it would be trying to remove a FlexNativeMenu, but no dice. Anyone have any clues as to what I should dig in for here, or what the LayoutManager may be trying to do here? -ctm callstack: Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject.) mx.managers.layoutClasses::PriorityQueue/removeLargestChild mx.managers::LayoutManager/validateClient mx.core::UIComponent/validateNow mx.core::Container/createOrDestroyScrollbars mx.core::Container/createScrollbarsIfNeeded mx.core::Container/createContentPaneAndScrollbarsIfNeeded mx.core::Container/validateDisplayList mx.managers::LayoutManager/validateDisplayList mx.managers::LayoutManager/doPhasedInstantiation Function/http://adobe.com/AS3/2006/builtin::apply [no source] mx.core::UIComponent/callLaterDispatcher2 mx.core::UIComponent/callLaterDispatcher
[flexcoders] Button with tooltip but no overskin
Is there a simple way to set up a button so that it's appearance doesn't change on rollOver, but the tooltip does appear? I am simulating a menu bar of sorts using a horizontal layout of PopUpButtons and Buttons. The Buttons are just filler that need to follow the style of the others, but have no associated action. But some have meaningful labels and tooltips. In other words, I need to create a dead button with the same style as others, and a tooltip.
[flexcoders] Re: Button with tooltip but no overskin
I should have noted that this is for Flex 3. I created a subclass of ButtonSkin which overrides name() to return upSkin. If anyone has a more elegant solution please let me know. On Thu, Jul 22, 2010 at 12:35 PM, Richard Rodseth rrods...@gmail.com wrote: Is there a simple way to set up a button so that it's appearance doesn't change on rollOver, but the tooltip does appear? I am simulating a menu bar of sorts using a horizontal layout of PopUpButtons and Buttons. The Buttons are just filler that need to follow the style of the others, but have no associated action. But some have meaningful labels and tooltips. In other words, I need to create a dead button with the same style as others, and a tooltip.
Re: [flexcoders] Re: 2 PopUpButton questions: force opening upwards + red and black item colors
MyRenderer.mxml: ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; implements=”mx.controls.menuClasses.IMenuItemRenderer” On 7/22/10 4:57 AM, Alexander Farber alexander.far...@gmail.com wrote: I've tried another code and still get the error when I click the menu: TypeError: Error #1034: Type Coercion failed: cannot convert myrende...@47410a1 to mx.controls.menuClasses.IMenuItemRenderer. at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::deleteDependentSubMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2275] at mx.controls::Menu/http://www.adobe.com/2006/flex/mx/internal::hideAllMenus()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:2289] at mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1706] In my code I do implement all 5 methods listed at the http://livedocs.adobe.com/flex/3/langref/mx/controls/menuClasses/IMenuItemRenderer.html so I'm not sure, what is missing here? MyRenderer.mxml: ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; alpha=0.4 width=100% height=100% mx:Script ![CDATA[ import mx.events.*; import mx.controls.*; [Bindable] private var color:uint; override public function set data(value:Object):void { if(value != null) { super.data = value; lb.text = String(value.label); color = (lb.text.indexOf('♥') != -1 || lb.text.indexOf('♦') != -1) ? 0xFF : 0x00; } dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } // Internal variable for the property value. private var _menu:Menu; public function get menu():Menu { return _menu; } public function set menu(value:Menu):void { _menu = value; } public function get measuredBranchIconWidth():Number { return 50;} public function get measuredTypeIconWidth ():Number { return 50;} public function get measuredIconWidth ():Number { return 50;} ]] /mx:Script mx:Label id=lb color={color} / /mx:Canvas Test.mxml: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationPolicy=all mx:Style @font-face { src:url(C:\\WINDOWS\\Fonts\\times.ttf); fontFamily: myFont; /* card suits */ unicodeRange: U+2660-U+266B; } Menu, Label { fontFamily: myFont; fontSize: 24; } /mx:Style mx:Script ![CDATA[ import mx.controls.*; private function createMenu():void { var bids:Array = [{label: Pass}]; for (var i:uint = 7; i = 10; i++) for (var j:uint = 0; j 4; j++) bids.unshift({label: i+♠♣♦♥.charAt(j%4)}); var menu:Menu = new Menu(); menu.dataProvider = bids; menu.itemRenderer = new ClassFactory(MyRenderer); menu.selectedIndex = 0; pub.popUp = menu; } ]] /mx:Script mx:Canvas width=100% height=100% /mx:Canvas mx:ApplicationControlBar width=100% mx:Spacer width=100%/ mx:PopUpButton id=pub creationComplete=createMenu();/ /mx:ApplicationControlBar /mx:Application -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Issue with item renderer in Flex 3
Hi All, I am facing a problem in using item renderers. I have a checkbox as an item renderer in a datagrid. When I check/uncheck the checkbox, the color of the checkbox should change from its default color to yellow. And on click of a save button, I am saving the changes to the database and refreshes the grid. But what happens then is,due to the recycling of renderers, the yellow checkbox is appearing on some other row/column. I know that this happens because I am not resetting the yellow to default color. I also don't know where to reset the yellow to default color. This is what I did,.. on click of check box, in the click handler, i set the yellow color setStyle('fillColors',['#eccd12', '#e9d76c','#eccd12', '#e9d76c']); setStyle('fillAlphas',['1','1','1','1']); also set a boolean variable isEdited to true In override public function set data():void { if(isEdited) { //set yellow setStyle('fillColors',['#eccd12', '#e9d76c','#eccd12', '#e9d76c']); setStyle('fillAlphas',['1','1','1','1']); } else { //set default color setStyle('fillColors',['#FF', '#CC','#FF', '#EE']); setStyle('fillAlphas',['0.6','0.4','0.75','0.65']); } } This doesnt solve the problem. Can someone please help me in this? Thanks Shameer
[flexcoders] Value Object --- Object Proxy --- huh???
I'm trying to wrap my feeble brain around these concepts. Are they the same? -similar? -completely different? Your feedback will be appreciated by this greenhorn. Mark
[flexcoders] Re: Button with tooltip but no overskin
Probably no more elegant, but an alternative: package { import mx.controls.Button; import mx.core.mx_internal; use namespace mx_internal; public class DeadButton extends Button { public function DeadButton() { super(); mx_internal::overSkinName = upSkin; } } } -TH --- In flexcoders@yahoogroups.com, Richard Rodseth rrods...@... wrote: I should have noted that this is for Flex 3. I created a subclass of ButtonSkin which overrides name() to return upSkin. If anyone has a more elegant solution please let me know. On Thu, Jul 22, 2010 at 12:35 PM, Richard Rodseth rrods...@... wrote: Is there a simple way to set up a button so that it's appearance doesn't change on rollOver, but the tooltip does appear? I am simulating a menu bar of sorts using a horizontal layout of PopUpButtons and Buttons. The Buttons are just filler that need to follow the style of the others, but have no associated action. But some have meaningful labels and tooltips. In other words, I need to create a dead button with the same style as others, and a tooltip.
Re: [flexcoders] FlexNativeMenu crash in the LayoutManager
That’s a bug in Flex 3.x. It is fixed in Flex 4. Is a context menu being used in this scenario? You might try calling validateNow() before doing the rest of the work of the context menu option. On 7/22/10 11:44 AM, Christopher McArthur cmcart...@riotgames.com wrote: This is in Flex 3.2: We have a rare crash in one of our components. We have no repro case, but we were able to catch it in the debugger once and get a callstack. Ive included the callstack at the bottom of this message. The error is: -: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject called from: mx.managers.layoutClasses::PriorityQueue/removeLargestChild Trying to figure out how this could happen… No component on this page actually even uses FlexNativeMenu… So that’s odd. But we do use it in other parts of our application. We use it declared in mxml and we use it declared in .as. But, we don’t do anything strange with it, and certainly not on this page. Tried to do research on exactly what removeLargestChild does, and why it would be trying to remove a FlexNativeMenu, but no dice. Anyone have any clues as to what I should dig in for here, or what the LayoutManager may be trying to do here? -ctm callstack: Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject.) mx.managers.layoutClasses::PriorityQueue/removeLargestChild mx.managers::LayoutManager/validateClient mx.core::UIComponent/validateNow mx.core::Container/createOrDestroyScrollbars mx.core::Container/createScrollbarsIfNeeded mx.core::Container/createContentPaneAndScrollbarsIfNeeded mx.core::Container/validateDisplayList mx.managers::LayoutManager/validateDisplayList mx.managers::LayoutManager/doPhasedInstantiation Function/http://adobe.com/AS3/2006/builtin::apply [no source] mx.core::UIComponent/callLaterDispatcher2 mx.core::UIComponent/callLaterDispatcher -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
RE: [flexcoders] FlexNativeMenu crash in the LayoutManager
Actually a context menu isnt being used on this screen.. but it is on previous screens. I will try littering those with validateNows just in case.. maybe one of them is still alive for some reason or something... We are having some issues with the flex4 upgrade, so its delayed, doh. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Alex Harui Sent: Thursday, July 22, 2010 4:49 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] FlexNativeMenu crash in the LayoutManager That's a bug in Flex 3.x. It is fixed in Flex 4. Is a context menu being used in this scenario? You might try calling validateNow() before doing the rest of the work of the context menu option. On 7/22/10 11:44 AM, Christopher McArthur cmcart...@riotgames.com wrote: This is in Flex 3.2: We have a rare crash in one of our components. We have no repro case, but we were able to catch it in the debugger once and get a callstack. Ive included the callstack at the bottom of this message. The error is: -: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject called from: mx.managers.layoutClasses::PriorityQueue/removeLargestChild Trying to figure out how this could happen... No component on this page actually even uses FlexNativeMenu... So that's odd. But we do use it in other parts of our application. We use it declared in mxml and we use it declared in .as. But, we don't do anything strange with it, and certainly not on this page. Tried to do research on exactly what removeLargestChild does, and why it would be trying to remove a FlexNativeMenu, but no dice. Anyone have any clues as to what I should dig in for here, or what the LayoutManager may be trying to do here? -ctm callstack: Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::flexnativem...@234d7df1 to flash.display.DisplayObject.) mx.managers.layoutClasses::PriorityQueue/removeLargestChild mx.managers::LayoutManager/validateClient mx.core::UIComponent/validateNow mx.core::Container/createOrDestroyScrollbars mx.core::Container/createScrollbarsIfNeeded mx.core::Container/createContentPaneAndScrollbarsIfNeeded mx.core::Container/validateDisplayList mx.managers::LayoutManager/validateDisplayList mx.managers::LayoutManager/doPhasedInstantiation Function/http://adobe.com/AS3/2006/builtin::apply [no source] mx.core::UIComponent/callLaterDispatcher2 mx.core::UIComponent/callLaterDispatcher -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
Re: [flexcoders] Value Object --- Object Proxy --- huh???
Hi Mark In the fairly large applications I've worked on, I've not had occasion to use Proxy, if you mean this: http://livedocs.adobe.com/flex/3/langref/flash/utils/Proxy.html Basically it lets you create an object that poses as something else, possibly supplementing it. For example, in the example given, they create a ProxyArray which actually derives from Proxy, but (dynamically) implements the properties, operators and methods of Array, adding sum() and clear() methods. Others may disagree, and I'd love to hear of good examples, but I would actually think twice before using this. You're sacrificing type safety and possibly performance. On the other hand, Value Objects (closely related to DTOs [Data Transfer Objects], and to be contrasted with Entity objects), are bread and butter things. http://c2.com/cgi/wiki?ValueObject Their identity is based on their state rather than on their object identity. This way, you can have multiple copies of the same conceptual value object i.e. two Date instances with the same day, month etc. represent the same date, whereas var employee:Employee might refer to different Employee instances at different times, in which case we're talking about different Employees. In a Flex app, VOs are typically created to represent messages. Your API (whether AMF, JSON or XML) will return flattened data which is then converted into an object instance tree structure (not to be confused with a class inheritance tree, if you're new to OOP). If you are creating these VO classes yourself (as opposed to using ones whose source is generated by tools provided by LiveCycle, WebOrb etc) you should resist the impulse to add business logic to them. They'll typically have nothing more than a few public properties. So you might have both an EmployeeVO and an Employee class, where EmployeeVO is a Value Object or DTO, and Employee is an entity. Hope this helps. I'm sure others will weigh in. - Richard P.S. It's perhaps more appropriate to server-side work, but I love Eric Evans' book on Domain-Driven-Design http://domaindrivendesign.org/ On Thu, Jul 22, 2010 at 2:52 PM, mark.embrey mark.c.emb...@gmail.comwrote: I'm trying to wrap my feeble brain around these concepts. Are they the same? -similar? -completely different? Your feedback will be appreciated by this greenhorn. Mark
Re: [flexcoders] Value Object --- Object Proxy --- huh???
ObjectProxy is a generic VO. It is dynamic and can hold any properties and values. And it is slow. Best to create custom Vos that are strongly typed. On 7/22/10 2:52 PM, mark.embrey mark.c.emb...@gmail.com wrote: I'm trying to wrap my feeble brain around these concepts. Are they the same? -similar? -completely different? Your feedback will be appreciated by this greenhorn. Mark -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui
[flexcoders] Changing color of the PopUpButton
Hello, I have a working code for displaying red and black entries in the list of a PopUpButton (depending on the card suit). However I'm missing the minor last touch: when the user selects a red entry in the list and I assign its value to the PopUpButton's label, I don't know how to change label's color. I've tried several things and searched web... Here is my code, please try it out and you'll see the problem - Thank you Alex --TestCase.mxml ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; creationPolicy=all mx:Style @font-face { src:url(C:\\WINDOWS\\Fonts\\times.ttf); fontFamily: myFont; unicodeRange: U+0020-U+0040, /* Punctuation, Numbers */ U+0041-U+005A, /* Upper-Case A-Z */ U+005B-U+0060, /* Punctuation and Symbols */ U+0061-U+007A, /* Lower-Case a-z */ U+007B-U+007E, /* Punctuation and Symbols */ U+0410-U+0451, /* cyrillic */ U+2660-U+266B; /* card suits */ } List, Menu, CheckBox, Label, Button, PopUpButton { fontFamily: myFont; fontSize: 16; } /mx:Style mx:Script ![CDATA[ import mx.controls.*; import mx.events.*; private var menu:Menu; private function createMenu():void { var bids:Array = [{label: 'Pass'}]; for (var i:uint = 6; i = 10; i++) for (var j:uint = 0; j 5; j++) bids.unshift({label: i+'♠♣♦♥ '.charAt(j%5)}); menu = new Menu(); menu.dataProvider = bids; menu.itemRenderer = new ClassFactory(MyRenderer); menu.selectedIndex = menu.dataProvider.length - 1; menu.addEventListener('itemClick', itemClickHandler); pub.popUp = menu; pub.label = menu.dataProvider[menu.selectedIndex].label; } private function itemClickHandler(event:MenuEvent):void { var label:String = event.item.label; trace(Selected: + label); pub.label = label; // XXX how do you make the label red? pub.close(); menu.selectedIndex = event.index; } ]] /mx:Script mx:Canvas width=100% height=100% /mx:Canvas mx:ApplicationControlBar width=100% mx:Spacer width=100%/ mx:CheckBox id=auto label=Auto:/ mx:Button id=left label=lt;lt;/ mx:PopUpButton id=pub creationComplete=createMenu(); width=60/ mx:Button id=right label=gt;gt;/ /mx:ApplicationControlBar /mx:Application -MyRenderer.mxml ?xml version=1.0 encoding=utf-8? mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml; verticalScrollPolicy=off horizontalScrollPolicy=off implements=mx.controls.menuClasses.IMenuItemRenderer width=100% height=100% mx:Script ![CDATA[ import mx.events.*; import mx.controls.*; [Bindable] private var color:uint; override public function set data(value:Object):void { if(value != null) { super.data = value; lb.text = String(value.label); color = (lb.text.indexOf('♥') != -1 || lb.text.indexOf('♦') != -1) ? 0xFF : 0x00; } dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); } // implement IMenuItemRenderer interface private var _menu:Menu; public function get menu():Menu { return _menu; } public function set menu(value:Menu):void { _menu = value; }
[flexcoders] Re: Web Services and ObjectProxy question for the Flex Gurus
Thank you Mike!!! This was EXACTLY what I was looking for. Once I have Flex generate all of my VOs, I've added the following code to the sub-class's constructor which does the trick for all of my web services without me modifying the generated code. public function MyClass() { super(); for each (var operation:Operation in operations) { operation.forcePartArrays = true; } Now all of my web services work as expected! --- In flexcoders@yahoogroups.com, Mike msl...@... wrote: Michael, The Flex SDK can do what you want, but the default behavior is for it to unwrap collections and enclosing types which only contain one item. This default was not a good idea, IMO. Have you tried setting Operation.forcePartArrays true? http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/Operation.html#forcePartArrays You will need to obtain the mx.rpc.soap.Operation from the WebService first. You can alter the default behavior by writing a custom deserializer (which is a non-trivial task, made more difficult by the ASDoc being turned off.) For more information about Flex WebService, see my slide show and YouTube video at http://www.slideshare.net/mslinn/using-flex-with-enterprise-web-services Mike I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array.