Fx{r} (flexer) first online meeting

For those of you that are Romanian speakers (:D), and are interested in Flex, January 12th at 19:00 Romanian time, flexer group will hold its first online meeting. Here is the link for the meeting. I plan to attend the meeting!

In case you didn’t know, any Adobe Group Manager can ask for an account for Acrobat Connect, and thus any group can use this platform for online meetings.

Adobe TV segment: Debug Flex and PHP projects

My segment on debugging Flex and PHP projects with Flex Builder and Zend Studio was posted on Adobe TV. In case you haven’t visited Adobe TV for a while, Adobe TV has improved in terms of usability. Now you can dig for what you care about more easily using channels (Education, MAX, Developer…) and products (Flash, Flex…) categories. Enjoy!

And here is another segment on how to create a combined project Flex and PHP.

Throwing an error when working with PHP and AMF

So you have PHP on your server, and Flex (web or AIR application) on your client. You also use AMF / remoting to communicate between the client, and the server. How do you send an error from the server to the client? You may find yourself in situations when you want to bubble up an error from the PHP side up to the Flex client, where you can display it to the user.

So how do you do this?

As a matter of fact it is pretty simple. As a starting point you can have a look at the two articles I wrote on PHP and AMF ZendAMF and AMFPHP. You can use the projects that you find attached there.

Basically, the way to do this is by throwing an Exception from your PHP file. This exception will bubble up to Flex, wrapped into a FaultEvent. If you register a listener on the RemoteObject for the fault event, then you are done!

Below is sample pseudo code showing you can do it.

PHP code

Suppose you expose a PHP class called MyService, which has a method getData(). This is how you can throw an error:

   1: class MyService {
   2:
   3:     public function getData() {
   4:         if (some_condition_is_false) {
   5:             $errorCode = 1;
   6:             throw(new Exception('the error message you want', $errorCode));
   7:         }
   8:     }
   9:
  10: }

So basically, you create an Exception passing two arguments to the constructor: a string (the error message), and a integer (the error code).

Flex code

And here is the code for the Flex side. I have the RemoteObject and the listener function for the fault event. I chose to display the error details using an alert.

   1: private function faultListener(event:FaultEvent):void {
   2:     Alert.show(event.fault.faultCode + ": " + event.fault.faultString, "Error");
   3: }
   4: ...
   5: <mx:RemoteObject id="myRemote" destination="zend" source="MyService" showBusyCursor="true" fault="faultListener(event)">
   6:     <mx:method name="getData" result="getDataListener(event)"/>
   7: </mx:RemoteObject>

On the fault event, you can find the error code you sent from PHP using event.fault.faultCode, the error message using event.fault.faultString, and the file and the line number from where the exception was thrown using event.fault.faultDetail.

Note: It seems that for the ZendAMF, the exception doesn’t pass all the information back to Flex. I suspect there is a problem in the PHP serializer, and thus only the error code gets to Flex.

2009 PHP UG Europe Tour

First of all, as this is my first post for this year, let me wish you all a Happy New Year!

This year, we want to visit as many as possible PHP User Groups throughout Europe. I’ve already set up some meetings in Norway, Denmark, and the Netherlands. And we are working to set up more in Germany, Poland, and Czech as we speak. The idea is to present a session about Flex, AIR, and PHP to PHP programmers. It will cover what Flex and AIR are, and why you should care, but also it will give information about how to use the tools, and how to pass around data between the PHP server and the Flex/AIR client.

You can give us a hand as well. If you are a member of a PHP UG from Europe, or you know someone who is, just post a comment here, or send me an email. I will do my best to come to your town and present a session about Flex, AIR, and PHP to your members. And after the meeting, maybe we can hang around for some beer. If I will not be available, one of my colleagues will be. That’s a promise!

Total Training for Adobe Flex 3

To make it more interesting, I will give to the first 5 people who help me to set up a meeting in Europe for PHP programmers a DVD (Total training for Adobe Flex 3 Rich Internet & AIR Applications Hosted by James Talbot), and an Adobe T-shirt (sorry I don’t have a picture for the T-shirt, but Magda, our Marketing Manager has caught a cold and all the materials are locked up in our secret vault). Come on gentlemen and ladies, let’s talk dirty about Flex, AIR, and PHP, and have some beer at the same time!

Netherlands, PHP mini conference

January 24, 2009

Around January 24th it will be a PHP mini conference in Netherlands, and I will give a session about Flex and PHP

London PHP Conference

February 26, 2009toFebruary 28, 2009

I will be in London to attend London PHP Conference, and to give a session about Flex and PHP, how to use Flex Builder and Zend Studio for creating Flex and PHP app, how to bring data from PHP to Flex.

Denmark, Flex & AIR for PHP programmers

February 3, 2009toFebruary 4, 2009

I will give a session about Flex and AIR for PHP programmers to the Danish PHP UG.

Norway, Oslo – Flex & AIR for PHP programmers

February 2, 2009

I will give a session to the Norwegian PHP UG about Flex and AIR

← Previous Page

Switch to our mobile site