Bonjour, j'utilise amfphp pour mes communication entre flash et php, j'aimerais optimiser un peu. J'ai une classe User en php,
quand je me log je me créer un User en php en variable de session et je le transfert à flash
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 class User { public $Id; public $nom; public $prenom; public $option; public $groupe; public $email; public $photo; public $telephone; public $gsm; public $contact; public $etat; private $mysql; public function User() { } public function __set($property,$value) { } public function toString() { return "[User->Id=".$this->Id." nom=".$this->nom." prenom=".$this->prenom." option=".$this->option." email=".$this->email." photo=".$this->photo." contact=".$this->contact." etat=".$this->etat."]"; } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 $mySession->myUser=$myUser; return $myUser;
dans mon flash j'ai une classe user
Quand je récupere mes infos via une connexion amfphp avec le code suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 // nouvelle définition de ma classe User: package vnd.utilisateur { import vnd.web.utilisateur.ListeContact; import vnd.utilisateur.Contact; import flash.events.*; import flash.net.* import flash.display.* // definition de ma classe User public class User { public var nom:String; public var prenom:String; public var groupe:int; public var email:String; public var photo:String; public var Id:int; public var contact:Array; public var etat:String; public function User() { etat="horsLigne"; } //affiche la liste de cotnact public function afficheContact() { } //fonction qui affiche le nom de la personne dans la zone de texte public function afficheNom() { //nom_txt.text=prenom+" "+nom; } //fonction utilisée pour le trace public function toString ( ):String { return "[Utilisateur prenom : " + prenom +", nom : " + nom + ", groupe : " + groupe + ", email : " + email + ", photo : " + photo +", etat : "+etat+" ]"; } } }
J'obtiens ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 function succes ( pRetour:* ):void { for ( var p in pRetour ) { trace( p, " : " + pRetour[p] ); } }
prenom : dupont
etat : null
contact : null
Id : 1
nom : toto
gsm : 06842245224
option : null
telephone : 0325656468
photo : null
email : toto@.fr
groupe : null
et j'aimerais que cela m'instancie directement un user via ma classe user en as3
Partager