Re: [flexcoders] Wierd error in instanting an mxml component in actionscript in Flex 4
Does anybody has any suggestion to solve this problem. It is acting as blocker to moving towards Flex 4 release version. Please help. Regards, Pradeep On Mon, Apr 12, 2010 at 7:36 PM, prad_ch pradeep.chaudh...@gmail.comwrote: I am getting a null object reference error while trying to instantiate an mxml component from actionscript. This same code works if compiled from Flash Builder Beta 2 version. I am getting the error only if the code is compiled in Flash Builder 4 (Flex 4 release version). The problem seems to be related to creation policy of the component but I have not been able to figure out how to resolve it. I have already specified creation policy as all. Please help. Pradeep Following is the prototype example of code. -- CustomAccountGrid.mxml ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx width=100% height=100% rowHeight=22 showHeaders=false x=0 y=20 verticalGridLines=false fontSize=12 fontWeight=normal borderVisible=false mx:columns mx:DataGridColumn dataField=name width=200/ mx:DataGridColumn id=registerBalance textAlign=right width=100/ /mx:columns /mx:DataGrid -- AccountView.mxml ?xml version=1.0 encoding=utf-8? s:Panel xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx xmlns:cust=test.custom.component.* width=100% height=100% cornerRadius=4 title=Spending Accounts fontSize=15 fontWeight=bold creationPolicy=all s:Group height=24 left=10 right=10 top=10 fontSize=12 fontWeight=normal s:layout s:HorizontalLayout gap=5 verticalAlign=middle/ /s:layout mx:LinkButton label=Add height=24 paddingBottom=2/ mx:LinkButton label=Manage height=24 paddingBottom=2/ mx:LinkButton id=accountTransferLink label=Account Transfer height=24 paddingBottom=2/ mx:LinkButton label=Refresh height=24 paddingBottom=2/ /s:Group mx:Accordion width=100% height=100% top=44 fontSize=12 fontWeight=normal creationPolicy=all s:NavigatorContent label=Money width=100% bottom=0 contentBackgroundAlpha=0xFF height=70% cust:CustomAccountGrid id=moneyAccount / /s:NavigatorContent s:NavigatorContent label=Credit width=100% height=70% cust:CustomAccountGrid id=creditAccount / /s:NavigatorContent /mx:Accordion /s:Panel -- AccordionTest.mxml ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx minWidth=955 minHeight=600 xmlns:ui=test.custom.ui.* creationComplete=creationComplete(event) fx:Declarations !-- Place non-visual elements (e.g., services, value objects) here -- /fx:Declarations fx:Script ![CDATA[ import mx.events.FlexEvent; import test.custom.ui.AccountView; private var _spendingAccount : AccountView; function creationComplete(event:FlexEvent):void{ _spendingAccount = new AccountView(); _spendingAccount.moneyAccount.dataProvider = {}; _spendingAccount.creditAccount.dataProvider = {}; } ]] /fx:Script !-- This works fine. creating through script gives error. ui:SpendingAccountView/ -- /s:Application
Re: [flexcoders] Re: Wierd error in instanting an mxml component in actionscript in Flex 4
Amy, Thanks a lot. That did it. Thanks, Pradeep On Tue, Apr 13, 2010 at 7:19 PM, Amy amyblankens...@bellsouth.net wrote: --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, prad_ch pradeep.chaudh...@... wrote: I am getting a null object reference error while trying to instantiate an mxml component from actionscript. This same code works if compiled from Flash Builder Beta 2 version. I am getting the error only if the code is compiled in Flash Builder 4 (Flex 4 release version). The problem seems to be related to creation policy of the component but I have not been able to figure out how to resolve it. I have already specified creation policy as all. Please help. Pradeep Following is the prototype example of code. -- CustomAccountGrid.mxml ?xml version=1.0 encoding=utf-8? mx:DataGrid xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx width=100% height=100% rowHeight=22 showHeaders=false x=0 y=20 verticalGridLines=false fontSize=12 fontWeight=normal borderVisible=false mx:columns mx:DataGridColumn dataField=name width=200/ mx:DataGridColumn id=registerBalance textAlign=right width=100/ /mx:columns /mx:DataGrid -- AccountView.mxml ?xml version=1.0 encoding=utf-8? s:Panel xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx xmlns:cust=test.custom.component.* width=100% height=100% cornerRadius=4 title=Spending Accounts fontSize=15 fontWeight=bold creationPolicy=all s:Group height=24 left=10 right=10 top=10 fontSize=12 fontWeight=normal s:layout s:HorizontalLayout gap=5 verticalAlign=middle/ /s:layout mx:LinkButton label=Add height=24 paddingBottom=2/ mx:LinkButton label=Manage height=24 paddingBottom=2/ mx:LinkButton id=accountTransferLink label=Account Transfer height=24 paddingBottom=2/ mx:LinkButton label=Refresh height=24 paddingBottom=2/ /s:Group mx:Accordion width=100% height=100% top=44 fontSize=12 fontWeight=normal creationPolicy=all s:NavigatorContent label=Money width=100% bottom=0 contentBackgroundAlpha=0xFF height=70% cust:CustomAccountGrid id=moneyAccount / /s:NavigatorContent s:NavigatorContent label=Credit width=100% height=70% cust:CustomAccountGrid id=creditAccount / /s:NavigatorContent /mx:Accordion /s:Panel -- AccordionTest.mxml ?xml version=1.0 encoding=utf-8? s:Application xmlns:fx=http://ns.adobe.com/mxml/2009; xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx minWidth=955 minHeight=600 xmlns:ui=test.custom.ui.* creationComplete=creationComplete(event) fx:Declarations !-- Place non-visual elements (e.g., services, value objects) here -- /fx:Declarations fx:Script ![CDATA[ import mx.events.FlexEvent; import test.custom.ui.AccountView; private var _spendingAccount : AccountView; function creationComplete(event:FlexEvent):void{ _spendingAccount = new AccountView(); _spendingAccount.moneyAccount.dataProvider = {}; _spendingAccount.creditAccount.dataProvider = {}; } ]] /fx:Script !-- This works fine. creating through script gives error. ui:SpendingAccountView/ -- /s:Application Try this: function creationComplete(e:FlexEvent):void { _spendingAccount = new AccountView(); _spendingAccount.addEventListener(FlexEvent.UPDATE_COMPLETE, initSpendingAccount); } function initSpendingAccount(e:FlexEvent):void { _spendingAccount.moneyAccount.dataProvider = new ArrayCollection(); _spendingAccount.creditAccount.dataProvider = new ArrayCollection(); } Or, you could just properly encapsulate AccountView and let it set properties on its own children in commitProperties(). HTH; Amy
[flexcoders] Re: Issue in TabNavigator component
Has anybody ran into similar behavior ? I am still not able to resolve it. Please help. On Thu, Feb 4, 2010 at 11:26 PM, Pradeep Chaudhary pradeep.chaudh...@gmail.com wrote: I am trying to dynamically add tabs to a TabNavigator. Tabs are removed on certain event on the client and I need to add it again. Problem is that even though tabs are added correctly, the selected tab header is not correct. For example, If I have two tabs and the second tab is selected when they are removed. On adding the tabs again, first tab should be the selected one. But instead the second tab header is shown as selected but the content is of first tab. I have attached sample example for reference. Please suggest what do I need to do to fix the problem. Thanks in advance. Pradeep
Re: [flexcoders] Error in logout from channel in Flex 4 [1 Attachment]
Thanks for the reply. I have not made any custom configuration for connection pool, so it should be the default value. Also, I am not aware of what property do I need to look for in client or server side for the same. Following is the configuration I have for RTMP channel : channel-definition id=my-rtmp class=mx.messaging.channels.SecureRTMPChannel endpoint url=rtmps://{server.name}:8443 class=flex.messaging.endpoints.SecureRTMPEndpoint/ properties idle-timeout-minutes10/idle-timeout-minutes keystore-file/home/pradeep/testcert.jks/keystore-file keystore-passwordtestssl/keystore-password /properties /channel-definition I think it closes the connection as the login-logout work for first two attempt. I get the error only when I try to login the third time. What is the way to verify if the connection has been closed ? I do not see any difference in logs for first two attempts. I do see that the DSId is same for all the requests. I have attached the log file for reference. Pradeep On Thu, Feb 4, 2010 at 4:08 PM, Gregor Kiddie gregor.kid...@channeladvisor.com wrote: What’s the size of the connection pool you’ve given the server to work with? If it’s 2, then that suggests the connection isn’t being released by the server. Does log out actually close the connection? I’m not sure that it does. Gk.
Re: [flexcoders] Error in logout from channel in Flex 4
Finally I am able to get it working. On logout I have to invoke channelSet.disconnectAll() to disconnect all the services using the channel. asyncConsumer.disconnect() only disconnects the specific consumer service. Question put forth by Gregor ( Does log out actually close the connection? ) got me thinking to find a suitable method on channelSet. Thanks, Pradeep On Thu, Feb 4, 2010 at 7:23 PM, Pradeep Chaudhary pradeep.chaudh...@gmail.com wrote: Thanks for the reply. I have not made any custom configuration for connection pool, so it should be the default value. Also, I am not aware of what property do I need to look for in client or server side for the same. Following is the configuration I have for RTMP channel : channel-definition id=my-rtmp class=mx.messaging.channels.SecureRTMPChannel endpoint url=rtmps://{server.name}:8443 class=flex.messaging.endpoints.SecureRTMPEndpoint/ properties idle-timeout-minutes10/idle-timeout-minutes keystore-file/home/pradeep/testcert.jks/keystore-file keystore-passwordtestssl/keystore-password /properties /channel-definition I think it closes the connection as the login-logout work for first two attempt. I get the error only when I try to login the third time. What is the way to verify if the connection has been closed ? I do not see any difference in logs for first two attempts. I do see that the DSId is same for all the requests. I have attached the log file for reference. Pradeep On Thu, Feb 4, 2010 at 4:08 PM, Gregor Kiddie gregor.kid...@channeladvisor.com wrote: What’s the size of the connection pool you’ve given the server to work with? If it’s 2, then that suggests the connection isn’t being released by the server. Does log out actually close the connection? I’m not sure that it does. Gk.
[flexcoders] Issue in TabNavigator component [1 Attachment]
I am trying to dynamically add tabs to a TabNavigator. Tabs are removed on certain event on the client and I need to add it again. Problem is that even though tabs are added correctly, the selected tab header is not correct. For example, If I have two tabs and the second tab is selected when they are removed. On adding the tabs again, first tab should be the selected one. But instead the second tab header is shown as selected but the content is of first tab. I have attached sample example for reference. Please suggest what do I need to do to fix the problem. Thanks in advance. Pradeep
Re: [flexcoders] clearing of selected checkboxes for the next visit of the page ?
If you are using a viewstack to change views then you can handle change event of viewstack and perform the cleaning up in xyz.mxml component. If this does not solve ypur problem then you need to give more detail about the scenario. Pradeep Yahoo! Groups Sponsor ~-- Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM ~- -- 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] Help required for Flex Unit
I have implemented Command Pattern in ActionScript to perform operations on server as given in book Developing Rich Clients with Macromedia Flex. I want to test these commands using FlexUnit framework. Issue is that test does not waits for the callback to be invoked after response from server. So I always get test result as passed even before the callback occurs. Please suggest the best way of how i can achieve this. Thanks, Pradeep Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12h2lsrc3/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123486558/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 Fair play? Video games influencing politics. Click and talk back!/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] Testing of Server requests with FlexUnit
I have implemented Command Pattern in ActionScript to perform operations on server as given in book Developing Rich Clients with Macromedia Flex. I want to test this commands using FlexUnit framework. Issue is that test does not waits for the callback to be invoked after response from server. So test is always passed. Also i want to fail the test on some validation in resultHandler. Please suggest the best way of how i can achieve this. Pradeep Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12ho1qbjv/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1122906589/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] Capturing of Escape key in Cell Renderer
I want to rollback changes made through custom cell renderer when user presses Escape key. But keyDown never fires on escape key; keyUp event captures Escape key but it not consistent in its behavior. Following is code:- function keyUp(event):Void{ //Key.ESCAPE does not works so check for Ascii code. if(Key.getAscii() == 27){ listOwner.disposeEditor(); } } The above code works in Custom ComboBoxCellRenderer only if i select some value in comboBox. If i try to escape out without changing any value the above code executes but there is no visible effect. The same piece does not works in custom text cell renderer in any case. Pradeep -- 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/
Re: [flexcoders] Programmatically Scrolling of datagrid
I want to make the first cell of the new row added to be editable by default. On scrolling the datagrid down to the selected row the first cell is not set to edit mode. If row is visible by default i.e there is no need for scrolling then first cell is made editable. Following is the code function enterNewRow(event:Object):Void { var newRowIndex = datagrid.dataProvider.length; var model:Object = new Object(); model.date = new Date(); model.amount = 0; model.editable = true; datagrid.addItemAt(newRowIndex, model); _wait = setInterval(this, focusNewRow, 300); } function focusNewRow():Void { clearInterval(_wait); var newRowIndex = datagrid.dataProvider.length-1; var focusedCellMap = {columnIndex: 0, itemIndex:newRowIndex}; datagrid.vPosition = newRowIndex; datagrid.focusedCell = focusedCellMap; //Override previous focussed cell location. datagrid.setFocus(); datagrid.focusedCell = focusedCellMap; } Pradeep On 6/28/05, Manish Jethani [EMAIL PROTECTED] wrote: On 6/28/05, Clint Modien [EMAIL PROTECTED] wrote: To calculate the vPosition of a particular row you could use (current index of the row you want to scroll to) * (the height of a row) to be able to set the vPosition of the DataGrid Actually, for the DataGrid, the vPosition is the row index (not the pixel value). -- 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 Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- 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/
Re: [flexcoders] Row editing in datagrid
I have implemented a similar logic to create records through cell editing. Row based editing means that all the editable cells in a row are in edit mode and user can tab through them entering values and save all the changes made in a single request to server. When the user saves the record the row returns to normal mode i.e. just displaying data. There is no single cell edits. Hope this clarifies my requirements. Regards, Pradeep On 6/27/05, Manish Jethani [EMAIL PROTECTED] wrote: On 6/27/05, Pradeep Chaudhary [EMAIL PROTECTED] wrote: We already have a web based app in which we support row based editing for a record. By row-based editing for a record, do you mean that the cells are edited individually but the entire record is commited at once in a single operation? If that's the case, you can achieve the same programmatically by keeping track of the row being edited and adding a `commit=true|false` flag to the row. When the record is done, you set commit=true. j -- 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 the Yahoo! Terms of Service. -- 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/
Re: [flexcoders] Row editing in datagrid
Can u suggest some ideas on how i can achieve that. How can i set a current row ? Does datagrid has some internal logic to identify the current row ? How can i do it using styles ?. As far as i know i think i will have to make the create a cutom row renderer for it. Please suggest if this is the way to go. Pradeep On 6/27/05, Manish Jethani [EMAIL PROTECTED] wrote: On 6/27/05, Pradeep Chaudhary [EMAIL PROTECTED] wrote: Row based editing means that all the editable cells in a row are in edit mode and user can tab through them entering values and save all the changes made in a single request to server. When the user saves the record the row returns to normal mode i.e. just displaying data. There is no single cell edits. It might be possible to get that behaviour if you're really determined. The default behaviour in the DataGrid, which is correct IMO, is to show only the currently editable cell as, er, editable. There are other ways to indicate the current row (using styles). -- 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 Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- 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] Programmatically Scrolling of datagrid
How can I scroll the datagrid programmatically to show a row which is below the viewable area? I want to scroll the datagrid to the last row of the grid on adding of a new record to dataprovider. Are there any method to scroll based upon row index. Pradeep -- 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/
Re: [flexcoders] Row editing in datagrid
Hi Manish, We already have a web based app in which we support row based editing for a record. Idea is to allow the user to edit any of the values for a record and save it all at the same time instead of having him to edit just a single value. It is also helpful for creating records within the grid. User can add a new row in the datagrid which is editable by default and he can enter the values for the record and save it by pressing enter in any of the cell. Pradeep On 6/24/05, Manish Jethani [EMAIL PROTECTED] wrote: On 6/24/05, Pradeep Chaudhary [EMAIL PROTECTED] wrote: Can we have row based editing instead of default cell based in the datagrid ? Is there a workaround or a hack to get this feature. What would row-based editing look and feel like? How do you expect editing of the entire row at once to work (in terms of user experience)? -- 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 the Yahoo! Terms of Service. -- 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/
Re: [flexcoders] How to create copy of a object
Thanks for the support. The solution works great. But i would like to know meaning of statement new source.__constructor__(); Also if you guys can give some links to documents which provide information about the inner details of Flex or Actionscript, like keywords and logic used in given solution. Thanks for the help. Pradeep On 6/22/05, James Ward [EMAIL PROTECTED] wrote: Joe, Your timing on this was impeccable! I just spent the past hour wrestling with ObjectCopy (both Manish's and the mx.utils one that doesn't work). So here is Manish's ObjectCopy with Joe's hack to preserve type: public static function copy(source):Object { var cl:Number = copyCache.length; for (var i:Number = 0; i cl; i++) { var o = copyCache[i]; if (o.s == source) return o.t; } copyDepthLevel++; var newObj; if (typeof(source.__constructor__) == function) { // for AS2 classes newObj = new source.__constructor__(); } else if (typeof(source.constructor) == function) { // for Arrays and Objects newObj = new source.constructor(); } else { // for goodness sake, instantiate *something*! newObj = new Object(); } copyCache.push({s: source, t: newObj}); for (var p in source) { var v = source[p]; newObj[p] = typeof v == object ? copy(v) : v; } if (--copyDepthLevel == 0) copyCache = []; return newObj; } Notice that the method signature changed slightly. This was to avoid this error: Error: A function call on a non-function was attempted. due to: newObj = new source.constructor(); I have tested this code in my app and it's working great! Thanks Joe and Manish! -James On Wed, 2005-06-22 at 11:18 -0400, Joe Berkovitz wrote: A couple of big caveats here. 1. mx.utils.ObjectCopy is broken. (At least, in the Flex 1.5 distribution.) It does not correctly preserve the class of an object when that class is a subclass of some superclass. Instead, the copied object will appear to have the type of the superclass. I note that ObjectCopy appears to only be used in net debugging and nowhere else. So this bug isn't exposed via any documented Flex APIs. Moral: beware of undocumented internal Flash classes, however convenient they might look. 2. Even if ObjectCopy worked, you cannot conveniently meld Manish's cached-array approach with it, because ObjectCopy will do the wrong thing with cycles (it locks up) and multiply referenced objects (it duplicates instances). So what to do? As empirically determined through testing, one correct approach in Flex 1.5 to instantiating an object that preserves the type of an existing one is as follows: var newObj; if (typeof(obj.__constructor__) == function) { // for AS2 classes newObj = new obj.__constructor__(); } else if (typeof(obj.constructor) == function) { // for Arrays and Objects newObj = new obj.constructor(); } else { // for goodness sake, instantiate *something*! newObj = new Object(); } I've exhaustively tested this and it works correctly for AS2 classes, for Arrays, and for untyped Objects. You can merge it with Manish's code (which I haven't tested, but looks good) to produce a working, accurate deep copy. .. . .. .j Abdul Qabiz wrote: http://manish.revise.org/2005/04/deepcopying-actionscript-objects.html http://www.darronschall.com/weblog/archives/000148.cfm -abdul -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pradeep Chaudhary Sent: Wednesday, June 22, 2005 7:33 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to create copy of a object I want to create a copy for my custom object before it is modified so that i can rollback my changes on any error condition. Do we have any inbuilt methods or any alternative solution for creating a copy of object so that changes made to original object is not reflected copied object. Pradeep Yahoo! Groups Links Yahoo! Groups Links Yahoo! Groups Links 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
[flexcoders] How to create copy of a object
I want to create a copy for my custom object before it is modified so that i can rollback my changes on any error condition. Do we have any inbuilt methods or any alternative solution for creating a copy of object so that changes made to original object is not reflected copied object. Pradeep 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] Inline editing on double click in datagrid
I want to implement cell editing in datagrid based upon mouse double click. I have already implemented logic to fire doubleClick event on either cellPress or mouseUp event. Only problem is that I'am not able to stop default cell editing on single mouse click. Can anybody please suggest as to how can i stop default cell editing. Also suggest which is a better place for dispatching doubleClick event, in cellPress or mouseUp ? Pradeep 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/
Re: [flexcoders] Re: Inline editing on double click in datagrid
I was not able to find source for DataGridRow.as. It will be great if you can attach a copy of source code. Pradeep On 6/13/05, alex_harui [EMAIL PROTECTED] wrote: Unfortunately, I can't think of a documented way to do this. I will suggest looking in DataGridRow.as source in Flash MX 2004. It might give you a clue how to do it, but we can't officially support it from Macromedia. --- In flexcoders@yahoogroups.com, Pradeep Chaudhary [EMAIL PROTECTED] wrote: I want to implement cell editing in datagrid based upon mouse double click. I have already implemented logic to fire doubleClick event on either cellPress or mouseUp event. Only problem is that I'am not able to stop default cell editing on single mouse click. Can anybody please suggest as to how can i stop default cell editing. Also suggest which is a better place for dispatching doubleClick event, in cellPress or mouseUp ? Pradeep 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 the Yahoo! Terms of Service. 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] Custom ComboBoxCellRenderer Issue
Hi, This is my second post regarding custom cell renderer issue. I'am trying to create a custom ComboBoxCellRenderer to be used in DataGrid. By default label is selected Item label value. On clicking in the cell ComboBoxCellRenderer is displayed with selected value. But the ComboBox never disappears when i click outside it. This is similar problem that i faced in custom DateCellRenderer. Can anybody please suggest what I'm missing. Attached is source code for the ComboBoxCellRenderer Thanks in advance, Pradeep 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/ ComboBoxCellRenderer.as Description: Binary data
Re: [flexcoders] Custom DateCellRenderer issue.
Thanks Alistair. Surprisingly I had tried this same thing before sending the post but i was not able to acheive expected results. May be something else was also missing at that time. Thanks again, Pradeep On 5/25/05, Alistair McLeod [EMAIL PROTECTED] wrote: Hi Pradeep, Change your focusIn() method to the following: function focusIn() : Void { if ( dateObj == undefined ) { createClassObject( DateField, dateObj, 100, {styleName:this, owner:this}); dateObj.width=width; dateObj.dateFormatter=this.formatDate; dateObj.addEventListener(change, this); } dateObj.selectedDate = dateValue; dateObj.visible = true; label.visible = false; dateObj.setFocus(); } You were recreating the DateField object each time. I also removed the hardcoded with of 80 and set it to the cell width - this fixed the layout of the DateField when it first appeared. The creation of the DateField object probably better sits within createChildren, but that should make it work. Your date formatter isn't working because of scope of the dateFormat instance variable inside your formatDate() method, probably because you're adding event listeners without using the Delegate class - I'll let you work out the correct solution for that yourself, but a workaround for just now is to define the date formatter inside your formatDate() method: private function formatDate( date : Date ):String{ var dateFormat = new DateFormatter(); dateFormat.formatString=MM-DD-; return dateFormat.format(date); } Cheers, Ali -- Alistair McLeod Development Director iteration::two [EMAIL PROTECTED] Office: +44 (0)131 338 6108 This e-mail and any associated attachments transmitted with it may contain confidential information and must not be copied, or disclosed, or used by anyone other than the intended recipient(s). If you are not the intended recipient(s) please destroy this e-mail, and any copies of it, immediately. Please also note that while software systems have been used to try to ensure that this e-mail has been swept for viruses, iteration::two do not accept responsibility for any damage or loss caused in respect of any viruses transmitted by the e-mail. Please ensure your own checks are carried out before any attachments are opened. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pradeep Chaudhary Sent: 25 May 2005 16:02 To: flexcoders@yahoogroups.com Subject: [flexcoders] Custom DateCellRenderer issue. Hi, I'am trying to create a custom DateCellRenderer to be used in DataGrid. By default label is displayed with formatted date value. On clicking in the cell DateField is displayed with cell value. After changing the date the DateField shows empty text field and its size changes. I want it to just display the changed value. The DateField should disappear when user clicks or tabs out of the DateField with the label displaying the new value. Also i could not apply a dateFormatter function to the DateField. Can anybody please suggest what I'm missing. Attached is source code for the DateCellRenderer and sample DataGrid in which it is used. Thanks in advance, Pradeep Yahoo! Groups Links 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 the Yahoo! Terms of Service. 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/
Re: [flexcoders] HttpRequest and HttpSession access in Remote Obj ect
Hi James, Thanks for your suggestion. That was exactly the case. My RemoteObject classes were in different folder. So it was not loaded by the webapp's classloader. Copying the jar file to WEB-INF/lib worked. Thanks for the help. Pradeep On 5/9/05, James Ward [EMAIL PROTECTED] wrote: Pradeep, I think I saw this same problem when I did not have my RemoteObject class in the webapp's classloader. Is the class you are invoking in either the WEB-INF/lib or WEB-INF/classes dir? -James On Mon, 2005-05-09 at 11:22 +0530, Pradeep Chaudhary wrote: The class is invoked normally by Remote Object Framework. Since the flashgateway.Gateway.getHttpRequest() method returns null I cannot call the getSession() method on it. I'am also not dealing with any threads at present. Do I need to do some configuration settings to have this working. I have the required flashgateway.jar file in WEB-INF/lib directory. Pradeep On 5/6/05, Peter Farland [EMAIL PROTECTED] wrote: You simply get the HttpServletRequest object from flashgateway.Gateway.getHttpRequest() and then call getSession from there. If a session doesn't exist you need to pass true to getSession so that it will create one for you. This method only works if you are within the same thread that made the HTTP request - i.e. your class was invoked normally by our RemoteObject framework by a normal NetConnection to the AMF Gateway Servlet. I've not heard of anyone having problems with the syntax so I'd be interested to hear how Pradeep or yourself are having issues with this. Without more information, however, I can not suggest what might be wrong. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brett Palmer Sent: Friday, May 06, 2005 1:53 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] HttpRequest and HttpSession access in Remote Obj ect I think Pradeep's question is the same as mine. Is there a method in Flex to gain access to the webcontainers session information? We need this because we have a lot of existing server side code that uses a session object to determine login status, user rights, etc. We also use sessions to help determine the load on our servers. What is the recommended method for sharing session information with a Flex/Flash client and the server when using remote objects? Thanks in advance, Brett On 5/5/05, Matt Chotin [EMAIL PROTECTED] wrote: Hmm, that seems odd considering we need a request to reach the RemoteObject. You're not spawning a thread are you? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pradeep Sent: Thursday, May 05, 2005 4:48 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] HttpRequest and HttpSession access in Remote Object I'am using Remote Objects to call my Java class methods on server. For maintaining user information I need Http Session object. So I tried using flashgateway.Gateway.getHttpRequest() and flashgateway.Gateway.getHttpRequest().getSession() to get HttpRequest and HttpSession objects respectively. But flashgateway.Gateway.getHttpRequest() method returns null. Unless I get reference to request obect I will not be able to access Session object. Can anybody please suggest something? 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 the Yahoo! Terms of Service. Yahoo! Groups Links 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 the Yahoo! Terms of Service. Yahoo! Groups Links 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 the Yahoo! Terms of Service. Yahoo! Groups Links * To visit your group
Re: [flexcoders] HttpRequest and HttpSession access in Remote Obj ect
The class is invoked normally by Remote Object Framework. Since the flashgateway.Gateway.getHttpRequest() method returns null I cannot call the getSession() method on it. I'am also not dealing with any threads at present. Do I need to do some configuration settings to have this working. I have the required flashgateway.jar file in WEB-INF/lib directory. Pradeep On 5/6/05, Peter Farland [EMAIL PROTECTED] wrote: You simply get the HttpServletRequest object from flashgateway.Gateway.getHttpRequest() and then call getSession from there. If a session doesn't exist you need to pass true to getSession so that it will create one for you. This method only works if you are within the same thread that made the HTTP request - i.e. your class was invoked normally by our RemoteObject framework by a normal NetConnection to the AMF Gateway Servlet. I've not heard of anyone having problems with the syntax so I'd be interested to hear how Pradeep or yourself are having issues with this. Without more information, however, I can not suggest what might be wrong. -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brett Palmer Sent: Friday, May 06, 2005 1:53 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] HttpRequest and HttpSession access in Remote Obj ect I think Pradeep's question is the same as mine. Is there a method in Flex to gain access to the webcontainers session information? We need this because we have a lot of existing server side code that uses a session object to determine login status, user rights, etc. We also use sessions to help determine the load on our servers. What is the recommended method for sharing session information with a Flex/Flash client and the server when using remote objects? Thanks in advance, Brett On 5/5/05, Matt Chotin [EMAIL PROTECTED] wrote: Hmm, that seems odd considering we need a request to reach the RemoteObject. You're not spawning a thread are you? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pradeep Sent: Thursday, May 05, 2005 4:48 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] HttpRequest and HttpSession access in Remote Object I'am using Remote Objects to call my Java class methods on server. For maintaining user information I need Http Session object. So I tried using flashgateway.Gateway.getHttpRequest() and flashgateway.Gateway.getHttpRequest().getSession() to get HttpRequest and HttpSession objects respectively. But flashgateway.Gateway.getHttpRequest() method returns null. Unless I get reference to request obect I will not be able to access Session object. Can anybody please suggest something? 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 the Yahoo! Terms of Service. Yahoo! Groups Links 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 the Yahoo! Terms of Service. 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/