[flexcoders] WSDLifficulty - bad SOAP encoding
I ran in to a problem today with Flex's SOAP encoding which I think is a bug in the SOAP encoder. It seems like whatever I did to call one of my webservice methods, Flex would give me an error as it was encoding my request. The error was something like the following: TypeError: Error #1009: Cannot access a property or method of a null object reference. ... at mx.rpc::AbstractService/dispatchEvent()[C:\dev\enterprise_bali \frameworks\mx\rpc\AbstractService.as:236] at mx.rpc.soap.mxml::WebService/dispatchEvent()[C:\dev \enterprise_bali\frameworks\mx\rpc\soap\mxml\WebService.as:226] at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/ internal::dispatchRpcEvent()[C:\dev\enterprise_bali\frameworks\mx\rpc \AbstractOperation.as:183] at mx.rpc.soap::Operation/http://www.adobe.com/2006/flex/mx/ internal::invokePendingCall()[C:\dev\enterprise_bali\frameworks\mx\rpc \soap\Operation.as:584] at mx.rpc.soap::Operation/send()[C:\dev\enterprise_bali\frameworks\mx \rpc\soap\Operation.as:492] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.rpc.soap.mxml::Operation/send()[C:\dev\enterprise_bali \frameworks\mx\rpc\soap\mxml\Operation.as:140] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.rpc::AbstractService/http://www.adobe.com/2006/actionscript/ flash/proxy::callProperty()[C:\dev\enterprise_bali\frameworks\mx\rpc \AbstractService.as:287] My program would always stop right at the encoding process. The trace stopped with these last lines: ... 19:41:19.740 [DEBUG] mx.rpc.soap.SOAPEncoder Encoding SOAP request envelope 19:41:19.745 [DEBUG] mx.rpc.soap.SOAPEncoder Encoding SOAP request body After many attempts to try to get my very simple 1-string request encoded, I started looking in to the WSDL. Luckily I could control the WSDL - in many webservice use cases, you can not. From what I have been able to deduce, Flex's SOAP encoder will throw the above error if the name of the webservice Operation - i.e. "ListInterviews" - is not the same as the name of the message part element, i.e. "ListInterviewsRequest". As a more thorough example, consider this WSDL, which should be fully valid (Oxygenxml and XmlSpy are both ok with it, and can generate SOAP for it): http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:s="http://www.w3.org/2001/XMLSchema"; xmlns:wsdl="http:// schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.yourURI.com/ OfficeService" targetNamespace="http://www.yourURI.com/OfficeService";> http://www.yourURI.com/OfficeService"; elementFormDefault="qualified"> http://schemas.xmlsoap.org/soap/http"/> http://www.yourURI.com/OfficeService/ ListInterviews" style="document"/> http://www.yourURI.com/OfficeService/ Implementation.page"/> A consumer of that webservice should be able to form a SOAP request as follows: http://schemas.xmlsoap.org/soap/ envelope/"> http://www.yourURI.com/OfficeService";> STRING So when Flex tries to generate that response, it throws the above error. As far as I can tell, it throws the error no matter how you call the webservice operation (and I called it every which way I could with Flex!). However, when the wsdl is modified so: becomes name="ListInterviews"> and becomes Flex can encode the SOAP. Hopefully Adobe can get that fixed up, and people who are banging their head against a wall can change their WSDL (hopefully it is their own WSDL they're using) so the body element is the same as the operation name. -graphex
[flexcoders] Data Binding and Server Objects
If I'm getting objects from a web service and want to use them in data binding, do I have to re-create them in ActionScript in order for their various properties and sub-objects to be bindable? Ideally, I'd like to just "use what the server gives me" and not rewrite the objects in AS. i.e.: (in my ModelLocator) public static var userInfo:Object; (in my GetUserCommand) ModelLocator.userInfo = event.result[0]; (In my mxml) Is it possible to get this to work like that? or will ModelLocator need to have something like: public static var userInfo:UserVO; function ModelLocator() { ModelLocator.userInfo = new UserVO(); } class com.app.path.UserVO ... I'd rather avoid having to create all the server side objects on the client side; they come from the web service strongly typed, which is good enough for me, but does Flex need to have all of the bindable properties defined at complie-time for binding to work? Thanks, Sean 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] CFC Web Services and Boolean types in Flex
So we're trying to get a complex object with boolean properties in coldFusion to serialize into a complex object with boolean properties in Flex, but we keep getting wrongly typed results. Depending on the method we choose, we get a string value of "true" or "false" or a (case insensitive) string value of "yes" or "no". Has anyone been able to get complex objects in CF webservices to properly type booleans?Here is an example of what we're getting: lock falsebut we should get: lock false Any thoughts?(sorry this is a bit more about CF than flex, but actionScript is the more strongly typed language that cares about the difference between "false" and false!)Thanks,Sean McKibben 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] TreeDataProvider implementation
I believe that I need to write my own class which implements TreeDataProvider, but am finding the task a bit daunting. Has anyone written their own TreeDataProvider that would be willing to share it with me or the list? Is anyone aware of any articles about implementing TreeDataProvider? I don't find much comfort in the liveDocs explanation at: http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/ treeclasses/TreeDataProvider.html and Developing Flex Applications and "the book" don't really give many pointers either. If there was some sort of reference implementation I could peek at, I'd feel much better about heading down this path. It probably isn't all that difficult, but it is a big chunk of time to waste if I can't make it work... Thanks, Sean McKibben graphex at graphex 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] Re: TreeDataProvider implementation
I think the main reason I think I need to make my own TreeDataProvider is that the CF object persistence backend I'm integrating with requires that I send back deleted objects with a property, deleted=true. So there will be a bunch of objects which I don't want to show in my tree data with deleted=true. In my last tree I also had trouble where date objects were being appended to the label property, and I couldn't 'hide' anything in the 'data' object. I ended up writing a separate object to store my complex data, then parsing it into a simple object which is assigned to the tree. Any commands from the tree then just referenced the 'bigger' object by id values in a hash table. I don't think I can really do that this time, since it is pretty important for the tree's data source to actually have a bunch more information than is shown in the tree.What other options do I have? I hate to say it, but I find the documentation very confusing on using the Tree to represent and modify complex nested data structures. My main goal is to have my main value object be the one assigned to the tree, but with the flexibility to manage which folders are opened, what labels are shown, and what sub-objects are hidden.Thanks,SeanOn Jun 13, 2005, at 11:05 AM, alex_harui wrote: TreeDataProvider is advanced stuff. Why do you think you need your own? Give a little context and we'll see. We currently handle XML and object graphs pretty well. Also the code for two TreeDataProviders in shipped in Flash MX 2004 in mx\controls\treeClasses --- In flexcoders@yahoogroups.com, Sean McKibben <[EMAIL PROTECTED]> wrote: > I believe that I need to write my own class which implements > TreeDataProvider, but am finding the task a bit daunting. > Has anyone written their own TreeDataProvider that would be willing > to share it with me or the list? > Is anyone aware of any articles about implementing TreeDataProvider? > > I don't find much comfort in the liveDocs explanation at: > http://livedocs.macromedia.com/flex/15/asdocs_en/mx/controls/ > treeclasses/TreeDataProvider.html > and Developing Flex Applications and "the book" don't really give > many pointers either. > > If there was some sort of reference implementation I could peek at, > I'd feel much better about heading down this path. It probably isn't > all that difficult, but it is a big chunk of time to waste if I can't > make it work... > > Thanks, > Sean McKibben > graphex at graphex 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. 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] Design flaw in DataGrid sorting
I have to call the data grid's sorting mechanism flawed. Let's examine a case where you want to sort a dataGrid by a date column. In all likelihood, you're going to have a labelFunction to format your date objects into a string. Depending on your locale, that string is probably not what you want to sort on (i.e. 02/04/05 comes before 02/03/06 on the calendar, but not as a string), so you'd like to write a sortCompare function for that column. Unfortunately, the sortCompare function only receives the string value from the labelFunction, so you'd either have to do some very slow string parsing, or sort based on the results from the labelFunction alone. You don't get a chance to compare any more information about a row than the string returned by a labelFunction, and the labelFunction can only return a string. Not a good way to do it, Macromedia! So, what is the best workaround? Let it sort once, then resort using the headerRelease event and operating on the DataProvider? (assuming headerRelease fires after sorting is done - contrary to the documentation, but in line with Ailstair McLeod's tests) Sean 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] Flex serializer vs CF7 deserializer
x27;s request doesn't differ at all. I've also found that sending an object such as: var myObj:Object = new Object(); myObj.arrayTest = [{id:1},2,{name:"hi"}] can't be deserialized by CF, returning the errorstring, "org.xml.sax.SAXException: No deserializer defined for array type" This is driving me CRAZY (or maybe it is the heat). Is there a setting in the CFC that can be changed to make the SOAP that Flex delivers work? (I'm not the CF guy here, so my knowledge of that side of things is lacking, unfortunately) Thanks for your help, Sean McKibben graphex at graphex and 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] Flex serializer vs CF7 deserializer
Hmm, didn't seem to make any difference to what got sent. I might not be doing it right.I'm using cairngorm, and my delegate starts with: this.service = ServiceLocator.getInstance().getService( "objectWS" );(in the constructor)then the invocation has: service.stub.xmlEncoderConfig = new XMLEncoderConfig(); service.stub.xmlEncoderConfig.defaultObjectToMap = true;//also tried false var call:Object = service.wsSet('com.my.object.name', myObj);Do I set the xmlEncoderConfig on the service itself, or on the call object?Seems like it should do something different based on the value of defaultObjectToMap, but I'm not getting a change.ThanksSeanOn Jun 14, 2005, at 8:37 PM, Peter Farland wrote: I'm not familiar with the requirements for CFC SOAP invocation, but this is an unofficial work around that I've not tested but might work. Before invoking the MXML WebService's method, try changing the WebService's XMLEncoder's handling of Objects: import mx.services.*; //... snip // inside some invocation utility function myCFCWebService.stub.xmlEncoderConfig = new XMLEncoderConfig(); myCFCWebService.stub.xmlEncoderConfig.defaultObjectToMap = true; //... snip // then make the call 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 the Yahoo! Terms of Service.
Re: [flexcoders] Design flaw in DataGrid sorting
I think Mike Chambers' method of sorting (http://weblogs.macromedia.com/mesh/archives/2005/04/sorting_date_fi.cfm - similar to below) works pretty good, but it just seems wrong that you have to wait for the DataGrid to sort, react to the headerRelease function, which occurs after the sort and then resort again with your own algorithm. The sortCompareFunction would have been great if it would just return row data, similar to the labelFunction.Also, the LiveDocs say "headerRelease: Broadcast when a column header is pressed and released, indicating that a sort operation is about to occur." But I don't think this method would work if that were true. Good thing it happens after the sort!SeanOn Jun 15, 2005, at 3:48 AM, Dirk Eismann wrote: You can sort Date objects by sorting on their numerical getTime() value, i.e. private function sortColumn(evt:Object):Void { if (evt.target.sortDirection == "DESC") { var arrayFlags:Number = Array.DESCENDING; } else { var arrayFlags:Number = Array.ASCENDING; } evt.target.sortItems(sortByDate, arrayFlags); } public function sortByDate(itemA:Object, itemB:Object, flags:Number):Number { var a:Date = itemA.date; var b:Date = itemB.date; if (flags == Array.ASCENDING) { if (a.getTime() < b.getTime()) return -1; if (a.getTime() == b.getTime()) return 0; if (a.getTime() > b.getTime()) return 1; } else { if (a.getTime() < b.getTime()) return 1; if (a.getTime() == b.getTime()) return 0; if (a.getTime() > b.getTime()) return -1; } } id="dateGrid" dataProvider="{data}" headerRelease="sortColumn(event)" > Dirk. > -Original Message- > From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com]On > Behalf Of Sean McKibben > Sent: Tuesday, June 14, 2005 9:35 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Design flaw in DataGrid sorting > > > I have to call the data grid's sorting mechanism flawed. > > Let's examine a case where you want to sort a dataGrid by a date > column. In all likelihood, you're going to have a labelFunction to > format your date objects into a string. Depending on your locale, > that string is probably not what you want to sort on (i.e. 02/04/05 > comes before 02/03/06 on the calendar, but not as a string), > so you'd > like to write a sortCompare function for that column. > > Unfortunately, the sortCompare function only receives the string > value from the labelFunction, so you'd either have to do some very > slow string parsing, or sort based on the results from the > labelFunction alone. You don't get a chance to compare any more > information about a row than the string returned by a labelFunction, > and the labelFunction can only return a string. > > Not a good way to do it, Macromedia! > > So, what is the best workaround? Let it sort once, then resort using > the headerRelease event and operating on the DataProvider? (assuming > headerRelease fires after sorting is done - contrary to the > documentation, but in line with Ailstair McLeod's tests) > > > Sean > > > > > 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 the Yahoo! Terms of Service.
Re: [flexcoders] Collections between Flex and Web services
I'm running in to similar issues with webServices going to CF7 (see my "Flex serializer vs CF7 deserializer" posts). Something that I've found which aids troubleshooting is to look at the actual soap envelope which gets sent between the client and server.I've noticed that the SOAP encoding seems weird when an object contains another object or array. Instead of using and child tags, it will use tags. Still haven't found a workaroundSeanOn Jun 15, 2005, at 8:36 AM, cgobble wrote: Hello, I'm trying to return complex types with collections from a web service and everything seems to work fine. But, when I send the type as the input parameter for the web service, if there is only 1 item in the collection it does not get back to the web service. For instance, you have a Contact object in a dotnet web service. The Contact has a collection of phone numbers. I simply want to pass the entire Contact object back and forth between the web service and Flex. I create a method on the web service such as: (VB) Public Sub SaveContact(Contact as Contact) End Sub However, it seems that if I only have 1 phone number, the phone number gets lost in translation, even though the Contact info comes back correctly. I was able to partially fix this by making sure my collections were instantiated in the constructor, but if I nest a collection, it doesn't seem to work right. Any ideas?? 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 the Yahoo! Terms of Service.
[flexcoders] SOAP through a socket
Is there a way to invoke the SOAP deserializer to read in data from an XMLSocket connection? If my server sends an information push (in xml SOAP format) to all connected clients, I want them to get the data that is broadcast in object form, just as if the XML had been sent through a webservice result. Any ideas for manually invoking the deserializer with either an XML string or a XML object? Thanks, Sean McKibben -- 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] Sort arrows in DataGrid
Is there a way to set the sortIndex of a datagrid manually, or to manually clear the sort arrow? I have a DataGrid which allows things to be dropped in to it at arbitrary locations, which would change it to unsorted, but I can't figure out how to remove the sort arrow in the header to reflect the unsorted state. Also, is there a way to determine what the current sort order of a column is? It seems like each column keeps its own sort direction separately, so I've had luck just keeping my own array for sort order flags, but there is a chance that the two separate records will get out of parity, given the above case. Keep in mind that I'm doing entirely custom sorting of the datagrid's provider on the headerRelease event. (by setting sortableColumns="true" on the grid, and sortable="true" and sortOnHeaderRelease="false" on the columns) Thanks, Sean -- 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] Sort arrows in DataGrid
All these things have been discussed in past. Please search the archiveswith appropriate keywords to find those threads.Maybe these things belong in the documentation? Maybe in the FAQ?Note: a search for "sortArrow" at the site you provided yielded no results (then again if I knew there was a property called sortArrow, I wouldn't have needed to ask the question). A search in my own (unfortunately incomplete) flexcoders archives for "sortArrow" revealed nothing, a search for "sort" revealed too many hits (217), "sort direction" revealed 7 hits, none of which answered my question.I really think you folks did a great job with flex in general, but I am too frequently frustrated by the documentation... or the lack thereof. My project's deadline is coming up way too fast, and the holes in the documentation cost me many hours each week!I'm just hoping things continue to improve... I know it is only version 1.5. Perhaps I'm just used to Microsoft's excellent documentation for .net 1.1. Thank god you guys aren't Microsoft. Can you be more like Microsoft? (I know, I'm never satisfied ;)SeanOn Jul 2, 2005, at 1:09 PM, Abdul Qabiz wrote: Hi, You can get the reference of sort arrow using: dataGridInstance.sortArrow To hide arrow: dataGridInstance.sortArrow._visible = false; To show arrow: dataGridInstance.sortArrow._visible = true; You can use dataGridInstance.placeSortArrow(..) method to show arrow on column that is the current sortIndex. To sort a column( or set the sortIndex) you can call: dataGridInstance.sortItemsBy(fieldName, order) : VoidTo determine current sorting order, use dataGridInstance.sortDirection property. It returns either 'DESC' or 'ASC All these things have been discussed in past. Please search the archives with appropriate keywords to find those threads. http://www.mail-archive.com/flexcoders%40yahoogroups.com-abdul -Original Message----- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Sean McKibben Sent: Saturday, July 02, 2005 11:50 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Sort arrows in DataGrid Is there a way to set the sortIndex of a datagrid manually, or to manually clear the sort arrow? I have a DataGrid which allows things to be dropped in to it at arbitrary locations, which would change it to unsorted, but I can't figure out how to remove the sort arrow in the header to reflect the unsorted state. Also, is there a way to determine what the current sort order of a column is? It seems like each column keeps its own sort direction separately, so I've had luck just keeping my own array for sort order flags, but there is a chance that the two separate records will get out of parity, given the above case. Keep in mind that I'm doing entirely custom sorting of the datagrid's provider on the headerRelease event. (by setting sortableColumns="true" on the grid, and sortable="true" and sortOnHeaderRelease="false" on the columns) Thanks, Sean -- 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 -- 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 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] Reorder tree via dragging
So I'm trying to make a tree which can reorder its nodes by dragging them. One of the things I wanted to do is prevent a parent item from being dragged on to any of its children, and to show that during the dragOver event. In order to calculate whether the source is being dragged on to any of its offspring, I've been comparing the event.dragSource.dataForFormat("treeItems") first to firstValue=event.target.getDropParent().getTreeNodeAt (event.target.getDropLocation()) then recursively to the parents of firstValue. This apparently doesn't work because dataForFormat seems to hand me a copy of the items being dragged instead of an actual reference, so the two values are never equal. I did note that the items that dataForFormat give me, do contain references to the real parents, data and other objects, it is just that the items themselves are copies for some reason. What I ended up doing is something like the following: if(checkParentDrop(myowncustom.TreeUtils.findDataItemNode (view.TemplateAssemblyTree, dragItems[i].getData()) , event.target.getDropParent().getTreeNodeAt (event.target.getDropLocation( action = DragManager.NONE; private function checkParentDrop(source, node):Boolean { if(source == node) return true; if(node.getParent()!=null) return checkParentDrop(source, node.getParent()); else return false; } public static function findDataItemNode(tree:mx.controls.Tree, o:Object):TreeNode ... recursively check the entire tree for the same getData() reference ... So basically instead of comparing items from event.dragSource.dataForFormat("treeItems"), i have to recursively look them up by the reference they contain to their getData() information, to get the actual reference to the TreeNode which I then compare to the drop target and its ancestors for referential equality. This is horribly ugly, but it works. Is there a better way that people have stumbled across to validate tree->self drags? I wish that dataForFormat handed over references instead of copies! (sorry if this was discussed before; I'm apparently bad at finding previously discussed topics in this list!) Sean -- 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] Reorder tree via dragging
So, what I've ended up using is the dataForFormat("source") when the dragSource is a tree, which gets a reference to the tree. Once you have that, the actual items being dragged will be the selectedNode or the selectedNodes, depending on whether or not the tree allows multiple selection. So if you do (selectedNode == event.target.getDropParent().getTreeNodeAt (event.target.getDropLocation()) it will return true if they are, in fact, the same node. Is anyone aware of a published list of what the various dataForFormat strings are in the components that ship with flex? Thanks, Sean On Jul 7, 2005, at 12:13 PM, Matthew Shirey wrote: > As I am currently working with this, I can say that dataForFormat > ("source") will give you a reference to the source object of the > drag drop operation. I am not sure about the "items" one though. > I've read mixed documentation, some say its "treeItems". Any rate, > there's a formats array in the event object that you can itterate > through and see all of the available formats if needed. > > M. > > On 7/6/05, Matt Chotin <[EMAIL PROTECTED]> wrote: > I think dataForFormat("items") or dataForFormat("source"), not sure > which is valid for Tree, might give you the original items as > opposed to the copies. > > > Matt > > > From: flexcoders@yahoogroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Sean McKibben > Sent: Wednesday, July 06, 2005 1:17 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Reorder tree via dragging > > > So I'm trying to make a tree which can reorder its nodes by dragging > them. One of the things I wanted to do is prevent a parent item from > being dragged on to any of its children, and to show that during the > dragOver event. > > In order to calculate whether the source is being dragged on to any > of its offspring, I've been comparing the > event.dragSource.dataForFormat("treeItems") first to > firstValue=event.target.getDropParent().getTreeNodeAt > (event.target.getDropLocation()) then recursively to the parents of > firstValue. > > This apparently doesn't work because dataForFormat seems to hand me a > copy of the items being dragged instead of an actual reference, so > the two values are never equal. I did note that the items that > dataForFormat give me, do contain references to the real parents, > data and other objects, it is just that the items themselves are > copies for some reason. > > What I ended up doing is something like the following: > > if(checkParentDrop(myowncustom.TreeUtils.findDataItemNode > (view.TemplateAssemblyTree, dragItems[i].getData()) > , event.target.getDropParent().getTreeNodeAt > (event.target.getDropLocation( > action = DragManager.NONE; > > private function checkParentDrop(source, node):Boolean > { > if(source == node) > return true; > if(node.getParent()!=null) > return checkParentDrop(source, node.getParent()); > else > return false; > } > > > public static function findDataItemNode(tree:mx.controls.Tree, > o:Object):TreeNode > ... recursively check the entire tree for the same getData() > reference ... > > So basically instead of comparing items from > event.dragSource.dataForFormat("treeItems"), i have to recursively > look them up by the reference they contain to their getData() > information, to get the actual reference to the TreeNode which I then > compare to the drop target and its ancestors for referential equality. > > This is horribly ugly, but it works. Is there a better way that > people have stumbled across to validate tree->self drags? I wish that > dataForFormat handed over references instead of copies! > > (sorry if this was discussed before; I'm apparently bad at finding > previously discussed topics in this list!) > > Sean > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders% > 40yahoogroups.com > > > > > > -- > 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:/
[flexcoders] guid/uuid generation
Is anyone aware of a guid generation system for flex/flash? I'm building a system which does quite a bit on the client before a trip to the server, and it needs to make some references amongst objects that the server can understand, so a real guid generator would be the best way to do that.I know I could probably use math.random() to generate a random number and try to use that as a guid, but this is an enterprise app here, and there are rules for guids which we'd need to conform to.Ideally, the the UUID version 5, using SHA-1 would be my preference. Anything at least pretty robust which could come up with the format, "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}" would be useful.Anyone else come across a solution for this?Thanks,Sean -- 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.
Re: [flexcoders] Re: guid/uuid generation
Thanks Andrew & Clint. Oddly enough, within about 5 minutes, I:a)finished building my own class to do it (converting Branden Hall's SHA-1 algorithm to AS2)b)received Clint's classd)received Andrew's linkTook longer to research than to write the class, once I found an AS SHA-1 algorithm.I just generated 50k uuids using SHA-1 hashes made from a namespace, the results of new date() and an incrementor. Probably overkill, but but I learned:a)flash can handle really big hash tablesb)I'm not going to win the lotteryc)I've forgotten much of my discrete math class in collegeI'm going to put in a request for MM to include a uuid generator. Seems to make sense given the nature of RIA that new object generation is going to occur mostly on the client, so why not have these things available. Even better why not have them compiled in the player?? (come on, it'd be less than 1k)Thanks againSeanOn Jul 13, 2005, at 6:14 PM, Andrew Spaulding wrote: Hey Sean, Check out ASCrypt at http://www.meychi.com/archive/31.php It has the following classes: Base8, Base64, Goauld, LZW, GUID, RC4, MD5, SHA1, ROT13, Rijndael and TEA. I have used the GUID class at it creates exactly what you are after. Also it is all written in Actionscript 2.0 cheers, Andrew Spaulding www.flexdaddy.info--- In flexcoders@yahoogroups.com, Sean McKibben <[EMAIL PROTECTED]> wrote: > Is anyone aware of a guid generation system for flex/flash? I'm > building a system which does quite a bit on the client before a trip > to the server, and it needs to make some references amongst objects > that the server can understand, so a real guid generator would be the > best way to do that. > > I know I could probably use math.random() to generate a random number > and try to use that as a guid, but this is an enterprise app here, > and there are rules for guids which we'd need to conform to. > > Ideally, the the UUID version 5, using SHA-1 would be my preference. > Anything at least pretty robust which could come up with the format, > "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}" would be useful. > > Anyone else come across a solution for this? > > Thanks, > Sean -- 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 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] Reverse-binding repeater items
So, I attempted the following: It works if I don't use the mx:Binding expression, if I do use it, the first item doesn't work so good, but successive items seem to work. I'm guessing this falls into the category of binding to dynamically generated elements. What is the 'right' way to do this? Should I just use a viewHelper to handle each Prerequisite's change event to update the model? Sometimes it seems easier to just do everything in actionscript... but that is just because mxml is still pretty foreign to me... Sean Yahoo! Groups Sponsor ~--> http://us.ard.yahoo.com/SIG=12hc5ekr4/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1123119820/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!. ~-> -- 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] OH, For the love of all that's good, please help!
I ran into this as well. Looking at the SOAP encoded message, it appeared to me that flex wasn't making clean SOAP (pun definitely intended).When we switched over to using the CFC's RemoteObject instead of the WebService, things started working again. Wasn't too hard of a switch, and I'll take the NetConnectionDebugger over paging through SOAP any day. (still wish webservice serializing worked better...)See my "Flex serializer vs CF7 deserializer" post thread or the "Collections between Flex and Web services" thread for some possible workarounds that didn't work for me...Sean McKibbenOn Aug 23, 2005, at 10:29 AM, bsd wrote: I'm passing an array from Flex to a web service located in a CFC. It returns an error that states: "org.xml.sax.SAXException: No deserializer for array type" -- 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.
Re: [flexcoders] Cairngorm .99 VO Question
I am not sure what the best practice is, but I often bind UI items directly to objects in my model - sometimes a particular instance might be bound to multiple controls both inbound and outbound. Because of this, sending the objects in my model directly to a remote service could suffer from the "bound properties disappear" bug in flex. So I typically treat VO objects sort of like a railroad car to dump things into.For example, I might have a Person class which encapsulates some data in my model. I'll make a Person.ReturnVO object which just takes the public properties from that instance and copies them to a PersonVO object, which I then send separately. Since PersonVO is just a subset of a Person object, I sometimes just pass over a copied object, but I try never to pass over the actual object that I'm using on the client side, always a copy.I'm not sure this is really a best practice, but it does get around the disappearing properties bug in Flex, so it works for now. I think that IterationTwo tends to stay a bit farther back from encapsulation than I do, but I like having intelligent objects for my commands to get/set values from/to.SeanOn Sep 15, 2005, at 10:02 AM, dave buhler wrote: Hello Everyone, I had a question regarding best practices when passing over my valueobjects. In Short, I've been alternating between two ways of referencing the VOs properties: 1) assigning the VO as a new object in my command, and passing over this new object or new object's props to my Delegate as a parameter 2) just importing the VO directly into the delegate and referencing the VO's properties when I pass it over to my CFC. What is considered best practice when working with the commands and delegates with regard to specifying props of my ValueObjects? Where should it be done? Dave -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYAHOO! 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 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] dispatchEvent in AS class?
I'm trying to wrap an XMLSocket object in a singleton class to manage my (single) XMLSocket connection, but I can't seem to get it to throw any events. Is it that I need to put it into my .mxml file as a component or something? Right now it is just an actionScript class. I was wanting to stick to the cairngorm framework's delegate model, but my SocketManager actually initiates commands from the server it is connected to (the whole point of my XMLSocket) so this class will need to dispatch a bunch events, preferably using the addEventListener+dispatchEvent model. Whenever the socket connection succeeds, I get my "SocketManager: Socket connection attempt succeeded" trace statement, then I get a warning which says "Warning: dispatchEvent is not a function" which leads me to believe that the EventDispatcher voodoo I'm doing in my constructor isn't working. Is it possible to send events like this? Any help is appreciated. Thanks, Sean McKibben (code below) import com.iterationtwo.cairngorm.business.*; import mx.utils.Delegate; import mx.events.*; [Event("onSocketOpen")] [Event("onSocketClose")] class com.client.capture.business.SocketManager extends MovieClip //(also tried extending mx.core.UIObject and nothing) { public static var socketManager:SocketManager; private static var mySocket:XMLSocket; private static var isSocketConnected:Boolean = false; public var addEventListener:Function; public var removeEventListener:Function; private var dispatchEvent:Function; public function SocketManager() { if ( SocketManager.socketManager != undefined ) throw new Error("Only one SocketManager should be instantiated"); SocketManager.mySocket = new XMLSocket(); SocketManager.mySocket.onConnect = handleConnect; SocketManager.mySocket.onClose = handleClose; SocketManager.mySocket.onXML = handleIncoming; SocketManager.socketManager = this; var sm:Object = SocketManager.prototype; EventDispatcher.initialize(sm);//also tried UIEventDispatcher.initialize } public static function getInstance():SocketManager { if(SocketManager.socketManager == undefined) SocketManager.socketManager = new SocketManager(); return SocketManager.socketManager; } public function connect() { if(!SocketManager.isSocketConnected) { if (!SocketManager.mySocket.connect("localhost", 1249))//<--INSERT PORT # HERE!! throw new Error("SocketManager: socket connection attempt failed early"); } else throw new Error("SocketManager: connect method called while connected"); } public function disconnect() { if(SocketManager.isSocketConnected) { SocketManager.mySocket.close(); SocketManager.isSocketConnected = false; trace("SocketManager: closed socket"); } else throw new Error("SocketManager: disconnect method called while not connected"); } private function handleConnect (succeeded) { if(succeeded) { trace("SocketManager: Socket connection attempt succeeded"); SocketManager.isSocketConnected = true; dispatchEvent({type:"onSocketOpen"}); } else { throw new Error("SocketManager: Socket connection attempt failed"); } } private function handleClose () { trace("SocketManager: server closed connection"); SocketManager.isSocketConnected = false; dispatchEvent({type:"onSocketClose"}); } private function handleIncoming (messageObj) { // display the received xml data in the output window trace(">>" + messageObj.toString() + "<<"); } } then, in other objects i have SocketManager.getInstance().addEventListener("onSocketOpen", mx.utils.Delegate.create(this,onSocketOpen)); but it never gets called... Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: dispatchEvent in AS class?
> You need access to the EventDispatcher, which is natively mixed in > with any > UIObject subclass (which is why all MXML components can use it. > You can either subclass your class from UIObject, or initialize the > Event > Dispatcher with your class. The latter would look like this: > import mx.events.EventDispatcher; > function YourConstructor(){ > EventDispatcher.initialize(this); > } I tried that (just as you typed it), and a variation of that is in my example code: > > var sm:Object = SocketManager.prototype; > > EventDispatcher.initialize(sm);//also tried > UIEventDispatcher.initialize and EventDispatcher.initialize(this) I still get the weird warning when my class tries to call dispatchEvent that says "Warning: dispatchEvent is not a function". Any more ideas? Thanks, Sean McKibben > > At 05:49 PM 4/29/2005, you wrote: > >I'm trying to wrap an XMLSocket object in a singleton class to manage > >my (single) XMLSocket connection, but I can't seem to get it to throw > >any events. Is it that I need to put it into my .mxml file as a > >component or something? Right now it is just an actionScript class. > >I was wanting to stick to the cairngorm framework's delegate model, > but > >my SocketManager actually initiates commands from the server it is > >connected to (the whole point of my XMLSocket) so this class will > need > >to dispatch a bunch events, preferably using the > >addEventListener+dispatchEvent model. > > > >Whenever the socket connection succeeds, I get my "SocketManager: > >Socket connection attempt succeeded" trace statement, then I get a > >warning which says "Warning: dispatchEvent is not a function" which > >leads me to believe that the EventDispatcher voodoo I'm doing in my > >constructor isn't working. Is it possible to send events like this? > > > >Any help is appreciated. > > > >Thanks, > >Sean McKibben > > > >(code below) > > > >import com.iterationtwo.cairngorm.business.*; > >import mx.utils.Delegate; > >import mx.events.*; > >[Event("onSocketOpen")] > >[Event("onSocketClose")] > >class com.client.capture.business.SocketManager extends MovieClip > >//(also tried extending mx.core.UIObject and nothing) > >{ > > public static var socketManager:SocketManager; > > private static var mySocket:XMLSocket; > > private static var isSocketConnected:Boolean = false; > > > > public var addEventListener:Function; > > public var removeEventListener:Function; > > private var dispatchEvent:Function; > > > > public function SocketManager() > > { > > if ( SocketManager.socketManager != undefined ) > > throw new Error("Only one SocketManager should be > > instantiated"); > > SocketManager.mySocket = new XMLSocket(); > > SocketManager.mySocket.onConnect = handleConnect; > > SocketManager.mySocket.onClose = handleClose; > > SocketManager.mySocket.onXML = handleIncoming; > > SocketManager.socketManager = this; > > var sm:Object = SocketManager.prototype; > > EventDispatcher.initialize(sm);//also tried > >UIEventDispatcher.initialize > > } > > public static function getInstance():SocketManager > > { > > if(SocketManager.socketManager == undefined) > > SocketManager.socketManager = new SocketManager(); > > return SocketManager.socketManager; > > } > > public function connect() > > { > > if(!SocketManager.isSocketConnected) > > { > > if (!SocketManager.mySocket.connect("localhost", > > 1249))//<--INSERT > >PORT # HERE!! > > throw new Error("SocketManager: socket connection > > attempt failed > >early"); > > } > > else > > throw new Error("SocketManager: connect method called > > while > >connected"); > > } > > public function disconnect() > > { > > if(SocketManager.isSocketConnected) > > { > > SocketManager.mySocket.close(); > > SocketManager.isSocketConnected = false; > > trace("SocketManager: closed socket"); > > } > > else > > throw new Error("SocketManager: disconnect method > > called while not > >connected"); > > } > > private function handleConnect (succeeded) { > > if(succeeded) { > > trace("SocketManager: Socket connection attempt > > succeeded"); > > SocketManager.isSocketConnected = true; > > dispatchEvent({type:&qu
[flexcoders] XMLObjectOutput bug
I think that the trObj method of XMLObjectOutput.as has as problem where it keeps doubling the size of its internal __stack variable with each new object it has. The section which has: // verify that we have not already seen this object if(obj instanceof Array || obj instanceof Function || obj instanceof MovieClip || obj instanceof Object) { var len = __stack.length; // walk the stack and look for matches for(var i = 0; i < len; i++) { if(obj == this || __stack[i] == obj) { // we have a match, get out var nSpace = " " + spacer; trace(spacer + " [self reference - will not trace]"); return; } else { // not found, add it to the list __stack.push(obj); } } } seems like it would add the object to the stack each time it iterates through the for loop unless the particular object it is searching for happens to be the one it is testing in that iteration. This seems to be the cause of the problem where the __stack array grows geometrically in size. If you're using this to trace objects with any depth, __stack.length very quickly gets up in to the thousands, self reference or not. Changing that section of code to: // verify that we have not already seen this object if(obj instanceof Array || obj instanceof Function || obj instanceof MovieClip || obj instanceof Object) { var len = __stack.length; // walk the stack and look for matches for(var i = 0; i < len; i++) { if(obj == this || __stack[i] == obj) { // we have a match, get out var nSpace = " " + spacer; trace(spacer + " [self reference - will not trace]"); return; } } // not found, add it to the list __stack.push(obj); } seems to do the trick, although I wonder if there is a way to do this with hash tables instead of iterating through a numbered array? Is there a way of generating hash codes or using an object reference as a key? Sean McKibben [EMAIL PROTECTED] 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] Cairngorm 0.99
I'm having some trouble getting my Services.mxml to work with .99.I keep getting errors like:Error /com/cadpo/shared/business/Services.mxml:4Namespace http://www.iterationtwo.com/cairngorm has not been associated with component manifest.Error /com/cadpo/shared/business/Services.mxml:4No type for element "http://www.iterationtwo.com/cairngorm:ServiceLocator"Error /com/cadpo/shared/business/Services.mxml:4Unexpected root element "http://www.iterationtwo.com/cairngorm:ServiceLocator" does not extend MovieClipI put the cairngorm-manifest.xml into the WEB-INF/flex directory, but it still doesn't want to eat it.Here is the first part of my Services.mxml:http://www.macromedia.com/2003/mxml" xmlns:cairngorm="http://www.iterationtwo.com/cairngorm"> ...Is the xmlns:cairngorm="http://www.iterationtwo.com/cairngorm" attribute correct? I copied it out of one of the sample apps included in .99.Any ideas?Thanks,Sean McKibben 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.