Please visit the URL below for details on how to invoke a PHP from Flex application.
You can also access web service directly from the Flex application. Please visit the URL below for more details.
Hope this helps.
In this code, change the url of HTTPService to that for your PHP script. Also, change the value of resultFormat to e4x if your PHP script is returning XML. Other changes might be necessary, of course.
Thanks for the responses. I'm gonna have to go ahead and put in a lot more time reading over this provided information.
Greg, thanks a lot! This little script is indeed working exactly as expected, so that's cool. I see how you got the button to act upon clicking and call the web service. I also see how the resultHandler() is working for the most part but I'm getting lost with 'event' and the fact that the function is between CDATA tags, and the import of mx.rpc.events.ResultEvent...how do you even know what imports you need and when..?? LOL, please forgive my ignorance.
Do you have to hand write most of that type of stuff or are there Design mode ways of adding these things? I don't see an HTTPService control in design mode..?? What language is the resultHandler function even using..?? Is that ActionScript?
Obviously I've got a lot to read and learn but any quick tips that could be provided here would be appreciated. I'm proficient in PHP and have done a lot web services but never with any kind of cool user interface front-end like flash, or .net, or anything like that. :( I feel lost again, but I need this functionality!
Yeah, for this kind of stuff you need to know some things.
The fact that you are unfamiliar with the <Script> tag, or at least the CDATA section within it, tells me you need to read at least these FB3 help section, and all its sub-sections:
Flex Programming Elements
If you do that most of your questions will be answered. I never use design view, so I can't speak to those questions.
I'll answer some of your questions now.
The language in the <Script> tag is ActionScript 3. It needs to be wrapped in a CDATA section because otherwise stuff like < & > etc. will be intepreted as bad XML. Remember, the MXML file is an XML file.
You will know what to import either because you have learned the ActionScript you need to do what you are trying to do, or because you will get errors and then you know you need to import. Sometimes the import statement will be added automatically.
I always hand code my Flex apps, and never use design mode, because once you get used to it, its not hard, and if you will be coding AS (ActionScript) you will be there anyway. Being able to code AS is where the $$$ will come as Flex grows in popularity. I believe there will be a ton of cash for people good at AS over the next 5 years.
Read Essential ActionScript and you'll be all set.
Be aware that events for things like HTTPService are a bit different than events for things like buttons, etc. because they do not get dispatched based on user input. And they are dispatched asynchronously, meaning you call the HTTPService send() method, and you can't depend on the data being available right away. That's why we use the result event.
Go through the "Flex Programming Elements" and all its sub-sections, and over time, go through the entire FB3 help system, and you will reach Nirvana. I went through most of the FB 2.0.1 help system twice, compiling all the sample programs, a little each day over a four or five month period, and I learned a lot.
Thanks again for the information. I wasn't thinking too clearly when looking at CDATA. Makes perfect sense. I'm gonna start digging through the ActionScript 3.0 stuff in the Flex help files and hopefully that'll get me rolling.
I've just got a particular project that I've done in FileMaker Pro distributing with FM Runtime and I'd really like to move away from it! :)
Ok, I just finished up the Lynda.com Essential Training for Flex Builder 3 and I've got a much better handle on things. Still got a ways to go but I like what I see so far. :)
One thing this video series didn't mention at all was the ability to create local databases. I was at eBay Live last month and I talked to some guys at the Adobe booth that said I could create local databases and send SQL queries to them just like I'm used to, or of course, use a remote database.
I've got a good handle on using a remote database now, but what about local databases so the client can browse through their records even if they don't have an internet connection?
I'm coming up short on information regarding this. Thanks!
Ah, that's because it's for AIR and these vids were focusing on Flex web apps. I think I found what I need in the help files.
Yeah, Flex is really kool, but AIR is where mucho cash will be in the next 5 - 10 years.
Will Flex apps run inside mobile flash players for cell phones? Is there an AIR plugin for mobile devices?
Not in all mobiles... it mean iOS is excluded, i mean flash player.
about air... its apps can be runned on Android and
iOS, but dont know if blackberry yet has had AIR runtime released... it should
on symbian/windows i dont think there is any AIR runtime available