views:

177

answers:

2

Im new to ActionScript and Flex 3... im trying to develop an MVC 100% OOP application with Flex 3 using MXML,AS3 and PHP.

M (PHP) V (MXML) C (AS3)

The 3 layers i choose for my development. I have 10 AS3 classes that are object related between them and some inherit or implement interfaces.

The only problem here is how to interact 100% OOP with my model. In this case my model has to be a PHP Class that needs to be called from AS3 (the controller).

For example the AS3 class : Patient have a method called Save:

    public function Save(data:Array) : void
    {
        /* PHP call - model layer */
    }

I want to create an instance of my PHP Patient Model class that connects to the DB and insert the data array into it.

What should i use ? how can i also return a variable to AS3 ? What happen to as3 if there is a cached Exception in PHP ?

Thanks in advanced :)

A: 

check out haXe. simply use it instead of AS3 and PHP. use haXe serialization to transport objects between application tiers. you may even want to use haXe remoting to make things simpler.

greetz
back2dos

back2dos
+1  A: 

Hi,

I think you got it a bit wrong as where PHP fits into the mix. (Or I got you wrong) 1. MVC is flex usage only Model - inside flex (as3) View - Flex view Controller - Flex controller

PHP fits into the mix when using MVCS s--> Service.

Now, as for the MVC part, you can use frameworks like Mate (by Afusion) or the RobotLegs. Both are great, I love Mate and have been using it for quite a while now, the advantage of Mate is you use only Puse Flex/AS3 object an none framework-specific objects.

After connecting to your service from the controller, or from the MAP (if you are using Mate) you can receive/send data using AMF --> ActionScript Messaging Format.

But still, you have to hold a client side class representation for every server side one. for example --> User.php --> User.as --> ArrayCollection of User and so on and so forth.

Avi Tzurel