Re: [flexcoders] Re: WebORB or AMFPHP for big Application
Keep in mind that AMFPHP may go under the radar (or drop off it completely) as the lead developer has decided to pursue another career and I have not seen any announcement of anybody else taking over for him. I'll be releasing amfphp 2 before I retire, and I have someone here that is interested in picking up amfphp, someone I can't mention just yet but trust me that my successor will be a very talented and respected member of the community that I am sure will do an awesome job with the project. As to which you should choose between amfphp and WebORB, it depends. Mark loves his WebORB, and I love amfphp, but they are different projects, and have different design goals, so that either one is most appropriate for different uses. The differences are subtle though, I'll be the first to admit, which is why I wasn't particularly thrilled about WebORB and SabreAmf when they first came out, as I felt it was a duplication of efforts (much like the well-publicized argument over SWX with Aral). But regardless, the effort has already been put in, so there's no use in stopping it now. I'll restate the design goals of amfphp from the homepage: - Nothing required - PHP4/PHP5 compatible, no extensions needed - Low footprint, lightweight, fast - Convention over configuration (service and class mapping) - Can be embedded into a framework (see CakeAmfphphttp://cakeforge.org/projects/cakeamfphp/, Seagull http://trac.seagullproject.org/ticket/1378) - Services are non-specific PHP classes that are portable to anything without code change - Productivity tools included (service browser, code gen, profiling) - Batteries included - XML-RPC, JSON - Not a framework by itself (use your own) I'd like if Mark could put up a similar statement of design goals for weborb so that users can make an informed decision. As for the issue of the AMF extension, I've contacted Mark about it, and in theory weborb could be made compatible, and SabreAMF will be eventually (as far as I can tell). I don't think Mark wants to do it though, perhaps because of the way the serializer is implemented on their side. My personal feeling is that the serializer and unserializer in WebORB are misadapted to the realities of PHP, split into several classes for doing simple, computationally intensive things, but one could argue (and I'm sure that Mark would) that clarity of code was chosen over performance, a valid decision if it doesn't affect performance that much (and Mark is right, the 50-200ms difference won't really make a difference in most projects, but in some which have very high traffic it most definitely will, which is why the AMF extension was made). Patrick
Re: [flexcoders] cacheAsBitmap - does anyone know?
You should only use cacheAsBitmap if you plan on modifying x, y, and alpha properties of a sprite. Changing rotation or scale means that the cache will be reset, so you will have worse performance. Adding a filter to anything sets cacheAsBitmap to true on it, but not on any of its children. Nevertheless, you should know that if a parent container uses a filter, moving or doing in the children of the container will cause the filter to be flushed and recalculated. Patrick Guy Morton a écrit : I've created an mxml component that uses a canvas object and writes a graphic on it based on some input parameters. This graphic is then animated over a bitmap background. If I set cacheAsBitmap on the graphic's canvas to true, then rotate the canvas, am I improving performance? Or does the rotate mean flash will throw away the previously cached bitmap and make a new one? Also, does having a drop shadow filter on the parent canvas container affect the behaviour of cacheAsBitmap? Guy
Re: [flexcoders] Storing VO in Sessions AMFPHP?
It's been mentioned and solved here: http://nothinghappens.net/?p=127 Patrick Kevin a écrit : looks like my problem is: __PHP_Incomplete _Class_Name __PHP_Incomplete_ Class Object from PHP.net: 'If you have saved an object in session, you must define the class of the object before the session_start( ). If you don't do that, php will not know the class of the object, and his type will be __PHP_Incomplete_ Class.' Has anyone found a work around for this with AMFPHP? My thought is that i have to try to modify some of the AMFPHP code to add includes before the session start...I am wondering if it is worth it. - Kevin On Mar 3, 2007, at 4:23 PM, Kevin wrote: Does anyone know of a problem with storing VO's in session with PHP? It doesn't seem to be working and before try to make it work, I figured it was best to see if it is even possible. Thanks, Kevin
Re: [flexcoders] Announcing FlexLib - open source flex component library
Awesome stuff! Maybe I'll add a WrappingLinkBar component once I get that working for the amfphp service browser. Patrick Doug McCune a écrit : I'm pleased to announce FlexLib: a new open-source project for Flex 2 components. This project is a Google Code hosted project, released under the MIT license. I've been working with Darron Schall, Mike Chambers and Ted Patrick to get the project up and running. We're hoping to build a concentrated community effort for custom Flex component development. Have you been looking for a community project to contribute to? Do you have custom components you've been releasing on your blog? Want to brainstorm about new and improved components? The project currently contains a handful of components that have been developed by me or Darron (including some new ones I haven't blogged about yet). We want to get the Flex developer community involved and have a central resource that will help us all build off each other's work. To get involved take a look at the project page on google code (link below) and read the HowToContribute wiki page. For more information read through the project website, join the discussion group, and email me if you have more questions. If you want to contribute your code, drop us a line and we'll get you involved. FlexLib project page: http://code. google.com/ p/flexlib http://code.google.com/p/flexlib Announcement on my blog: http://dougmccune. com/blog/ 2007/02/28/ announcing- flexlib-open- source-flex- component- library/ http://dougmccune.com/blog/2007/02/28/announcing-flexlib-open-source-flex-component-library/ Darron Schall's announcement: http://darronschall .com/weblog/ http://darronschall.com/weblog/
Re: [flexcoders] New Project: FlexCRUD -- Create Update Delete for Flex/amfphp/cairngorm
Sounds awesome. URL doesn't work though. Patrick Mike Crowe a écrit : Hi folks, I'm in the process of releasing my system generation utility via riaforge. Essentially, I'm using about 15 templates to generate 100 files. From a 1' perspective, I have created a generic template based system that generates: * Cairngorm commands: Get, GetAll, Save, Delete * Cairngorm events: GetSuccess, GetFailure, etc. * Cairngorm control file * amfphp Remote Delegate * amfphp ViewObject for both Actionscript and PHP * amfphp Service dispatcher * amfphp DTO file to save ViewObject to database * Unit test structures for testing both PHP-Database and Flex- PHP-Database operations for all tables. * etc. I based the database on PHP Doctrine, which handles all my database interaction in a very clean manner. Here's the help I need. To me, I think this will be very helpful to somebody *starting* a new project. It will generate all the core tables, events, commands, and directories for a basic system. However, I need some review from the Flex community to tell me if I'm way off base on this. If it isn't useful, please be honest and provide that feedback. Here's the initial wiki documenting the core. I'll shoot to release the full code tomorrow: http://www.your- solutions. us/doku.php/ start http://www.your-solutions.us/doku.php/start TIA Mike
Re: [flexcoders] amfPHP 1.9 beta 2, malformed amf object question
Try adding this in gateway.php: $gateway-setLooseMode(true); It was an oversight on my part, will be fixed in next version. Patrick Kun Janos a écrit : Hi all I updatet amfphp 1.2 to amfPHP 1.9 beta 2. In the old services/dao 's I had some echo/print commands for debugging and amfphp worked just fine. When amfPHP 1.9 beta 2 finds an echo or print in the services it stops working. I mean, the amf object that is sent back is malformed. This malformation also happens if in the service.php before the ?php or after the closing ? we have some white spaces. Is this a bug? Janos We won't tell. Get more on shows you hate to love http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265 (and love to hate): Yahoo! TV's Guilty Pleasures list. http://us.rd.yahoo.com/evt=49980/*http://tv.yahoo.com/collections/265
Re: [flexcoders] How to save an ArrayCollection to php via HTTPService
Using amfphp would definitely be the easiest. Then you would just need to set up a RemoteObject tag and call ro.saveArrayCollection(arr_collection) and be done with it. You would receive the ArrayCollection as a PHP array on the other side. Patrick rkrater a écrit : Can someone give me an example of how to save an ArrayCollection to php via HTTPService. I have a datagrid with a ArrayCollection as the dataprovider. I want to click the save button and it is passed to my php page to then be saved in the database. Any ideas are welcomed. Thanks! ---Here is my code so far--- mx:ArrayCollection id=arr_collection /mx:ArrayColle ction mx:HTTPService id=hs url=poll.save. php useProxy=false mx:request data{arr_collecti on}/data /mx:request /mx:HTTPService This gives me [object Object],[object Object],[object Object] when i try to pass it back. Any ideas would help a ton!!!
Re: [flexcoders] Re: amfphp + codeigniter
You have a few options here. The first is to call flickr directly through XML-RPC using Flex. You could use plain old E4X for that, or you could use a wrapper library for it. Try it here: http://www.hrum.org/people/debedb/pro/blog/2006/12/xmlrpc_in_flex_2actionscript_3_1.html As Renaun mentioned, you could also use REST services for Flickr, they work just as well. If I have a choice between REST and RPC, generally I'll choose RPC, but I don't know how good the library I just linked actually is. The third option is to use a middle man, such as amfphp. In that case you could use the XML-RPC functions built into PHP, and just have amfphp resolve them. For example: ?php class FlickrService { function doCall($function, $args) { //For example, $function = flickr.photos.getRecent $apiKey = YourAPIKey; array_unshift($args, $apiKey); | $request = xmlrpc_encode_request($function, $args); $context = stream_context_create(array('http' = array( 'method' = POST, 'header' = Content-Type: text/xml, 'content' = $request ))); $file = file_get_contents(|http://api.flickr.com/services/xmlrpc/|, false, $context); $response = xmlrpc_decode($file); return $response; |} } ? Then just use ro.doCall(flickr.photos.getRecent, []);, where ro is your RemoteObject instance. That might be slower than a direct call but then again, you don't have to store the API ky on the client (a bad idea). Patrick joshuagatcke a écrit : I seen that flickr has rest web services, I am really just trying to use xmlRPC from flex with PHP. This does not seem that possible. I thought I could close the gap with AMFPHP, but that would be a realy pain. I might as well just trunk through the XML. I am thoroughly disappointed with the flex + PHP combination. I wish I had know more about the limitations of flex before I purchased flex builder.
Re: [flexcoders] Re: AMFPHP 1.9, class mapping not working, advancedsettings.php question
I removed advancedsettings.php because it required configuration and that is against the amfphp design philosophy (convention over configuration). I can see the use for it but more trouble than it's worth. Patrick Kun Janos a écrit : Hi Michael I had them slightly different, I tried your way also and didn't work :( Class mapping succeded when I rewrote in Flex: [RemoteClass( alias=LoginVO )] and setup $gateway-setClassM appingsPath( 'com/virtualro/ vo/'); If $gateway-setClassM appingsPath( 'com/virtualro/ vo/') and [RemoteClass( alias=com. virtualro. vo.LoginVO )] then amfphp looked for the classes for mapping in com/virtualro/ vo/com/virtualro /vo/ witch didn't exists. Thanks for your answers Michael, they helped me to solve the problem. Janos --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, michael_ramirez44 michael_ramirez44@ ... wrote: Is this the way you have the mapping setup? Actionscript Classes //Location of PHP classes [RemoteClass( alias=com. virtualro. vo.LoginVO )] [RemoteClass( alias=com. virtualro. vo.TaxVO )] PHP Classes //Location of AS classes $_explicitType = com.virtualro. shell.vo. LoginVO; $_explicitType = com.virtualro. taxes.vo. TaxVO; --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Kun Janos kunjanos@ wrote: Thanks you Michael, but this is not the answer to I was expecting. Maybe I didn't express myself well enough. I know that I can set the VO directory in the globals.php. But setting that won't map my VO -s. In my application I have com.virtualro. shell.vo. LoginVO or com.virtualro. taxes.vo. TaxVO on Flex, and com.virtualro. vo.LoginVO, com.virtualro. vo.TaxVO on amfPhp (notice that on Flex I have the VOs in separate dirs, and on php I have another structure for all the VO-s in one dir). With version 1.2 of amfphp I was setting the incoming and outgoing class mappings using the setCustomIncomingCl assMappings and setCustomOutgoingCl assMappings functions from $gateway...now in amfphp 1.9 beta 2 these functions are missing, just like the advancedsettings. php. --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, michael_ramirez44 michael_ramirez44@ wrote: Janos, Amfphp 1.9 looks for your VO objects in services\vo by default. You can change this in the globals.php file. Michael Ramirez --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Kun Janos kunjanos@ wrote: Hi all. I just upgraded amfphp 1.2 to amfphp 1.9 beta 2 and class mapping is not working any more :( In one of the messages that Patrick Mineault wrote I read that for class mapping I should put [RemoteClass( alias=com. virtualro. shell.vo. LoginVO) ] in Flex LoginVO.as (just like in amfphp 1.2) and public $_explicitType = com.virtualro. shell.vo. LoginVO; //in LoginVO.php I'm using Charles and I see that the data is sent from flex to amfphp, but the class mapping doesn't occour. Using $msg = ''; foreach($login as $key = $value){ $msg .= $key.' - '.$value.', '; } I saw that the data arrives to LoginService. php but using $login-username gives null :( meaning that data has arrived but class mapping is not working. Patrick Mineault also wrote that after setting up LoginVo.php and LoginVo.as we should read the instructions in advancedsettings. php The problem is that the file advancedsettings. php doesn't exist in amfphp 1.9 beta 2, and the methods used in amfphp 1.2 (setBaseCustomMappi ngsPath, setCustomIncomingCl assMappings and setCustomOutgoingCl assMappings) have been removed from the $gateway. Can anybody help me? Thanks, Janos
Re: [flexcoders] Are other developers hesitant to extend existing classes in Flex?
I've had a lot of issues as well with private functions. I would have suggested to use protected basically everywhere since you can't really plan for where developers will want to modify the components. As far as composition vs. inheritance, well, composition doesn't solve every problem. I had an issue with the slider class firing data events when it received a data-binding value, even though the NumericStepper didn't do that. Because the problem function was private and buried very far in the component hierarchy, I basically gave up. It was a one-liner kind of issue too. Patrick Doug McCune a écrit : I've had a similar experience many times, so I'll chime in with what I've been doing. The problem: you want to make a simple extension, and you see the part of the original source that you need changed or enhanced. So you try to make a subclass but you end up finding out that to do what you need done you need access to a handful of private variables and functions in the parent class. My solution: I make a cut/paste copy of the original class, name it something like OriginalClassBase. as (so like AccordionBase. as) and then I extend that new base class. What this allows me to do is make some very slight modifications to the original base class, which usually only involve changing certain variables or methods to protected as opposed to private. This is bad for two reasons: 1) you're duplicating the original component in the code base, so you'll bloat the end size of your file and 2) future updates to the original class won't be included in your extended class. Problem 1 is often worth the price, since that's really the only way I can figure out to do some of the tings I want to do. And I've already resigned myself to multi-hundred kilobyte SWF files, so whatever. But if you're psycho about file size this might prevent you from taking this approach. Problem 2 I don't really see as that big a deal and here's why: the changes you're making to the base class are minor. This means that if an update comes out to the Accordion class, my copy/paste version can be compared within Eclipse using the compare functionality and I can identify exactly where the differences are. So if an update to the Accordion is released in Flex 3, then I can compare my base class with the updated Class, and either make a new base class using the Flex 3 version, or decide that I don't need to bugfixes and enhancements they rolled into Flex 3. This is just my approach. What I've found over and over again is that to really make the enhancements I want, the components simply haven't been designed quite right. This isn't to say that Adobe should have been able to anticipate every scenario that I would want to do with a subclass. Thank god they included the source for the SDK though. Doug On 2/21/07, *Dana Gutride* [EMAIL PROTECTED] com mailto:[EMAIL PROTECTED] wrote: Recently on this list, somebody said that the Flex framework team has been surprised at the resistance many developers have to subclassing and they'd like to understand it better. I'd like to put my 2 cents into this discussion because maybe we can come up with some good answers. I think the ability to extend the existing framework is fabulous, but I find that I am hesitant to subclass or extend the existing classes. Recently, I spent several days trying to override the placeSortArrow function on the datagrid. I ended up ditching my code because there were so many private variables used by the existing placeSortArrow( ) function that I would need to rewrite most of the datagrid.as http://datagrid.as file. I've bought books and searched online for answers, but I haven't found anything satisfactory yet. Maybe if there were more resources (even if we had to pay for them), we would find more developers extending the flex framework. Dana
Re: [flexcoders] Displaying Mathematical Formulas in Flex
You could use a LaTeX renderer to do this, which would be located on the server. I've used MimeTex and it's worked great for me. If you wanted, you could eventually port that C code to AS3 and do the rendering in Flex itself. That would be a major, major undertaking IMHO though. Patrick mindmillmedia a écrit : I am the lead on a project that I really want to use flex on. However, I have a bit of a problem. Without going into a great deal of detail, I need to be able to generate and display mathematical equations within flex (complicated ones). I had a few thoughts on the issue: 1. If I could have an outside script that could create the equations and save them as images, it would be fine. However, it would have to be web app - not a desktop one. If there were a library for PHP's GD Library or something like that. 2. If there were a Flash Component that could generate the equation, I could easily write a script to extract that data and save it in some useful format. 3. If I had to, I could leverage the browser and use the IFrame concept first demonstrated by Christophe Conraets. However, there is still no widely supported way of displaying equations in HTML (yes, I know about MathML - but it is still not fully supported in all browsers without plugins). I hope someone has an idea of how this could work best. David Tucker
Re: [flexcoders] HTTPService Vs PHP
You should look into amfphp for this kind of thing. Basically instead of using HTTPService, you use RemoteObject, and you don't have to worry at all about serializing your data on the PHP side. You should read this tutorial here: http://sephiroth.it/tutorials/flashPHP/flex_remoteobject/ Patrick theduderino82 a écrit : I come from php programming and I want to develop with flex. I found hard to find somewhere over the internet how to handle output from php file called with a HTTPService to the mxml. All I can find is tutorials on how to retrieve data from an xml file. I understand how to pass form items to the php page in order to update mysql but I can't figure out how to send back results from the database (possibily strings to be handled in an action script) or even worste how to handle mysql exception. something like this: mx:HTTPService resultFormat= text id=logRequest url=http://...url. ./connection. php http://...url../connection.php useProxy=false method=POST mx:request xmlns= passwordInput {passwordInput. text}/passwordI nput usernameInput {usernameInput. text}/usernameI nput /mx:request /mx:HTTPService this should post a basic login. if($_POST[password Input] AND $_POST[usernameInp ut]) { $query= sprintf(SELECT login,password FROM utenti WHERE login='$usernameInp ut'); //-- - - - - // MYSQL STUFF //-- - - - - --- $check=check ok/check ; print ($check); } From the Mike Potter Tutorial he used a print() with an xml string to populate a datagrip. So I made a small xml string checkok/ check and printed. private function logCheck():void{ logRequest.send( ); Alert.show( Check = +logRequest. lastResult. check); } every time I get Check = null. What am I doing wrong?
Re: [flexcoders] AMFPHP Service Browser SVN
Could you expand on what your setup is like? The Apache htdocs folder vs. the SVN location (on the same machine? elsewhere?) vs. the service browser being loaded locally or from the server, etc. Patrick Kevin a écrit : I am trying to figure out how to use the AMFPHP service browser with my SVN so coders can use the service browser to test committed code on the svn. Is it possible to point the gateway to different folder other than the local services folder? I tried to put a full URL in the setBaseClass var, but I get the error: (mx.rpc::Fault) #0 errorID = 0 faultCode = AMFPHP_CLASSPATH_ NOT_FOUND faultDetail = /Users/me/Sites/ amfphp/core/ shared/app/ BasicActions. php on line 25 faultString = The classpath folder {/amfphp/DiscoveryS ervice.php} does not exist. You probably misplaced your service. message = faultCode:AMFPHP_ CLASSPATH_ NOT_FOUND faultString: 'The classpath folder {/amfphp/DiscoveryS ervice.php} does not exist. You probably misplaced your service.' faultDetail: '/Users/kevin/ Sites/ amfphp/core/ shared/app/ BasicActions. php on line 25' name = Error rootCause = (null) I then tried to upload the '/amfphp/DiscoveryS ervice.php' to the SVN, but that didn't seem to work either. thanks, Kevin
Re: [flexcoders] AMFPHP Security
Wouldn't Fluorine and OpenAMF throw a type-coercion error, given that the first argument is typed? Of course, the code in the constructor would be called anyways. Patrick Zoltan Csibi a écrit : Hi, I would like to underline that somebody with good AMF knowledge can craft strongly typed objects and send them to the server-side. If the deleteUser doesn't require authentication and authorization it can be hacked in any language. function deleteUser($ userVO) { $userVO-delete( ); } Well, you might expect that $userVO is a com.myPackage. UserVO, but it could also be a com.myPackage. PhotoVO, or a com.myPackage. AdminVO, or whatever. So you either have to make sure you do receive the VO type you expect, using instanceof or is_a, or you should only use dumb VOs which don't have any methods Mit freundlichem Gruß , Zoli
Re: [flexcoders] Re: AMFPHP Security
I think you're misunderstanding my argument Mark. Of course you can spoof any message you want, and you don't have to be an expert either to do it; you could use the amfphp service browser of SabreAMF as a library or a Flash movie to send any message whatsoever to a gateway. The issue with class mapping is that when developers put something in the service folder, they know that the code can be included and methods run on it. If they care about security, they will take care that the methods defined are not dangerous if remotely executed with other data. But from talking to a very well-known blogger (a Java fan) and seeing some of the new code that is going around in tutorials, I see that while people are taking care of escaping strings before sending them to a database and the like, they don't bother to check the argument type that's received, and while that may not be dangerous if you receive an array instead of a string, it may be if you receive a live object which has code in it which may be executed. The locking mechanisms which apply to amfphp, WebORB or Fluorine are per-method, but class mappings in most implementations is per gateway (at least, that's what it is in amfphp, Fluorine, or OpenAMF). So you could call an unlocked method with a mapped class that you would only expect to receive in a locked method, and if that mapped class has side-effects it could do some damage. Because class mapping and VOs are often used in database scenarios, we're talking about potential data-loss issues here. It's a far-fetched scenario, but the main issue is that it is such an unobvious scenario that you might not actually think about it, and you might not think about securing against it. About the Our implementation (weborb) does it quite well, I'm not sure what you're referring to by it. Could you expand? Patrick Mark Piller a écrit : Zoli is right. Usage of a specific object type in a method signature is irrelevant to security. In fact, you do not even need to know AMF to do it. One could easily use something like ServiceCapture to understand the structure of the argument type then construct a similar object and run it a local Flex/Flash movie with unrestricted security. Essentially it means that a gateway must safeguard against such malicious attacks. Our implementation (weborb) does it quite well. Cheers, Mark --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Zoltan Csibi zoltan.csibi@ ... wrote: What I mean is: if I can sniff what typed VO an application is receiving, I can craft an AMF packet with: - call to deleteUser - the same VO type (simplified: as we know that this is just a string of the class name followed by other strings describing property names and other binary data with property values etc etc etc) The gateway (fluorine, openamf, fds ... anything) will see a valid object/type. There is no type-coercion error here. This is an easy task to do with AMF knowledge. Bottom line: I don't think that passing simple types, untyped VOs or typed VOs makes any difference from security point of view. Mit freundlichem Gruß, Zoli _ _ __ From: [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com [mailto:[EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com] On Behalf Of Patrick Mineault Sent: Thursday, January 18, 2007 6:29 PM To: [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] AMFPHP Security Wouldn't Fluorine and OpenAMF throw a type-coercion error, given that the first argument is typed? Of course, the code in the constructor would be called anyways. Patrick
Re: [flexcoders] AMFPHP Security
Amfphp is not inherently less secure than FDS. Anybody who wants to can spoof requests to FDS or amfphp, just like they can for HTTP POST. As a side-note, users don't have to bother to decompile your SWF; they can just sniff packets coming in or out of your movie using ServiceCapture or Charles. The rules for securing Remoting apps aren't any different than the rules for HTTP POST: don't trust data, secure sensitive methods (deleteEntireDatabase(), for example), use sessions to identify users, be wary of SQL injection, don't send SQL over the wire, use SSL when sending credit card/banking info, etc. Just common sense really. The only thing that you should be worried about that doesn't have an equivalent in HTTP POST is sending VOs. Since they are mapped automatically and VO types are uneforced, someone can spoof VOs and make them any type they want. For example, consider the service function: function deleteUser($userVO) { $userVO-delete(); } Well, you might expect that $userVO is a com.myPackage.UserVO, but it could also be a com.myPackage.PhotoVO, or a com.myPackage.AdminVO, or whatever. So you either have to make sure you do receive the VO type you expect, using instanceof or is_a, or you should only use dumb VOs which don't have any methods. This and the fact that assignments on a class for variables that not defined won't cause a warning unless using E_STRICT, which amfphp won't run in (as it's impossible to work in E_STRICT while supporting PHP4), means that using VOs in amfphp (and in PHP in general) is IMHO bad practice. VOs make a lot more sense in fully (runtime, not just compile-time) typed languages. Patrick Kevin a écrit : Is there any good information available on how to properly secure AMFPHP/Flex. It seems like a simple decompile of the swf file can expose a wealth of information which could allow a hacker to easily connect to the gateway and call any number of methods. Is there any information on available on how to lock down an AMFPHP/flex app properly? I have seen some discussions on the boad regarding FDS security, but not AMFPHP. Is AMFPHP inherently less secure OR more secure than any other data service technology. The app I am building requires as high a level of security as I can reasonably enable. Thanks, Kevin
Re: [flexcoders] AMFPHP Security
I think you are being very reasonable here when considering VOs, as a lot of people tend to use them blindly, esp. people coming from Java backgrounds. A thing I hear very often is with VOs you can be sure what data you receive, which is true in a typed language, but in a dynamic language, that's just not right. Consider for example: void addComments(CommentVO[] commentVOs) (Java) Versus: function addComments($commentVOs) (PHP) Of course in Java, if a user tried to send an array of UserVO to addComments in the first parameter, it would throw an error. In PHP however, because it is untyped, no error is thrown, so you have to manually check if you get the right type. Now if UserVO and CommentVO both define an add() method, you can see that your addComments methods could also be used to add users. Of course if users have administrative rights, someone might use this to inject a new user with admin rights in the db, and could wreck havoc on your system. The difference between this and spoofing a call is that this is a really subtle security hole, so you might not think about it. Honestly, it's not a huge hole, you could definitely do a lot worse (I've seen people send SQL over the wire, unencrypted, and unsecured), but I don't think trying to make PHP into Java is a great idea (if so, why not use Java in the first place?) I really see no issue in sending VOs back to Flash, because Flash runs in a sandbox, so the worst that can happen is that the hacker's app stops functioning. But sending them to the server... not the greatest idea. Now I've seen a lot of code that looks like this: $rs = mysql_query(SELECT * FROM the_table); while($row = mysql_fetch_assoc($rs)) { $vo = new UserVO(); $vo-id = $row['id']; $vo-name = $row['name']; $results[] = $vo; } return $results; How is this any better than: return mysql_query(SELECT * FROM the_table); ...I'm not sure... seems like it's quite a bit more code to add that doesn't really serve that much of a purpose. Sure, you'll get VOs on the Flash side, but if they are dumb VOs... what's the point? Now if you actually want to send more complex data to Flash, for example, if you wanted to send back a PostVO that includes an array of CategoryVO, then since you're going to have to traverse the MySQL data set anyway, you'd be justified in adding typing in as well. So basically I'd say if you need simple data, stick with plain arrays and objects, if you need more complex things, then VOs are cool. Right tool for the right job, basically. About ORM, the next version of amfphp will support Zend DB, so I'd recommend trying out Zend_Db_Table, I looked at the docs yesterday and it's pretty sweet. Doesn't handle associations or anything but it's still cool. There's also Propel/Creole. Kevin a écrit : On Jan 17, 2007, at 10:27 AM, Patrick Mineault wrote: So you either have to make sure you do receive the VO type you expect, using instanceof or is_a, or you should only use dumb VOs which don't have any methods. I think that this is an important point, so I want to make sure I understand what you are saying since I have been debating whether to use VO's in my PHP. I can create dummy VO's as you suggested (which is essentially what my Flex VO's are), but I have been wondering what advantage I get from using VO's at all in PHP unless I attempt to implement an ORM approach and actually map the PHP VO directly to the MYSQL tables and abstract my SQL into these objects. I have been a little wary of this approach (for reasons other than security) since I need a more flexibility in my inserts, AND it sounds like you would not recommend this either due to the security holes it could reveal. However, the other advantage of VO's on the PHP side is to allow them to manage the deserialization of my MySQL results, and thus fully organize them into objects that can be easily mapped back to Flex. So... a) Does this present as big a security issue? b) Is a good way to approach the mapping of PHP to Flex? How are others solving this problem. c) If one could spoof a VO, wouldn't it be just as easy to spoof a method call (assuming I take a more procedural approach). I guess I don't fully understand why the procedural approach is more secure than the VO approach. I am new to understanding web security, so forgive me if I am being naive... thanks, Kevin
Re: [flexcoders] AMFPHP, Cairngorm VO
Sure thing. If you want to return an array of com.one.of.my.customVO, then say the php class is: ?php class customVO { //Declare variables below var $_explicitType = com.one.of.my.customVO; } ? PHP doesn't support packages, so to send the full package name to Flash you have to set the $_explicitType variable. The value of $_explicitType should be the same as that of [RemoteClass], ie: package com.one.of.my { [RemoteClass(com.one.of.my.customVO)] class customVO { //Stuff in here } } Then the rest is done for you. So for example: function getArrayOfCustomVo() { return array(new customVO(), new customVO()); } That's pretty much all there is to it. Patrick Kevin a écrit : 1) Is is possible to return results from AMFPHP and have them easily assign Value Objects on the Flex Client? (if so, how) EXAMPLE: call service to ask for an array of VO data. AMFPHP returns array of PHP Data(Value) Objects in result event. How do I then map the items in the VO array to a Flex VO? Is this possible? I thought I could use something like this to do it, [ ArrayElementType ( com.one.of. my.customVO )] but I am not sure where to put this?? or how to use it properly. 2) Is it bad form to give Cairngorm Value Objects custom getters setters to handle some basic data manipulation tasks? I have been doing this in my unit testing, but now that I am trying to connect to AMFPHP to return the data, the getters setters are useless because the Flex VO is being ignored. Thanks for your help. - Kevin
Re: [flexcoders] AMFPHP, Cairngorm VO
alias is the default property for [RemoteClass], so you don't need to explicitly write it (just like, say, Embed source) Patrick Kevin a écrit : thank you. Here is where I was making my mistake (in case others are having the same problem): when declaring the $_explicitType variable, I was mistakenly putting the path to the variable in my Flex dir rather than the path in my PHP dir. var $_explicitType = com.one.of. my.flex.customVO ; should have been: var $_explicitType = com.one.of. my.customVO ; I don't know why, but I guess I thought I should tell PHP where my Flex VO was...like it cares! Anyway, thank for setting me straight. BTW, I have always seen the [RemoteClass( com.one. of.my.customVO )] write with alias =. [RemoteClass( alias= com.one. of.my.customVO )] Is this a typo or is the alias optional? thanks, Kevin On Jan 15, 2007, at 6:09 PM, Patrick Mineault wrote: Sure thing. If you want to return an array of com.one.of.my. customVO, then say the php class is: ?php class customVO { //Declare variables below var $_explicitType = com.one.of. my.customVO ; } ? PHP doesn't support packages, so to send the full package name to Flash you have to set the $_explicitType variable. The value of $_explicitType should be the same as that of [RemoteClass] , ie: package com.one.of.my { [RemoteClass( com.one. of.my.customVO )] class customVO { //Stuff in here } } Then the rest is done for you. So for example: function getArrayOfCustomVo( ) { return array(new customVO(), new customVO()); } That's pretty much all there is to it. Patrick Kevin a écrit : 1) Is is possible to return results from AMFPHP and have them easily assign Value Objects on the Flex Client? (if so, how) EXAMPLE: call service to ask for an array of VO data. AMFPHP returns array of PHP Data(Value) Objects in result event. How do I then map the items in the VO array to a Flex VO? Is this possible? I thought I could use something like this to do it, [ ArrayElementType ( com.one.of. my.customVO )] but I am not sure where to put this?? or how to use it properly. 2) Is it bad form to give Cairngorm Value Objects custom getters setters to handle some basic data manipulation tasks? I have been doing this in my unit testing, but now that I am trying to connect to AMFPHP to return the data, the getters setters are useless because the Flex VO is being ignored. Thanks for your help. - Kevin
Re: [flexcoders] hostmysite, mySQL5, CF7, WebService, and Flex2 problems...
You should try using ServiceCapture or Charles debugging proxy to inspect the data being sent over the wire when an error occurs. Patrick qnotemedia a écrit : I have two Flex apps using all of the above that perform flawlessly on my localhost, but after moving them to hostmysite.com, they have sporadic issues. Its always an error statement that I have created, in a Flex Alert.show fault return, though I'm not entirely sure if where the actual error is taking place - I would assume in CF. What I have is two CFCs, one with all of my DB-changing functions, and the other with my get-data-only functions. At the beginning of my app, I call out maybe seven webservice calls to the read-only CFC to grab data, and again, while it works perfect on my localhost, once on hostmysite, anywhere from 1-3 of these may or may not fail. Its very random. Many times, the app will work just fine. I wanted to use remote object, but unfortunately, hostmysite doesn't support this, so I'm stuck with WebService. Where do you think these random failures are happening, why is it happening, and what can I do about it?
Re: [flexcoders] Re: hostmysite, mySQL5, CF7, WebService, and Flex2 problems...
Yes, maybe it's a question of the order of the requests, or maybe you are running into race conditions of some kind. Try enabling throttling in ServiceCapture and set it to a low value (like 56k) to see if it makes the problem occur more frequently or less so. Maybe that will give you a hint as to what is going on. Patrick qnotemedia a écrit : Wow - ServiceCapture is really cool! I didn't know you could see stuff like that so easily. Unfortunately, its not showing me anything new. i.e. when an error occurs, the results in ServiceCapture look the same as a session where the app doesn't return any errors. What does that mean? There's eight webservice calls when an app is first loaded. One thing I did notice is that the order of these calls appears to differ depending on the session. I didn't think that any one service call requires another, but considering the sporadic nature of the errors, is it possible that the problem here is that simple? Thanks, - Chris --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Patrick Mineault patrick.mineault@ ... wrote: You should try using ServiceCapture or Charles debugging proxy to inspect the data being sent over the wire when an error occurs. Patrick qnotemedia a écrit : I have two Flex apps using all of the above that perform flawlessly on my localhost, but after moving them to hostmysite.com, they have sporadic issues. Its always an error statement that I have created, in a Flex Alert.show fault return, though I'm not entirely sure if where the actual error is taking place - I would assume in CF. What I have is two CFCs, one with all of my DB-changing functions, and the other with my get-data-only functions. At the beginning of my app, I call out maybe seven webservice calls to the read-only CFC to grab data, and again, while it works perfect on my localhost, once on hostmysite, anywhere from 1-3 of these may or may not fail. Its very random. Many times, the app will work just fine. I wanted to use remote object, but unfortunately, hostmysite doesn't support this, so I'm stuck with WebService. Where do you think these random failures are happening, why is it happening, and what can I do about it?
Re: [flexcoders] Anyone Using a Remote CF Server with Flex 2, Remoting?
It's your services-config.xml that is off. Try using this: ?xml version=1.0 encoding=UTF-8? services-config services service id=amfphp-flashremoting-service class=flex.messaging.services.RemotingService messageTypes=flex.messaging.messages.RemotingMessage destination id=amfphp channels channel ref=my-amfphp/ /channels properties source*/source /properties /destination /service /services channels channel-definition id=my-amfphp class=mx.messaging.channels.AMFChannel endpoint uri=http://localhost/amfphp/gateway.php; class=flex.messaging.endpoints.AMFEndpoint/ /channel-definition /channels /services-config Set destination to 'amfphp' and 'endpoint' to your ColdFusion endpoint in the RemoteObject tag. Then you can change the 'amfphp' names to 'coldFusion' if it bothers you ;) Patrick Jim Pickering a écrit : [RPC Fault faultString= [MessagingError message='Unknown destination' Coldfusion' .'] faultCode=InvokeFa iled faultDetail= Couldn'testabli sh a connection to 'Coldfusion' ] Everything is default. CFMX 7.0.2 Multiserver on IIS DevNet Edition for Development on one machine. FlexBuilder2 on my workstation machine. A drive mapping to the webroot and to the JRun4 folder. My Flex Project is configured and successfully validated to the root folder at J:\servers\cfusion\ cfusion-ear\ cfusion-war. Compiler in FlexBuilder 2 is comfigured with this: -services J:\servers\ cfusion\cfusion- ear\cfusion- war\WEB-INF\ flex\services- config\ .xml -locale en_US This is as basic as it gets - I am trying to get a HelloWorld app (from lynda.com actually) working with Flex 2 and CF via Remoting on a remoteCF Development Server. Can this work or is there a bug with Flex 2which requires that CF be loaded locally for development? If anyone is successfully developing Flex 2 apps with a remote Coldfusion server, I would appreciate it if you could walk me through the setup steps. Below are more details of what I've done so far. - - --- I have taken the time to read past entries on this topic, but the issues were slightly different than mine and didn't offer enough of a solution to help resolve my issue. In my HelloFromColdfusion .mxml file is the following code: ?xml version=1.0 encoding=utf- 8? mx:Application xmlns:mx=http://www.adobe. com/2006/ mxml http://www.adobe.com/2006/mxml layout=vertical mx:RemoteObject id=cfService destination= Coldfusion source=flex2btb. cfc.MyService / mx:Button label=Call Coldfusion click=cfService. helloWorld( )/ mx:Label text={cfService. helloWorld. lastResult} fontSize=18 / /mx:Application In a subdirectory in the webroot called flex2btb, in the flex directory is MyService.cfc. I have the crossdomain. xml file in my webroot also. The code is very basic: cfcomponent extends=Service cffunction name=helloWorld access=remote returntype= string cfreturn Hello World from Coldfusion /cffunction /cfcomponent BTW, I get the blank white screen when I browse to http://www.[mydomainhere] .com/flex2gatewa y. I get this error when I run the app at http://www.[mydomainhere] .com/flex2btb/ flex/HelloFromCo ldFusion. html: [RPC Fault faultString= [MessagingError message='Unknown destination 'Coldfusion' .'] faultCode=InvokeFa iled faultDetail= Couldn't establish a connection to 'Coldfusion' ] at mx.rpc::AbstractInv oker/http://www.adobe. com/2006/ flex/mx/internal ::invo\ ke http://www.adobe.com/2006/flex/mx/internal::invoke() at mx.rpc.remoting. mxml::Operation/http://www.adobe. com/2006/ flex/mx/intern\ al::invoke http://www.adobe.com/2006/flex/mx/internal::invoke() at mx.rpc.remoting: :Operation/ send() at Function/http://adobe. com/AS3/2006/ builtin:: apply http://adobe.com/AS3/2006/builtin::apply() at mx.rpc.remoting. mxml::Operation/ send() at Function/http://adobe. com/AS3/2006/ builtin:: apply http://adobe.com/AS3/2006/builtin::apply() at mx.rpc::AbstractSer vice/http://www.adobe. com/2006/ actionscript/ flash/pro\ xy::callProperty http://www.adobe.com/2006/actionscript/flash/proxy::callProperty() at HelloFromColdFusion /___Button1_ click() My services-config. xml file is default, but I have tried some different settings, restarting my CF server with every change; none worked successfully. I've tried the default endpoint line and I tried putting in http://www.[mydomainname] .com/flex2gatewa y. Both throw the same error. channels channel-definition id=my-cfamf class=mx.messaging .channels. AMFChannel endpoint uri=http:// {server.name} :{server. port}{context. root}/flex2gatew ay/ class=flex. messaging. endpoints. AMFEndpoint / properties polling-enabled false/polling- enabled serialization instantiate- typesfalse /instantiate- types
Re: [flexcoders] Datagrid Scrolling -- Is it really this complicated?
Granted, the behaviour of the datagrid is not optimal, but then again, why would you want to show 68 columns simultaneously? Even if the scrolling did work as you expect it to, that doesn't sound very user-friendly. I'd suggest thinking of another interface instead. For instance, you could show 3 or 4 columns and when you click on one row it could show the details in another panel. You could have the only names available in a list and then when you click on them it shows the data in a 2xn datagrid where your original columns become rows, the first column is the name of the property and the second is the value. phipzkillah a écrit : I have a Datagrid in a panel whose size is 80% width of the screen (panel width that is). My datagrid has 68 columns and its width is set to 100% (to fill the panel). When the datagrid loads you can't read a damn thing. If i set the minwidth I can read the data, but I have to horizontally scroll all the way to the right to see the vertical scroll bar!! SO I can't scroll down unless I scroll all the way to the right...how is that user friendly? Seems like a poor design that the datagrid scroll bar doesn't float ontop of the grid itself. You can see the problem here in a snapshot I took - vertical scroll bar not seen unless you scroll all the way to the right. Does anyone have a solution to this problem? I don't want any scroll bars on my panel. I simply just want to be able to scroll horizontally and vertically on my datagrid with ease.
Re: [flexcoders] Re: Datagrid Scrolling -- Is it really this complicated?
You could put an instance of VScrollBar on the right hand side and have it control the DataGrid, and hide the original scrollbar. Patrick phipzkillah a écrit : Patrick, I have a toggle bar which controls the amount of columns being shown to the user. Each field [column] is relevant to the corresponding record [row]. There are situations where the user will want to see all the columns at once -- even though it will probably cause them a headache. Is it possible to do this and have the vertical scroll bar always shown? Also by any chance, has anyone ever seen the datagrid header fields rendered into a drop down list for filtering (which is what Excel does when you apply the 'list')? I saw a sample online but it was developed in Flex 1.5 and couldn't get it to work. --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Patrick Mineault patrick.mineault@ ... wrote: Granted, the behaviour of the datagrid is not optimal, but then again, why would you want to show 68 columns simultaneously? Even if the scrolling did work as you expect it to, that doesn't sound very user-friendly. I'd suggest thinking of another interface instead. For instance, you could show 3 or 4 columns and when you click on one row it could show the details in another panel. You could have the only names available in a list and then when you click on them it shows the data in a 2xn datagrid where your original columns become rows, the first column is the name of the property and the second is the value. phipzkillah a écrit : I have a Datagrid in a panel whose size is 80% width of the screen (panel width that is). My datagrid has 68 columns and its width is set to 100% (to fill the panel). When the datagrid loads you can't read a damn thing. If i set the minwidth I can read the data, but I have to horizontally scroll all the way to the right to see the vertical scroll bar!! SO I can't scroll down unless I scroll all the way to the right...how is that user friendly? Seems like a poor design that the datagrid scroll bar doesn't float ontop of the grid itself. You can see the problem here in a snapshot I took - vertical scroll bar not seen unless you scroll all the way to the right. Does anyone have a solution to this problem? I don't want any scroll bars on my panel. I simply just want to be able to scroll horizontally and vertically on my datagrid with ease.
[flexcoders] AS3 decompiler
If you guys haven't seen this yet: http://www.5etdemi.com/blog/archives/2007/01/as3-decompiler/ Patrick
Re: [flexcoders] CRUD in XML
You'd probably be better off to use Remoting to implement CRUD in Flex. Search for RemoteObject on Google and you should find a variety of resources. Patrick greg h a écrit : devis, Could you please provide a bit more detail about what you are trying to do? CRUD is an acronym usually associated with the database operations INSERT, SELECT, UPDATE and DELETE. When you ask for some example how to implement Flex 2 CRUD with xml file??? what do you mean? Have you looked at the Flex 2 documentation sections on: * The E4X approach to XML processing http://livedocs. macromedia. com/flex/ 201/html/ 13_Working_ with_XML_ 169_03.html http://livedocs.macromedia.com/flex/201/html/13_Working_with_XML_169_03.html * Working with XML http://livedocs. macromedia. com/flex/ 201/html/ 13_Working_ with_XML_ 169_01.html http://livedocs.macromedia.com/flex/201/html/13_Working_with_XML_169_01.html g On 1/6/07, *devisbalsemin* devisbalsemin@ yahoo.com mailto:[EMAIL PROTECTED] wrote: Hi, can you help me to find some example how to implment Flex 2 CRUD with xml file??? Thanks devis
Re: [flexcoders] RPC Pro's and Cons
Basically you want to use RPC when you are going to consume and send data on initialization and based on user interaction (ie: pull). You want to use FDS when you need to notify a client to update its data based on a server event, or keep data synchronized between clients (ie: push). There are other reasons why you might want to use FDS, like recordset paging and whatnot, but as a rule of thumb, use RPC (esp. Remoting) for pull and FDS for push. Of course, you can simulate push in Remoting using polling, but you will find that it's a pain to keep everything in sync for more than basic functionality. And of course, you can do pull over FDS, but it has a major learning curve, requires knowledge of Java as opposed to your favorite language, and is a bitch to deploy, compared to, say, using amfphp or Fluorine. Patrick jeofmoyster a écrit : I'm looking for any information on why FDS is better than HTTPService or WebService. Or better phrased, WHEN would one prefer FDS over the other two for reasons other than publish/subscriptio n? I'm working on determining the best way to go with an architecture. I can tie Flex applications to Java, .NET or PHP API's for our back-end systems, but I'm wondering whether to go with a home-grown approach/WebORB vs. FDS? Does serving Flex apps from the FDS server reduce bandwidth or make for more efficient delivery? Is polling really terribly detrimental compared to data pushing? Is FDS amazingly faster, better, stronger than going with a free option. How much can an FDS server take before we need to build out the architecture? Basically I need to have a good list of WHY we should use Flex Data Services before I start dropping hundreds of thousands of dollars on the architecture. thanks, /j
Re: [flexcoders] Re: RPC Pro's and Cons
over magic... LMAO. Patrick Tom Chiverton a écrit : On Thursday 04 January 2007 21:45, Jamie O wrote: -You need FDS over HTTP or Web when the security of the URL is important. Without FDS (or WebOrb or equivelent layer of server-side technology) the URL of the service is exposed in the .swf to being decompiled. :points at WireShark / Pharos The endpoint is exposed over both. It has to be, because the traffic runs over the network, as opposed to over magic. -Java and Flex / FDS play the nicest together, especially with the Flex plugin to eclipse. If you already have your java classes setup from a previous project, you can leverage that code to tie a new Flex UI on the front. Unless you are a ColdFusion programmer :-) -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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 Accessing HTTP Session
No, HTTP sessions are stored on the server-side, so you can't access them from just the client side. The only thing you CAN access on the client side is cookies, which may contain the session id, but the actual data is stored on the server-side, indexed by that key. Patrick 2006/12/27, Ryan [EMAIL PROTECTED]: I was curious if there was any way that flex could access a HTTP Session. I have not seen any type of tutorial/doc posted that might work other than a very small note in the help section of flex's installed doc's. At this point my only solution is to use flash vars to capture the session ID, then I'm going to write a Web Service that will take that Session ID and return all the variables I need. I was hoping that there might be an ez'er way cutting out the Web Service. Thanks, Ryan
Re: [flexcoders] Problem with FileReference.upload()
You can read this post documenting the bug and its workarounds here: http://www.5etdemi.com/blog/archives/2006/10/php-filereference-and-sessions-a-bug-from-hell/ Patrick Dimitrios Gianninas a écrit : Its a bug, thats the way the Flash Player works, its not a Flex thing. I've submitted this bug before. Also it happens only with FF... IE works fine. *Dimitrios Gianninas* *RIA Developer* *Optimal Payments Inc.* *From:* [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] *On Behalf Of *rene.sprotte *Sent:* Thursday, December 21, 2006 4:33 AM *To:* [EMAIL PROTECTED] ups.com *Subject:* [flexcoders] Problem with FileReference. upload() Hi all, I discovered a problem with uploading files to a server in flex2 using FileReference. upload (). My code includes something like this: [...] private var fileRef:FileReferen ce = new FileReference( ); private function someHandler( event:Event) :void { var request:URLRequest = new URLRequest( band/upload_ image); fileRef.upload( request); } [...] On the backend I use ruby on rails to handle the upload. The problem is that every time fileRef.upload( request); gets called a new session will be created in rails (that means I have to re-authenticate my user before every upload request). On the other hand, if I replace e.g. fileRef.upload( request); with navigateToURL( request, _blank); (even if this makes no sense here) the existing session will be used. So why does fileRef.upload( ...) creates a new server session on every request? Is this a bug? Best regards René * AVIS IMPORTANT * * WARNING * Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur. This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender.
Re: [flexcoders] Question for all you SQL Query experts
I would suggest looking at what google does. It allows and/or searches in a completely unobstrusive manner. I would use only one search field, with the following algo: 1. split on 'OR' 2. split on words 3. join on words with AND 4. join on words with OR I would definitely search on all fields in your table. In split on words you might want to take into account words in double-quotes. Also I would use LIKE everywhere. Patrick Mike Anderson a écrit : Hello All, I was wondering how you more seasoned SQL programmers (as it relates to the User Interface side of things), provide the ability of advanced SQL Queries to novice users - but in a easy to use and non-threatening manner? We have an extensive parts database, and the only way to truly search this thing, is by giving users the ability to perform robust and, or as well as and/or type queries. Back in the HTML days, I would simply give the users 4 sets of blanks, in which they could put in 4 unique sets of search criteria - with And or Or in a DropDown box. This worked well enough I guess... but for the power-users, who wanted to perform more advanced queries - with more than 4 search criteria, I was always in a quandary as to what to do. There is a fine line between functionality and usability, especially when it comes to Data-Driven applications that are very Text Intensive. With Flex having the ability to offer such spectacular user interfaces, I was wondering what techniques I could use NOW, that could offer a truly powerful user experience - but still *keeping it simple*. I would love to hear some input regarding this topic - Thanks in advance for all your help, Mike
Re: [flexcoders] Re: Amfphp with AMF3 support: testers wanted
Awesome. Could you post your findings on a blog or something for future reference? Patrick Jamie O a écrit : I've never been so happy to realize I made such a stupid mistake! The subsequent error was related to a web service that I had somehow put an 'endpointdestinatio n' reference instead of a 'destination' . Splitting the pieces of the example services-config. xml as I previously posted does work quite well with FDS / cairngorm. Thank you so much guys! Jamie --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Jamie O jamie.oastler@ ... wrote: Hey, Much like a virgin learning to navigate the salacious curves of his first partner, I've tried putting it everywhere and had little success. Typo's aside, I've managed to resolve the on-save error with the FDS version by putting the destination in the remoting-config. xml. Now, when I load the .mxml in the browser I get a Error: Cannot assign operations into an RPC Service (endpointdestinatio n) at mx.rpc::AbstractSer vice/http://www.adobe. com/2006/ actionscript/ flash/proxy: :setProperty http://www.adobe.com/2006/actionscript/flash/proxy::setProperty() at com.post.mailbox. business: :Services/ ::_WebService1_ i() error message. I think for the time being I'll un-FDS my project but this is obviously not an optimal solution and one that I'm sure many are going to run into down the road. Hopefully Patrick's efforts in bringing FDS suppport to AMFPHP will resolve this quirk. Jamie --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Renaun Erickson renaun@ wrote: Jamie, You can try putting the the adapter in the remoting-config. xml. Leave the channel in the services-config. xml. ColdFusion's default remoting services-config. xml puts them all in one file, and thats what I end up doing for my non FDS stuff. One thing I did notice in terms of the Cairngorm stuff is the line of code that says: service = ServiceLocator. getInstance( ).getService( AMFPHPDestinati on) should read: service = ServiceLocator. getInstance( ).getService( roAMFPHPService ) Hope that helps, Renaun
Re: [flexcoders] Using an ID String as an Object Reference
this[componentIdName].reload(), although I think sending component names from ColdFusion is a terrible idea. Patrick 2006/12/18, Paul Whitelock [EMAIL PROTECTED]: I have a ColdFusion component that passes a string with the id of an Flex component to a Flex application (the component is instantiated in the Flex application). I want to call a method in the Flex component by using the id contained in the string. Is there any way to use the string value to lookup the actual object so that a function call can be made? For example, the string that is sent to the Flex application from ColdFusion is rowEditor and a component with that id exists in the application: ... var componentIdName:String = event.result[0].component; ... v:ContentRowRTE id=rowEditor / How can I use the string value to call a function named reload in rowEditor (i.e. rowEditor.reload())? I can't do this: componentIdName.reload() Is there a way to convert componentIdName to an object reference? Thanks for any help!
Re: [flexcoders] Re: Amfphp with AMF3 support: testers wanted
Could you post the services_config.xml file you have? Patrick 2006/12/18, Jamie O [EMAIL PROTECTED]: Hello, I am able to do a stand-alone .mxml project using the samples you have provided and connect well to my php methods / backend database. The issue I have is when trying to deploy this as part of a Flex Data Services / Cairngorm app I can't get the remote object to allow compile or usage without error. Anyone have a cairngorm / FDS scope example for using AMFPHP 1.9? If I do the closest equivelent of adding the relevant contents of your services-config.mxml to the already created one for FDS I get a Destination 'AMFPHPDestination' must specify at least one adapter error message when starting the server (Tomcat 5.5) If I do a purely-client side entry of the endpoint in the services.mxml instantiation I get other errors - and this is also not a way I want to go as the endpoint URL would be exposed. Renaud's examples don't seem to include cairngorm-ified versions as was the case in the past and I haven't managed to crack this nut. Thx, Jamie --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Patrick Mineault [EMAIL PROTECTED] wrote: Hi all, I've finally gotten around to add AMF3 support to amfphp, so you can finally use Flex 2's RemoteObject with it. To test the new features, I've created a new Service Browser in Flex 2 which allows you to introspect services and test methods on the fly. I need people to test out the new AMF3 support. New/changed features: - $this-methodTable is DEAD. All methods in /services are now considered remotely accessible, unless you set them to protected or private (PHP5) or start the method name with an (_), in which case it will throw an error. If you want to get a description of a method and it's arguments without looking at the class itself, add JavaDoc to the method and you should see it in the new Service Browser. - _authenticate is dead, as a side-effect of the removal of the methodTable. You can secure methods by creating a special function called beforeFilter($methodName) in your class and return false to stop a method from being executed. (the _ and the beforeFilter are the conventions used by CakePHP, so I figured I'd use those instead of rolling my own). - Circular references in AMF0 and AMF3 should now work. Class mapping code has been ported to the AMF3 code also. To use remote class mapping, use registerClassAlias or the [RemoteClass] metadata tag, then read the instructions in advancedsettings.php - Returning a mysql_query will now return either an Array or an ArrayCollection depending on the setting in gateway.php. Other database types are currently unsupported in AMF3 mode (they will be supported as soon as I am sure the AMF3 code is perfect). - You can send ByteArray, ArrayCollection and ObjectProxy instances as arguments to remote methods. You will receive the result as a string, as the inner array and as the inner object, respectively. Currently there is no way to send back these types to Flash, but there will be in the next version. - /browser now brings up the brand spanking new Flex 2-based service browser. You can test methods directly through it. If the method returns an array or arraycollection, the browser will attempt to show it in a datagrid (sweet). Please feel free to modify servicebrowser.mxml (it's very spaghetti-code-ish, but it works). You will need the Adobe corelib to compile (google for the link) Limitations/things to keep in mind: - MySql works but not other databases - You can use a JSON string for arguments in the service browser. However you must wrap object keys in quotes (a limitation of Adobe corelib). - Paged recordsets don't work anymore - Only tested in PHP5. PHP4 might show issues with circular references. - Calling two methods on a remoteObject one after the other (during the same frame) might not work. - Charles and ServiceCapture have some issues with AMF3 handling. You might see strings which seem out of place in your output while it works fine in Flash. I will notify the people involved. You might want to set PRODUCTION_SERVER to true in gateway.php if this is a recurrent problem, in the meantime. - If you need to send to Flash a class and want it to be mapped to a class in a package, you need to add a key to the class called _explicitType with a value of com.mypackage.TheClass and use registerClassAlias or [RemoteClass] as usual ( a limitation of php not supporting packages) All that being said, I need testers. Please download it here: http://5etdemi.com/uploads/amfphp-1.9.alpha.zip (although it states it is amfphp 1.9, there will be no amfphp 1.9. amfphp 2.0 will be amfphp 1.9 + JSON and possibly XML-RPC) If you run into any issues, please either: - Create a minimal test case which shows the reproducible bug, then send it to me. - In gateway.php, uncomment $gateway-logIncomingMessages and logOutgoingMessages, create
Re: [flexcoders] Re: Amfphp with AMF3 support: testers wanted
Dang. I really don't know what to tell you man, it looks like everything is in order. Unfortunately the services config file format is little documented and uses new meanings for old terms which makes it completely cryptic and unreadable, IMHO. Patrick 2006/12/19, Jamie O [EMAIL PROTECTED]: For the stand-alone basic .mxml I used a copy of the basic example Renaud gave - with a different URL for the gateway which is located on a separate server. For the cairngorm / FDS version, here are the changes I made to the default FDS .xml files 1) In services-config.xml, add the service to the services section beneath the 4 service include path links add the service: services service-include file-path=remoting-config.xml / service-include file-path=proxy-config.xml / service-include file-path=messaging-config.xml / service-include file-path=data-management-config.xml / service id=amfphp-service class=flex.messaging.services.RemotingService messageTypes=flex.messaging.messages.RemotingMessage destination id=AMFPHPDestination channels channel ref=my-amfphp/ /channels properties source*/source /properties /destination /service /services 2) In services-config.xml, Add to the channels section add the following channel: channel-definition id=my-amfphp class=mx.messaging.channels.AMFChannel endpoint uri=http://externalURLaddress/amfphp/gateway.php; class=flex.messaging.endpoints.AMFEndpoint/ /channel-definition 3) Here's the services.mxml remote object: cairngorm:ServiceLocator xmlns:cairngorm=com.adobe.cairngorm.business.* xmlns:mx=http://www.adobe.com/2006/mxml; mx:RemoteObject id=roAMFPHPService destination=AMFPHPDestination source=AccountService showBusyCursor=true mx:method name=checkLogin / /mx:RemoteObject /cairngorm:ServiceLocator 4) And the relevant parts of the login delegate which calls: import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.remoting.RemoteObject; public class LoginDelegate { protected var service:RemoteObject; protected var responder:Responder; public function LoginDelegate(p_responder:Responder) { trace(LoginDelegate::constructor); responder = p_responder; service = ServiceLocator.getInstance().getService(AMFPHPDestination) as RemoteObject; } public function CheckLogin():void { trace(LoginDelegate::CheckLogin function - + p_AttemptedUser.UserID); service.addEventListener(ResultEvent.RESULT, CheckLogin_onResult); service.addEventListener(FaultEvent.FAULT, CheckLogin_onFault); service.checkLogin(UsernameTest, PasswordTest); } protected function CheckLogin_onResult(event:ResultEvent):void { trace(LoginDelegate::CheckLogin_onResult - Output); trace(event.result); responder.onResult(new ResultEvent(ResultEvent.RESULT, false, true, event.result)); service.removeEventListener(ResultEvent.RESULT, CheckLogin_onResult); service.removeEventListener(FaultEvent.FAULT, CheckLogin_onFault); } And I receive the error Destination 'AMFPHPDestination' must specify at least one adapter. The php service isn't anything special, just give username / pass, validate in query to the mySQL DB and return a specific data element if valid. I know from ServiceCapture and the other version that I don't have an issue on that side. Much thanks! Jamie --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Patrick Mineault [EMAIL PROTECTED] wrote: Could you post the services_config.xml file you have? Patrick 2006/12/18, Jamie O [EMAIL PROTECTED]: Hello, I am able to do a stand-alone .mxml project using the samples you have provided and connect well to my php methods / backend database. The issue I have is when trying to deploy this as part of a Flex Data Services / Cairngorm app I can't get the remote object to allow compile or usage without error. Anyone have a cairngorm / FDS scope example for using AMFPHP 1.9? If I do the closest equivelent of adding the relevant contents of your services-config.mxml to the already created one for FDS I get a Destination 'AMFPHPDestination' must specify at least one adapter error message when starting the server (Tomcat 5.5) If I do a purely-client side entry of the endpoint in the services.mxml instantiation I get other errors - and this is also not a way I want to go as the endpoint URL would be exposed. Renaud's examples don't seem to include cairngorm-ified versions as was the case in the past and I haven't managed to crack this nut. Thx, Jamie --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders%40yahoogroups.com, Patrick Mineault patrick.mineault@ wrote: Hi all, I've finally gotten around to add AMF3 support to amfphp, so you can finally use Flex 2's RemoteObject with it. To test the new features, I've created a new Service Browser in Flex 2 which allows you to introspect services and test methods on the fly. I need people to test out the new AMF3 support. New/changed features: - $this-methodTable is DEAD. All
Re: [flexcoders] NetConnection.Call.BadVersion
That's because you're getting a fatal error from PHP, and therefore the output from php is not valid amf. You can either point to debuggateway.php instead (if you're using amfphp 1.2), or you can install Charles debugging proxy or ServiceCapture to read the error, or you can call your service from the service browser, which can read fatal errors properly. Patrick Cameron Ray a écrit : I'm getting some troubs from Flex using AMFPHP remoting. I'll try to make this as brief as possible. I'm receiving the dreaded NetConnection. Call.BadVersion . It's a simple login service to check a username password against the mySQL DB. It works fine if I don't try to encrypt the password using the mcrypt module. Unfortunately, I NEED to use this encryption module so that existing users can login using this app. I've tried about every way I know howstill having problems. I'll post the code belowplease let me know if there's any ideas: ### START CODE # ### ?php include('dbConnectV alues.php' ); $EnCRYPTEdSECRETkEY = mySuperSecretKEY ; $alg = MCRYPT_BLOWFISH; $mode = MCRYPT_MODE_ CBC; $iv = %`; class VLlogin { function VLlogin() { $this-methodTable = array ( login = array ( description = Logs into Vidego Lite!, arguments = array(uName , pWrd), access = remote), encryptText = array( description = Encrypts pwd, arguments = array($someText ), access = remote) ); } function encryptText( $someText) { $encrypted_data = mcrypt_encrypt( $alg, $EnCRYPTEdSECRETkEY , $someText, $mode, $iv); $plain_text = base64_encode( $encrypted_ data); return $plain_text; } function login($uName, $pWrd) { $db_name = dbConnectValues: :$database; $server = dbConnectValues: :$dbserver; $username = dbConnectValues: :$username; $password = dbConnectValues: :$password; $fuser = $uName; $fpwd = $pWrd; //$fpwd = base64_encode( base64_encode( $fpwd)); $fpwd = encryptText( $fpwd); $connection = @mysql_connect( $server,$ username, $password) or die(Cound not connect to database.); mysql_select_ db($db_name, $connection) or die(Could not select database.); $sql = SELECT * FROM users WHERE username = '$fuser' AND password = '$fpwd'; $result = mysql_query( $sql); $numRows = mysql_num_rows( $result); if ($numRows 0) { $userInfo = mysql_fetch_ assoc($result) ; //$userInfo[ password ] = base64_decode( base64_decode( $userInfo[ password ])); return $userInfo; } else { return 'Please ensure your username or password are correct.'; } } } ? -Cameron
Re: [flexcoders] Flex using Actionscript 2.0
You can convert AS2 to AS3 (gets it about halfway there) using my converter here: http://www.5etdemi.com/blog/archives/2006/11/as2-to-as3-converter-createtextfield-geturl-handling/ Patrick Tom Chiverton a écrit : On Friday 15 December 2006 15:01, Giles Roadnight wrote: No, I don't think so, Flex will only work with AS3 as far as I know. Flex *2* will only work with AS3. Flex 1 or 1.5 will be fine with AS2, but costs a bomb. -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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: SEO Compatibility
Saying you shouldn't use Flex for content-focused website is going a little bit over the edge IMHO. I think we all definitely agree that for 100% content-focused sites, you should use HTML, and for 100% data-focused sites, you should use Flex. However in between those extremes, you can still use Flex and get your data indexed. For example, if you're going to create a blog in Flex, you are probably going to use some sort of ready-made blogging engine and plug it into a Flex front-end, using whatever means you feel are right (for example, using XML-RPC if you're using WordPress). Well, blogging engines create RSS feeds, and Google will index an RSS feed just fine. Then it's a matter of adding a link to the RSS feed in the HTML for the Flex app. Similarly if you create a message board. While I'm not convinced creating a blog or a message board interface in Flex is smart (I would advise against it personally), if you want to do it, you have options for getting it indexed. You don't have to sound angry when you're talking about it. It just sounds like you're trying to say PEOPLE, DON'T USE SCREWDRIVERS, YOU CAN'T DRIVE NAILS WITH THEM. Dude, that's why we have hammers. Patrick Doug McCune a écrit : How about this one as an example: the Adobe Restaurant Finder sample app, with the Recent Reviews page in particular. The app is here: http://examples. adobe.com/ flex2/inproduct/ sdk/restaurant/ recentReviews. html http://examples.adobe.com/flex2/inproduct/sdk/restaurant/recentReviews.html If you look at that app you can see user submitted reviews of restaurants. For example, there's a review of Addis Red Sea and the reviewer mentions E. Coli in the review. If anyone did a search for Addis Red Sea and E Coli this page would never come up. The only possible way to get the site to appear in search results would be to publish an alternative HTML version of all the reviews. And in fact a complete Google search for everything on examples.adobe. com shows that you can't find anything useful: http://www.google. com/search? q=site:examples. adobe.com+hl=enlr=filter=0 http://www.google.com/search?q=site:examples.adobe.com+hl=enlr=filter=0 Yes, the Restaurant Finder app wrapper HTML page is indexed, but that's useless. Now, a Google search for ecoli on Yelp turns up tons of user-submitted results: http://www.google. com/search? hl=enlr=q=site%3Ayelp. com+ecoli http://www.google.com/search?hl=enlr=q=site%3Ayelp.com+ecoli The Yelp team would never give that up. They simply can't do Yelp in Flex because they'd lose the search engine indexing. Now, I'm not saying that this is a huge problem. All it means is that at the moment Flex is not the answer for many websites. That's OK, Flex is still great at what it does well. But if you want any of your dynamic content indexed by search engines Flex is not the way to go. And it's not a matter of just thinking about how to include keywords. Flex just simply isn't an option, nor does it need to be, for websites like this. Use Flex for what it does, but trying to make a website in Flex that needs to be indexed by a search engine simply isn't an option at the moment. And this example of the restaurant review stuff is a typical example of tons of other types of websites that shouldn't be done in Flex. Blogs, news sites, message boards, the list goes on and on. But if you're doing some stuff that needs data visualization or you can do without search engine indexing, then by all means use Flex. And I say this as a HUGE fan of Flex. People just need to use it for what it's good at. Doug John Dowdell wrote: dougmccune wrote: While I know Adobe employees don't like to admit this, the answer is very simple: It is often impossible, and if not impossible then at least extremely difficult, to get your Flex content indexed by search engines. That's the straight answer. No more no less. A particular concrete example might help bring this conversation back to ground. Work using Flex as the creation tool can certainly be found by search engines. Identifying your reasonable target search terms is the first step. jd -- John Dowdell . Adobe Developer Support . San Francisco CA USA Weblog: http://weblogs. macromedia. com/jd http://weblogs.macromedia.com/jd Aggregator: http://weblogs. macromedia. com/mxna http://weblogs.macromedia.com/mxna Technotes: http://www.macromed ia.com/support/ http://www.macromedia.com/support/ Spam killed my private email -- public record is best, thanks.
Re: [flexcoders] Spell Checker
As far as the PHP side of things goes, there are functions already built-in for that. You can read about it here: http://www.zend.com/zend/spotlight/spellchecking.php You could call php to do the spell check every so and so seconds or after every space or with a button... Really depends on what you want. As for the backwards looping use String.lastIndexOf(' '). For the formatting take a look at setTextFormat. Patrick jmfillman a écrit : I've seen the Component on the Flex Exchange, and it's not going to meet my needs, primarily because my app won't always have an internet connection to use the Google API. Also, I need the custom dictionary to be in my DB so users have access to it regardless of what PC they are using. So, I'm asking for some advice and ideas on creating my own Spell Check feature using PHP and MySQL. I've been thinking about this in theory, and here are my initial questions where I would like feedback. Do I call a remoteObject after every keystroke to compare against a database table of words or do I wait until all the fields are filled out and then have the user click a button to Spell Check the fields? Maybe both? How efficient is this going to be with say 100,000 words in the word list to check against? What about integrating a PHP spell checking function? How do I loop backward until I find a space so I am only checking the last word? How to allow the user to add words not in the standard dictionary to their custom table, from where they are in the application? How do I then set the style of the last word to red underline, change the text color, or some other visual representation to note an incorrect word? If using a Spell Check button, I'd like to change the tab color to a different color, if there are spelling mistakes in fields on that tab. I'd also like to highlight fields where there are spelling mistakes.
Re: [flexcoders] Re: Flex and .net webservices
Try ObjectUtil.toString(myObject) Patrick Robin Burrer a écrit : Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here’s the code. I reckon this is as basic as it gets … public function onMyResult(event: ResultEvent) :void { // this works fine var myObject:Object = Object(event. result); // this causes an error ( Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses. Employee. ) var myEmployee:Employee = Employee(event. result); // does not work trace (myEmployee. employeeName) ; // does work trace (myObject.employeeN ame); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ ComplexDataTypeS ervice/Service1. asmx?WSDL id=myWebservice makeObjectsBindable =false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName: String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin * From: * [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* [EMAIL PROTECTED] ups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber . Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectPro [EMAIL PROTECTED] to webserviceClasses. TelephoneNumber. Any help is highly appreciated. Robin -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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] Amfphp with AMF3 support: testers wanted
Hi all, I've finally gotten around to add AMF3 support to amfphp, so you can finally use Flex 2's RemoteObject with it. To test the new features, I've created a new Service Browser in Flex 2 which allows you to introspect services and test methods on the fly. I need people to test out the new AMF3 support. New/changed features: - $this-methodTable is DEAD. All methods in /services are now considered remotely accessible, unless you set them to protected or private (PHP5) or start the method name with an (_), in which case it will throw an error. If you want to get a description of a method and it's arguments without looking at the class itself, add JavaDoc to the method and you should see it in the new Service Browser. - _authenticate is dead, as a side-effect of the removal of the methodTable. You can secure methods by creating a special function called beforeFilter($methodName) in your class and return false to stop a method from being executed. (the _ and the beforeFilter are the conventions used by CakePHP, so I figured I'd use those instead of rolling my own). - Circular references in AMF0 and AMF3 should now work. Class mapping code has been ported to the AMF3 code also. To use remote class mapping, use registerClassAlias or the [RemoteClass] metadata tag, then read the instructions in advancedsettings.php - Returning a mysql_query will now return either an Array or an ArrayCollection depending on the setting in gateway.php. Other database types are currently unsupported in AMF3 mode (they will be supported as soon as I am sure the AMF3 code is perfect). - You can send ByteArray, ArrayCollection and ObjectProxy instances as arguments to remote methods. You will receive the result as a string, as the inner array and as the inner object, respectively. Currently there is no way to send back these types to Flash, but there will be in the next version. - /browser now brings up the brand spanking new Flex 2-based service browser. You can test methods directly through it. If the method returns an array or arraycollection, the browser will attempt to show it in a datagrid (sweet). Please feel free to modify servicebrowser.mxml (it's very spaghetti-code-ish, but it works). You will need the Adobe corelib to compile (google for the link) Limitations/things to keep in mind: - MySql works but not other databases - You can use a JSON string for arguments in the service browser. However you must wrap object keys in quotes (a limitation of Adobe corelib). - Paged recordsets don't work anymore - Only tested in PHP5. PHP4 might show issues with circular references. - Calling two methods on a remoteObject one after the other (during the same frame) might not work. - Charles and ServiceCapture have some issues with AMF3 handling. You might see strings which seem out of place in your output while it works fine in Flash. I will notify the people involved. You might want to set PRODUCTION_SERVER to true in gateway.php if this is a recurrent problem, in the meantime. - If you need to send to Flash a class and want it to be mapped to a class in a package, you need to add a key to the class called _explicitType with a value of com.mypackage.TheClass and use registerClassAlias or [RemoteClass] as usual ( a limitation of php not supporting packages) All that being said, I need testers. Please download it here: http://5etdemi.com/uploads/amfphp-1.9.alpha.zip (although it states it is amfphp 1.9, there will be no amfphp 1.9. amfphp 2.0 will be amfphp 1.9 + JSON and possibly XML-RPC) If you run into any issues, please either: - Create a minimal test case which shows the reproducible bug, then send it to me. - In gateway.php, uncomment $gateway-logIncomingMessages and logOutgoingMessages, create an in and an out folder and run it again. Then send the log files (*.amf) to me. Please send the feedback to pm AT 5etdemi DOT com. I am confident it should be pretty stable, as most of the new code is lifted from Fluorine, but you never know. Once I am 100% sure the amf 3 code is bulletproof I will release another version with some publicity on the blog and the homepage (currently keeping the new code low-profile). Thanks, Patrick
Re: [flexcoders] webservices and Flex 2
Hi Robin, Whether you're using RemoteObject or WebService, the point of using either is _not_ to have to do that kind of serializing/deserializing. So it's all built-in, and it's all done behind the scenes, at the player level in the RemoteObject case and at the ActionScript level in the WebService case. As a side-note, if you're going to be creating web services (as opposed to using a ready-made one), you might as well use RemoteObject; WebService and RemoteObject do the same job, but SOAP is very verbose while AMF has a much smaller footprint, so RemoteObject usually beats WebService speed-wise by a large margin. Patrick Robin Burrer a écrit : What about the other way round? Can I convert an xml formatted object as an AS object as well without having to manually deserialize it? Robin * From: * [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED] ups.com ] *On Behalf Of *Robin Burrer *Sent:* Friday, 8 December 2006 12:25 PM *To:* [EMAIL PROTECTED] ups.com *Subject:* RE: [flexcoders] webservices and Flex 2 Too easy – that works great – thanks! * From: * [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED] ups.com ] *On Behalf Of *Carson Hager *Sent:* Friday, 8 December 2006 12:10 PM *To:* [EMAIL PROTECTED] ups.com *Subject:* RE: [flexcoders] webservices and Flex 2 You definitely do not have to do that. You simply pass AS objects that matches the arguments to the web service method and Flex handles serializing them. Carson _ _ _ _ Carson Hager Cynergy Systems, Inc. http://www.cynergys ystems.com http://www.cynergysystems.com/ Email: carson.hager@ cynergysystems. com mailto:[EMAIL PROTECTED] Office: 866-CYNERGY Mobile : 1.703.489.6466 * From: * [EMAIL PROTECTED] ups.com [mailto: flexcoders@ yahoogroups. com ] *On Behalf Of *Robin Burrer *Sent:* Thursday, December 07, 2006 4:58 PM *To:* [EMAIL PROTECTED] ups.com *Subject:* [flexcoders] webservices and Flex 2 Hi there, Is there any way to do the “AS Object” to XML serialization automatically? What do you do when you want to send complex data types to a SOAP webservice? Converting AS objects to XML manually somehow seems to be a bit clumsy. I noticed the http service has a property contentType which can be set to “application/ xml”. Is there anything similar for the webservice component? Robin -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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: SOLUTION: Unable to bind Warning
As long as we're on that subject... I've added a new setting to amfphp, which is: $gateway-setAmf3RecordSetFormat(Array); Which can also be set to ArrayCollection. I have yet to implement it, but does this sound like something useful to you? Patrick lostinrecursion a écrit : It's interesting how AMF does not provide the same wrapper functionality as HTTP and WEB services. Reason being, when using the standard CFC to AS Class mapping features of Flex 2, you could certainly benefit from such an automated conversion. For example, when passing data to Coldfusion as an ArrayCollection and getting it back as an Array. Nice find. I was having a similar issue.
Re: [flexcoders] Loader + RemoteObject's
The NetConnection class doesn't receive progress information from the player, unfortunately, so it would be impossible AFAIK to get progress information from it. The only way you could attempt to achieve this is using the Socket class and manually encoding and decoding the AMF3 packets while sending progress information. Seems like a major pain to attempt, though. Patrick pauscato1 a écrit : Hi, what I'm wonder about is! can you putt a loader on a remoteobject that loads a javaVo, so I can present the progres to the user. What i'm using today is a progressBar set to manual. Cato
Re: [flexcoders] UITextField - width anti-alias type - FEATURE REQUEST: more examples in documentation
Have you tried using getUITextFormat and then calling measureText on that? Patrick {reduxdj} a écrit : Flexmasters: I've tried this a dozen ways, what's the best way to get the width of a UITextField and I've brought it up a few times. I won't stop asking till somebody can help me then these results then they will be search friendly! I know you have better things to do than help me, so it's appreciated greatly. I made my own graphical bar chart and want the number planted evenly in the middle of my bar and I can't do that without the width of my my UITextField. My application looks terrible without this aligning in the center. Right now, I have a bunch of if statements to try to size my textfields and that's totally dumb...etc. I've tried: validateNow( ); inValidateNow( ) updateDisplayList( ); yourGuessIsBetterTh anMine(); I always get back 100 I just need an example -- please- also measureWidth requires anti-alias not set to null, how does one set that correctly? I wish Adobe would add more examples in the documentation about textfields, i mean look at the posts about textfields, wordwrap etc. a lot of people have questions about these new tools and not everybody migrated from flex 1.5, like me. There's a bunch of stuff that should have simple examples. Actually shouldn't every class have examples, in a perfect application development world? UITextField has no examples. Will there be more actionscript examples in flash because i notice that most examples in flex documentation are reserved for mxml than AS. I really miss the old days of mytextfield. _width... I'm done venting for tonight. ;) Thanks, Patrick
Re: [flexcoders] Flex eye candy and memory consumption
From what I understand, what Ted means is that the player asks for such and such amount of memory when it requires some, and may or may not give it back when it doesn't need it anymore. So the worst case scenario is that the memory consumed by the player is the maximum amount of memory since it was loaded (the ceiling). That's the worst case scenario however. In my personal tests in Firefox 2 when the totalMemory goes down the memory consumption in Firefox also goes down a few seconds later. I am talking about an app here which can take a full 100MB of memory in a few seconds then release it in a few more seconds later (lots of BitmapData manipulation and Loaders). I think what Ted means is that you can't expect the garbage collector to collect when you want it to and you can't expect that when the garbage collector is run the memory will go down immediately, although it should eventually based on the player's and the browser's memory allocation heuristics. As for the effects though, I think it's possible that the instance of the effect is still in memory after being used, but I doubt that's the actual cause of the problem, since the effect doesn't really contain all that much stuff in it. It's possible however that once the effect is played it doesn't completely clean up after itself. Things to look out for include filters, cacheAsBitmap set to true, wipe effect masks which linger on, etc. For example, if you use have a tween from a blur filter to set blurX from 4 to 0, you have to make sure after to set filters to an empty array and set cacheAsBitmap to false (filters automatically set cacheAsBitmap to true). You'd really have to look at the source code of the actual effect you're using to see how it works internally and see if it's doing the kind of cleanup you want it to do, and if not, then perhaps you should try to extend the effect to do the garbage collection yourself. Here's my advice however: don't bother doing this unless you're in the final stages of the application development. 10 MBs lingering about is not going to make your app crash. I would expect that at the end your app will have more important memory bottlenecks than this one, like heavy use of Repeaters, too much components initialized, etc. Patrick coderjun a écrit : Hello, I was wondering if anyone has run across memory consumption issues when using some of the eye candy in the Flex framework. Here are a couple of examples of what I am referring to: 1. The translucent overlay on the rest of the app when using Alert.show in modal mode. (vs. using the flag Alert.NONMODAL) 2. Using mx:WipeUp/ and mx:WipeDown/ for the inEffect and outEffect of a component. I've been tracking the effect of using these effects by watching Task Manager|Mem Usage for the firefox.exe process right before and right after these effects run. We're talking 4-10MB of memory consumed each time these effects are run. (I know because I've done the process of tracking with the same code and the effects turned off resulting in 300KB-1.5MB) . My concern is that: 1. I can't programmatically (minus the unsupported tip given to us by gskinner http://www.gskinner .com/blog/ archives/ 2006/08/as3_ resource_ ma_2.html http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html) force the Garbage Collector to run. 2. Since I can't force the Garbage Collector to run, the comments by Ted Patrick on Flash Player memory management and releasing memory back to the OS is highly concerning. (http://tech. groups.yahoo. com/group/ flexcoders/ message/48219 http://tech.groups.yahoo.com/group/flexcoders/message/48219 | http://tech. groups.yahoo. com/group/ flexcoders/ message/48330 http://tech.groups.yahoo.com/group/flexcoders/message/48330) I understand that effects would consume memory to run, but I don't like thinking that once the memory has been allocated I have no control on if it will be given back to the Operating System. I've tried leaving my app open all night to see if the memory allocation would go down and it doesn't. (You would think since the effects were long done it would) Also, the app I'm working on is one that needs to run all day, so closing and reopening the browser is not an option. Has anyone noticed what I've noticed or have any insight on how to use effects without increasing the footprint so? -Jun
Re: [flexcoders] vertically centering text
If your item renderer was a VBox you could set verticalAlign to middle. That might slow your app down if you have a lot of rows with VBoxes versus just plain Components. Patrick Pan Troglodytes a écrit : Is there any way to vertically center text? Specifically, I have a datagrid column that I want to have the text centered vertically in. mx:DataGridColumn headerText=Name mx:itemRenderer mx:Component mx:Label text={data.fullName}/ /mx:Component /mx:itemRenderer /mx:DataGridColumn Since there is also a image field, the height of each row is a lot higher than the text and I don't like how it looks. I can't find any property that seems to apply. I know there is a verticalCenter property, but it takes an int and seems to be completely undocumented in the Flex help. I've also tried working with styles but I couldn't find anything that would apply. -- Jason
Re: [flexcoders] Function Error
You forgot new ArrayCollection somewhere. Patrick jmfillman a écrit : When I click on the Submit button, I get the following error: TypeError: Error #1009: Cannot acces a property or method of a null object reference. at main/validateForm( ) at main/__btnFormSign_ click() What am I doing wrong? mx: State name=Forms mx:AddChild position=lastChild mx:Canvas width=200 height=31 right=10 top=39 mx:Button label=Submit id=btnFormSign click=validateForm (); mx:Script ![CDATA[ [Bindable] public var validationAC: ArrayCollection; public function validateForm( ) :void { if (text1.text. length 3) { validationAC. addItem({ label:Text1 , data:false}) ; } } /mx:Script /mx:Button /mx:Canvas
Re: [flexcoders] AMFPHP / databinding nested arrays
Hmmm, why exactly are you sending nested arrays from amfphp? Why can't you just send a flat array? Patrick carkraus a écrit : Hi there, I guess this is a typical newbie question, maybe someone could kindly direct me to a tutorial or sample: I try to bind e.g. using a charts control to a nested array I receive from an AMFPHP service. On the php side I have as an example: $outputArr[] = array('day' = 'Mon', array('start' = '100', 'end' = '300')); $outputArr[] = array('day' = 'Tue', array('start' = '250', 'end' = '600')); $outputArr[] = array('day' = 'Wed', array('start' = '500', 'end' = '600')); return $outputArr; ..which will deliver the data correctly as I can see from the flex debugger. In flex I have eg.: mx:series mx:ColumnSeries xField=day yField=??? / /mx:series Now, how do I access e.g. the value 'start' to use it for databinding? Well, 'day.start' does not do the trick : ) I had similar probs using XML for binding, where I wouldnt be able to access sub-children? Do I have to somehow wrap the server response into an actionscript object which I'd have to manually add properties to? Any hint greatly appreciated! ! carsten
Re: [flexcoders] printf similar function
You can also use the mx.utils.StringUtil class, which has the substitute method. Patrick Lachlan Cotter a écrit : Hi Misael, That would be useful as ActionScript string concatenation operations are fairly clumsy with more than a few pieces. Unfortunately the AS String class doesn't seem to have such functionality. It's not so hard to roll your own, because you don't need to worry about the various types, you just need a single token and call toString() on all the arguments. Here's a sketch of something, but it's not very robust. You would have to add checking for zero-length arguments and other unexpected conditions. It might get a bit trickier also if you want to do various number formats like hexadecimal. ?xml version=1.0 encoding=utf- 8? mx:Application xmlns:mx= http://www.adobe. com/2006/ mxml http://www.adobe.com/2006/mxml layout= absolute creationComplete= testFormat( ) mx:Script ![CDATA[ import mx.controls. Alert; public function stringFormat (format:String, ... args):String { var parts:Array = format.split( '%@' ); // Parts should have one more element that args. if (parts.length != args.length + 1) throw new Error( Problem with your logic! ); var output:String = parts[0]; for ( var i:Number = 0; i args.length; i++) { output += args[i].toString( ); output += parts[i + 1]; } return output; } public function testFormat (): void { var str:String = stringFormat( Test, %@, insertion, %@, of, %@ vars , 42, 'a string' , {prop: 'test' }); Alert.show(str) ; } ]] /mx:Script /mx:Application Cheers, Lach On 07/11/2006, at 11:13 PM, Misael wrote: Hi, is there an utility class, function or anything in AS3 with similar functionality of C printf function? I need to format a string just like I do it with this function, along with all the capabilities which comes along (%d, %s, etc). Thanks!
[flexcoders] Can't get focusRoundedCorners to work on ButtonBar
I'm trying to accomplish the following: have a ButtonBar in which each of the buttons has rounded corners (unlike the default where only the left most and right most buttons have some rounded corners). I've been playing with this for a while now, and I can't get it to work. Here's some minimal code: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=* layout=vertical mx:Style ButtonBarButton { focus-rounded-corners:tl tr bl br; corner-radius:10; } .ButtonBarButton { focus-rounded-corners:tl tr bl br; corner-radius:10; } /mx:Style mx:ButtonBar focusRoundedCorners=tl tr bl br dataProvider={vs} firstButtonStyleName=ButtonBarButton buttonStyleName=ButtonBarButton lastButtonStyleName=ButtonBarButton / mx:ViewStack id=vs mx:Box label=1 mx:Button label=button 1 / /mx:Box mx:Box label=2 mx:Button label=button 2 / /mx:Box mx:Box label=3 mx:Button label=button 3 / /mx:Box /mx:ViewStack /mx:Application As you can corner-radius works correctly but focusRoundedCorners fails in all circumstances. Some of the code here is redundant or non-sensical but it's just to show that I have tried everything I could think of. Any ideas?
[flexcoders] Re: printf similar function
There is a Sprintf class for AS2, available here: http://natecook.com/downloads/sprintf.html You can try running it through my AS2 to AS3 converter here: http://www.5etdemi.com/convert/ Good luck, Patrick --- In flexcoders@yahoogroups.com, Lachlan Cotter [EMAIL PROTECTED] wrote: Hi Misael, That would be useful as ActionScript string concatenation operations are fairly clumsy with more than a few pieces. Unfortunately the AS String class doesn't seem to have such functionality. It's not so hard to roll your own, because you don't need to worry about the various types, you just need a single token and call toString() on all the arguments. Here's a sketch of something, but it's not very robust. You would have to add checking for zero-length arguments and other unexpected conditions. It might get a bit trickier also if you want to do various number formats like hexadecimal. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=testFormat() mx:Script ![CDATA[ import mx.controls.Alert; public function stringFormat (format:String, ... args):String { var parts:Array = format.split('%@'); // Parts should have one more element that args. if (parts.length != args.length + 1) throw new Error(Problem with your logic!); var output:String = parts[0]; for (var i:Number = 0; i args.length; i++) { output += args[i].toString(); output += parts[i + 1]; } return output; } public function testFormat ():void { var str:String = stringFormat(Test, %@, insertion, %@, of, %@ vars, 42, 'a string', {prop:'test'}); Alert.show(str); } ]] /mx:Script /mx:Application Cheers, Lach On 07/11/2006, at 11:13 PM, Misael wrote: Hi, is there an utility class, function or anything in AS3 with similar functionality of C printf function? I need to format a string just like I do it with this function, along with all the capabilities which comes along (%d, %s, etc). Thanks!