[flexcoders] Re: Caching issue in HTTPService
Hi Brent, --- brent_trx [EMAIL PROTECTED] wrote: I've written a CachedHTTPService which extends mx.rpc.http.mxml.HTTPService to implement a caching mechanism, if you ever wanted to force custom-caching of data. It behaves exactly like the standard HTTPService in declaration and all that, transparently retrieving cached data if it's available, passing it along as the result, otherwise calling the service as it was intended upon send(). snip If anyone is interested, I can post the source in the next couple of days. Count me as interested. -David
[flexcoders] Re: mxmlc can't find embed source in different -source-path. Bug?
Without looking at any documentation, I'd guess that the '/' at the start of myasset's path specifies an absolute url (not relative to current folder or search paths), and as such is being looked for at the root. --- seriousbraincancer [EMAIL PROTECTED] wrote: Here's an example. If I put my files in the following directories: ./src/Test.as ./assets/myasset.swf Where Test.as is embedding the asset with the following path: [Embed(source='/myasset.swf')] private var Asset:Class;The documentation says that it first looks for the swf in the same directory as Test.as then it moves on to other source paths if it can't find it there. However, when I compile this code, I get the following error: Error: unable to resolve '/myasset.swf' for transcoding
[flexcoders] Re: Flex Reflection
For ECMAScript in general (Javascript and ActionScript) you'd use a for..in loop to iterate over the properties (including methods) of an Object. ActionScript changes for..in to only work over the dynamic properties of an Object instance. The docs say: To get a list of fixed properties, use the describeType() function, which is in the flash.utils package. -David. --- In flexcoders@yahoogroups.com, Andr� Rodrigues Pena [EMAIL PROTECTED] wrote: Hi all, I'm wondering if Flex has some mechanism for dynamically calling methods and setting properties. I mean, I don't know the name of the method or the property at compile time. Something like Java Reflection. Thanks -- Andr� Rodrigues Pena LOCUS www.locus.com.br
[flexcoders] Re: Make datagrid into spreadsheet
How much like a spreadsheet do you want it to be? If you just want every cell to be editable, does setting the 'editable' attribute on the DataGridColumn to 'true' not do the trick for you? If you wish to implement formulas and automatic 'trickle-on' updating of cells references in formulas you have a number of problems: 1) you'll need to customise your itemRenderer so that a) each cell represents an object containing a formula and the current value of the cell, and b) when the event that represents when the cell's content has changed is fired, you begin a recursive evaluation of the formula (with respect to referenced cells and their formulae). 2) eval() has been removed from ActionScript 3.0, so you'll need to implement a parser and evaluation engine for whatever language you choose for formulas. 3) you'll probably need to implement cycle-detection to prohibit infinitely (possibly mutually) recursive formulae (or implement laziness/iterators if you support that). 4) you'll probably need to break up the evaluation into blocks of work (some recursion wrapper using a counter and callLater) to ensure that the user interface is updated often enough. -David --- In flexcoders@yahoogroups.com, Mark Ingram [EMAIL PROTECTED] wrote: Hi, I want to be able to type into any row of a datagrid and enter new data. How easily can this be done? Mark
[flexcoders] Re: Make datagrid into spreadsheet
Wow, that post looks quite unreadable. Does this forum allow any code of literal (or fixed width) formating ? -David
[flexcoders] Re: Make datagrid into spreadsheet
I think you just need to set editable to true on the DataGrid and on the DataGridColumn's. --- In flexcoders@yahoogroups.com, Mark Ingram [EMAIL PROTECTED] wrote: Hi, thanks for the response. I meant like a spreadsheet as in I can type into any cell I like. If you just imagine I have a data provider setup with {Monday, 1}, {Tuesday, 2}. The data grid will contain 2 rows (and 2 columns). How can I get it so that I can click on the 3rd row and just type Wednesday? I hope you see what I mean. I would just like to click on any cell and edit the contents. Cheers, Mark
[flexcoders] Re: Make datagrid into spreadsheet
Well, if you think about it, that makes sense. Where is the empty row when the rows overflow the height of the DataGrid container? Either add and maintain a pseudo item in the dataProvider (which appends a new Object when edited), or add some button/widget near your DataGrid which appends an Object to the dataProvider, forces an update, selects focuses the new row, goes into edit mode, and focuses the first DataGridColumn. --- In flexcoders@yahoogroups.com, Mark Ingram [EMAIL PROTECTED] wrote: No, that just allows you to edit data that is currently entered (it doesn't allow you to enter new data in an empty row). Cheers, Mark
[flexcoders] Re: Actionscript SAX Parser ?
--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote: I'd be interested to know what your use case is that requires a SAX parser. In my application, I had two list/search forms which: * query billing-related events (fairly static) * query/rank/prioritise tickets in a ordering/support system In both cases, there can be anywhere between 200 and 50,000 rows returned from a database for each query, sent to the Flex client via SOAP. (That number could grow to 100,000 in three years.) It's *not* useful to have paged views of that many results in the client application; it makes it much more difficult for the user to skim the records and have a good mental picture of what has occurred in the back-end systems. Also, the user wants to type/customise a query, and expects to get back *something* within 1 second, even if the full results take much longer to arrive. How large is your XML? Did you run into a memory or performance problem with AS3's E4X capabilities? AS3 on my laptop (Athlon64-2700, WinXP, Firefox 2, non-debug) takes 70 seconds to retrieve the full SOAP response (5 rows, 8 variable length string columns - about 14MB - over 1-3mbit broadband). I assume about 1 second of error in this measurement because I could only measure when the server stopped sending data. After the response has been fully sent, the Flex client takes 10-12 seconds (seems to depend on system memory utilisation) to parse, E4Xify, bind and update that data into a very simple DataGrid component. The performance of the DataGrid component is actually pretty damn good (even with 10,000+ rows)... no complaints there. I'm *not* complaining about the AS3 E4X parser's performance... it's remarkable that it does it that fast (my perl client using a c-based XML parser library only does it 3.5 times faster on average). I realise that my example is extreme, but in *many* use cases the data takes quite a bit longer to download than to parse... if the whole document must be parsed, an unacceptable amount of time elapses between sending the query, and getting something back to the user. The second important issue is memory usage. Very unscientific viewing of the task manager leads me to believe that the Flash plug-in allocates about 34MB while parsing the XML response. 34MB is not so bad when objectifying a document of that size... but it does have a large performance impact... it makes *much* more sense to parse the document with a constant 4-12kbyte buffered approach. - I'd skip this part if I were you - Years of service software development has led me to construct my service APIs so that they return data in a streaming fashion - whether the client supports it or not - because it provides much greater flexibility in how that data is used by different client applications. All databases in almost all server-side languages have APIs allowing the user to perform a query then iterate over the result set, only retrieving each row from the database as it is needed. It is well accepted that this results in much higher performance for non-trivial amounts of data. Web-service (say SOAP) libraries that allow streaming are relatively new, but have been available to Java developers for at least 5 years, and to Python developers for at least 3 years. (I use Perl... I actually had to modify SOAP::Lite to make streaming work). --- Basically, with large amounts of data if you retrieve the full response it takes too long to finish and allocates too much memory... both degrade the user experience. -David.
[flexcoders] Re: Actionscript SAX Parser ?
The XML4JS SAX Parser seems to be written pretty reasonably... I think I'll have a go at automatically porting it to AS3.0 with a Perl script. If it works at all, I'll continue by doing some profiling, then fill out the API a little. I don't need much working for my purposes. -David --- In flexcoders@yahoogroups.com, Peter Hall [EMAIL PROTECTED] wrote: Just last week, I had an unsuccessful look around for an AS3 SAX parser. I thought about making one myself, but couldn't justify the time to fit inside the project schedule. Peter
[flexcoders] Re: Socket Connection to Port 80 on Serving Host
Why do I need to implement an XMLSocket server, to open a Socket to a service on my server that isn't an XMLSocket service? Why can't it get the information it needs from an HTTP resource? It would seem that the Flash designers/implementors thought that perhaps the ubiquity of the Flash plug-in for deployed web browsers is such that unfettered server access could promote a market for bot/drone developers and privacy eroding spyware/malware. I can't really see it myself. I guess they thought that Flash would not be as widely deployed if there was any sort of media noise related to security problems it might cause for the user. It seems as though the intent is to prevent the Flash player from communicating, using Sockets, to any standard HTTP server setup (port 80 open, nothing else). Why? Any standard HTTP server or mail, or DNS, or other server on its standard (low) port. The only option seems to be to write your own generic TCP proxy, then host it on your own bandwidth... sigh. That certainly does cut down the usefulness of Flash as an application platform. In the past, I've deployed a Flex app on XULRunner and used the XPCOM socket apis. Very fragile, hard to debug, and seemingly pointless. I see it as a show-stopper (in consideration of Flash) for small projects that require decent access to external resources (sans hosting bandwidth)... I just have to use another language for those projects. -David.
[flexcoders] Actionscript SAX Parser ?
Hi Flex Folks, Is there a purpose-built incremental SAX Parser component available for ActionScript? Some background (please excuse the novella): In a Flex project I shipped about 4 months ago, I needed to accommodate a web-service that can sometimes return a large amount of data. I saw that many people recommend modification of the service (or creation of an intermediate proxy) such that results are paged. For that specific project, it turned out that I could actually modify the service to produce paged output (as I had written the web-service earlier)... but I was left feeling very uncomfortable about that as a solution for a number of reasons. In most cases, I would not have the ability to alter the web-service, so I'd be forced to create a proxy service... but this has many disadvantages, the worst being that I'd have to make (a lot of) bandwidth available for the proxy to run from my own servers, despite all the data being available from third-party web-services; this has ongoing cost implications for similar projects. I found that with server-side paging, the user experience was degraded unless I also created a paged DataGrid in my Flex UI. This was a clumsy exercise as I could find no pre-built data-bound paging component independent of any existing UIComponent. My users also reported that client-side paging is very inconvenient for large datasets (I tried various page-set sizes). I did not ship a useful feature (drag and drop re-ordering of rows) as there was no way (without getting insanely complicated during drag) to drop a bound row to three pages ago near the bottom. What I *really* wanted was something I've come to rely on in past years: an incremental SAX parser. This is really standard fare in Perl/Python/Java/.Net/C++, so I'd have thought something similar was available for ActionScript. A SAX parser in combination with a WebService object and a Socket object could form a very flexible event-based WebService-like component. Alas I found nothing. The closest I came was the SAX parser included in a href=http://xmljs.sourceforge.net/;XML4Script/a; while it was ECMAScript, it looked quite tedious to port/integrate. I didn't have the time before, but I can see that it will be immensely useful in the future. An event-based parser: * offers much more flexibility in Flex UI development, * allows me to provide almost instant results/feedback to the user, * uses constant memory (a requirement for large result-sets). The SAXWebService could be a subclass of WebService, exposing another result-like event matchRow, but would return a fragment/object for each matched row in the returned XML data and would do so as soon as enough data has been received from the SOAP endpoint. All the other pieces are there; here's how a SAXWebService would work: 1. Create a WebService object internally to fetch, validate and instantiate WSDL, and to obtain an endpoint. 2. Take some user supplied matchRow query (XPath) to match a row. 3. During the send method, open a seperate Socket connection. 4. Get the URLRequest from the WebService object, serialise and send to the endpoint over the socket. 5. Set up an event FSM such that when data is received from the socket it is buffered. 6. A SAX event handler is written to match the available data against the match query. 7. The SAX parser is fed the buffer (or perhaps an offset portion of the buffer), which it parses as data becomes available. 8. The SAX parser will raise an event each time the query matches. The buffer can be optionally truncated (instead of using an offset) to enable constant-memory operation. Am I missing some wonderful existing prior art? Has no other developer requested this before? If not, I guess I'll have to find time to write it. -David.
[flexcoders] Anyone doing the XULRunner + Flex thang ?
Hi Folks, I have some experience deploying XULrunner applications (standalone not .xulapp type). I've found XULrunner to be preferable to Apollo (as it stands) for various kinds of non-Flash interaction with the host system and the user. I noticed some interest in a SWFRunner project at http://osflash.org/pipermail/osflash_osflash.org/2006-February/007659.html but it looks like this has not really developed any further. Is anyone else doing this? Care to share your experiences? One of the major concerns in that thread was that one can't distribute the Flash plug-in without a license from Adobe (fair enough). My *ugly* *hack* work-around was to also ship the useIEforThisFrame FireFox extension and have the Flex application run in the IE frame. That way, in the unlikely event that the user does not have the Flash ActiveX component installed on their system (or has version 8 or below), the standard install plugin page appears and the user can continue by installing it then moving on (didn't need to restart XULrunner). I feel sick re-living this tale of woe. Is is legal/ethical to detect flash (presence/version) in XULRunner and - if not found - download and install the NSplugin version of the Flash plug-in? Perhaps if a normal browser window was launched to take the user to the appropriate page on the Adobe's website automatically (where they can accept the license terms)? -David.
[flexcoders] Re: Actionscript SAX Parser ?
Nobody on this high-volume list wants/needs a SAX parser? Thats just crazy. I'm going back to .NET ;)
[flexcoders] Remove a state from a component at run-time ?
I've written a small view-switching component that is based on mx:Canvas: CanvasSwitcher. It's set up so that if a child UIComponent is added to it at runtime (eg: via mx:AddChild in an mx:State), a new mx:State is automatically added to the CanvasSwitcher instance. The added state is also supplied with an eventListener for the enterState event, such that when the CanvasSwitcher instance's currentState property is set to be equal to the appropriate child UIComponent's id property, that UIComponent's visible property will be set; all others unset. This works well, looks quite declarative, and has helped to make my current project's interface quite flexible at runtime. The problem is that to be truly useful, I need to be able to add a child, remove it some time later, then re-add it. To do that I need to be able to remove a state from the CanvasSwitcher via ActionScript. Can that be done? (I could not see a way in the documentation.) Is this all too crazy? Background: I wanted something quite a bit more flexible than the mx:ViewStack component. Particularly, I envisage being able to group UIComponent instances under additional meta display states, and to re-group them on the fly. That seems hard/clumsy with mx:ViewStack.